LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   2 Gateways (http://www.linuxquestions.org/questions/linux-networking-3/2-gateways-33637/)

def1014 10-24-2002 12:49 PM

2 Gateways
 
How can I add a different gateway for a secondary NIC. I think I have set ip, but shouldn't it be showing when I do a netstat -rn? Would it be listed on there like the primary one is? What file is this Kernel routing information generated from? Thanks in advance. :confused:

markus1982 10-24-2002 01:59 PM

Re: 2 Gateways
 
Quote:

How can I add a different gateway for a secondary NIC.
In /etc/sysconfig/network-scripts/ifcfg-eth0 you have a layout that is like
Code:

DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.0.2
NETMASK=255.255.255.0
NETWORK=192.168.0.0
ONBOOT=yes

So just add GATEWAY=<IP> there, for instance
Code:

DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.0.2
GATEWAY=192.168.0.1
NETMASK=255.255.255.0
NETWORK=192.168.0.0
ONBOOT=yes


def1014 10-24-2002 02:30 PM

yes the information is correct in those files. But shouldn't it be listed w/ netstat -rn?
[root@intranet network-scripts]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.1.31.0 0.0.0.0 255.255.255.0 U 40 0 0 eth1
10.1.31.0 0.0.0.0 255.255.255.0 U 40 0 0 eth1
127.0.0.0 0.0.0.0 255.0.0.0 U 40 0 0 lo
0.0.0.0 10.1.31.253 0.0.0.0 UG 40 0 0 eth0

nonamenobody 10-24-2002 05:21 PM

You should be able to have two gateways, boot I imagine they would need to be on different subnets (i.e. 192.168.0.x and 192.168.1.x with some kind of routing between the two subnets).


All times are GMT -5. The time now is 11:15 PM.