LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-16-2002, 07:46 PM   #1
d-rez
LQ Newbie
 
Registered: May 2002
Distribution: RH 7.2
Posts: 18

Rep: Reputation: 0
2 nic gateway problem


I have 2 nics in my red hat 7.2 server.

I want to know how to set up (the command)

both eth0 and eth1 with diff gateway addressess.

i went into /etc/sysconfig/network but it only shows 1 gateway
address.

I want eth0 to have 192.168.4.1
and eth1 to have 192.168.6.1
as the default router (gateway)

I am pulling my hair out on this one!!!!!

Thanks in advance!!
 
Old 06-17-2002, 02:25 AM   #2
arvind
LQ Newbie
 
Registered: Jun 2002
Location: India
Distribution: Red Hat
Posts: 2

Rep: Reputation: 0
If ifconfig command also not showing eth1 then do the following:

ifconfig eth1 desired IP up|down

Or If u want Microsoft like GUI just type netconfig in Command line. put what ever u like, But Make sure As per Network guru's Default router IP is only one.

Let me know If u want anything
 
Old 06-17-2002, 07:26 AM   #3
d-rez
LQ Newbie
 
Registered: May 2002
Distribution: RH 7.2
Posts: 18

Original Poster
Rep: Reputation: 0
ifconfig shows both as up

eth0

eth1

The problem is that they are on diff subnets

and only one seems to be doing all the work.

When I physicaly disconnect to line of eth1 and try to ping its IP
I still get a reply!!!!!!

Both IP's are still up but only eth0 is still pluged in??????????

I guess im asking 2 questions here.

1. why does it still see both IP's with only one pluged in
2. How do I set up both nic's to be on their own subnets. When I can only use 1 gateway?
 
Old 06-17-2002, 11:32 PM   #4
arvind
LQ Newbie
 
Registered: Jun 2002
Location: India
Distribution: Red Hat
Posts: 2

Rep: Reputation: 0
Cud u post the ifconfig out put. I think u need to set the routing table.
 
Old 06-20-2002, 05:40 AM   #5
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
You can have multiple gateways, but you have to tell the routing table WHEN to use each one.
My table...
# route
Kernel IP routing table
Destination..........Gateway.....Genmask......Flags Metric Ref Use Iface
192.168.2.0.............................255.255.255.0...U........0 .......... 0 .......... 0 ..........eth0
192.168.1.0.............................255.255.255.0...U ..... 0 .......... 0 .......... 0 ..........eth1
127.0.0.0...................................255.0.0.0 ..........U ..... 0 .......... 0 .......... 0 ..........lo
default...................age....................0.0.0.0.........UG ... 0 .......... 0 .......... 0.......... eth1

What this means is that ANY packets that are NOT local to eth1 or eth0, will go down the default route, which is to machine age found down eth1.
The basic problem after this is how to use a 2nd gateway within this routing table.
The Metric value decides the priority if one link is down,
OR you will need to add Network routes to separate the traffic between the 2 nics.
An example... packets to 203.109.252.3 go down the default route eth1, via age.
If I add a route to this address and a gateway, I can send them down eth0.
route add host 203.109.252.3 gw 192.168.2.1 eth0
# route -n
Kernel IP routing table
Destination .........Gateway Genmask .......... Flags Metric Ref Use Iface
203.109.252.3 ..192.168.2.6 255.255.255.255 UGH 0 0 0 eth0
192.168.2.0 ..........0.0.0.0 255.255.255.0 ..........U 0 0 0 eth0
192.168.1.0 ..........0.0.0.0 255.255.255.0 ..........U 0 0 0 eth1
127.0.0.0 ...............0.0.0.0 255.0.0.0 ....................U 0 0 0 lo
0.0.0.0 ....................age ..........0.0.0.0 ....................UG 0 0 0 eth1
Now there is a route for THAT address. The same applies if I add a network route instead of just a host address.
Check man route for more.
To do any more, like load balancing etc, you will need extra software, iproute2 for example.
Regards,
Peter
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Gateway with 3 NIC czezz Linux - Networking 1 07-11-2005 03:06 AM
Mandrake as gateway/firewall -Problem bringing up two NIC zhex900 Linux - Networking 6 06-01-2005 08:24 PM
Adding different gateway to the second NIC jomy Linux - Networking 3 12-25-2004 02:36 AM
configuring 2nd nic/gateway spooge Slackware 2 12-24-2004 02:22 PM
How to add second gateway IP on the same NIC? linux_angus Linux - Networking 4 01-21-2004 09:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration