Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

eth0 vs eth1 in RH9 install

Status
Not open for further replies.
Jul 19, 2004
8
GB
Hi, I've just installed RH9 on a dual NIC Server and am trying to work out network configuration after installation. This is a home network I'm setting up for learning purposes & hypothetical questioning such as this as I try to understand how to parameters affect behaviour.

I have 2 interfaces which will plug directly into my gateway/router
Eth0 - 192.168.0.21/24
Eth1 - 192.168.0.22/24
Gtwy - 192.168.0.1/24

Eth1 actually isn't connected (plugged into dead port) but I don't believe it should affect my ultimate question (+ I will later reconfigure it to connect directly to a client pc on diff subnet and route to my GW via Eth0, but thats later)

I know that I can write a script and add it to a /etc/rc#.d dir to run at boot time to set ip & route as required but I'm asking now about the files used to give me the config I currently at boot.

My current default configuration
Code:
[root@jasmine root]# ifconfig -a 
eth0      Link encap:Ethernet  HWaddr 00:04:AC:53:F3:DA  
          inet addr:192.168.0.21  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:39 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0

eth1      Link encap:Ethernet  HWaddr 00:02:55:50:EA:FC  
          inet addr:192.168.0.22  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:3 dropped:0 overruns:0 carrier:3

lo  .. the usual

[root@jasmine root]# route -n 
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1 
169.254.0.0     0.0.0.0         255.255.0.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         192.168.0.1     0.0.0.0         UG    0      0        0 eth1


[root@jasmine root]# ping -c 5 192.168.0.1 
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
From 192.168.0.22 icmp_seq=1 Destination Host Unreachable
From 192.168.0.22 icmp_seq=2 Destination Host Unreachable
From 192.168.0.22 icmp_seq=3 Destination Host Unreachable
From 192.168.0.22 icmp_seq=4 Destination Host Unreachable
From 192.168.0.22 icmp_seq=5 Destination Host Unreachable

--- 192.168.0.1 ping statistics ---
5 packets transmitted, 0 received, +5 errors, 100% packet loss, time 4026ms
, pipe 3
As you can see, it uses eth1 and even though eth0 is enabled/up it doesn't appear in the routing tables.
Why?[/color red]
I would have presumed eth0 and eth1 would both be in the table & that eth0 would have been used before eth1.


It appears to me from config files that both interfaces are setup almost identically, ie only diff is eth0/eth1 .21/.22 ip addr.
Code:
[root@jasmine root]# more /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.0.21
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
TYPE=Ethernet
USERCTL=no
PEERDNS=no
NETWORK=192.168.0.0
BROADCAST=192.168.0.255

[root@jasmine root]# more /etc/sysconfig/network-scripts/ifcfg-eth1
..
DEVICE=eth1
IPADDR=192.168.0.22
...


If I bring down eth1 and manually add eth0 to route, eth0 works as you would expect.

Code:
[root@jasmine root]# ifdown eth1
[root@jasmine root]# route add -net 192.168.0.0 netmask 255.255.255.0 dev eth0
[root@jasmine root]# route add default gateway 192.168.0.1

[root@jasmine root]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:04:AC:53:F3:DA
          inet addr:192.168.0.21  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:21495 errors:0 dropped:0 overruns:0 frame:0
          TX packets:22112 errors:0 dropped:0 overruns:0 carrier:0
 
eth1      Link encap:Ethernet  HWaddr 00:02:55:50:EA:FC
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:3 dropped:0 overruns:0 carrier:3
 
lo         .. the usual ..

[root@jasmine root]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth0


But as soon as I bring eth1 up, it dumps eth0 out of the picture.

Code:
[root@jasmine root]# ifup eth1
[root@jasmine root]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:04:AC:53:F3:DA
          inet addr:192.168.0.21  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:22783 errors:0 dropped:0 overruns:0 frame:0
          TX packets:23375 errors:0 dropped:0 overruns:0 carrier:0
 
eth1      Link encap:Ethernet  HWaddr 00:02:55:50:EA:FC
          inet addr:192.168.0.22  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:8 dropped:0 overruns:0 carrier:8
 
lo        .. usual.. 

[root@jasmine root]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.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         192.168.0.1     0.0.0.0         UG    0      0        0 eth1

The purpose of this post
What file/s are telling my system to use eth1 and not eth0??[/color red]

Why does eth0 not have an entry in route table?? - why is eth0 forgotten about when I up eth1?[/color red]


Any help in this matter greatly appreciated,
Thanks
 
The ordinality of interfaces is not dictated by the loading
of modules, a naming convention, etc..I would assume in your
case that eth1 is the first card on the pci bus, but I would
probably be totally wrong. It might also be that the highest addressed interface, in this case .22, on the same network is chosen in cases of multiple interfaces on the same network.

Your configuration is somewhat nonsensical anyway. If
one must have two nics on the same network usually
bonding is being done, in which case there is only one address, or a subinterface is used rather than another physical nic.
 
Like marsd, I'm not sure how HR determines the order of the interfaces by default, however in the redhat-config-network-gui you can associate a MAC address with an interface. This is also very nice for swapping PCMCIA network cards.
 
Like marsd, I'm not sure how HR determines the order of the interfaces by default, however in the redhat-config-network-gui you can associate a MAC address with an interface. This is also very nice for swapping PCMCIA network cards.
 
Thanks a lot for the replies.

Nonsensical reason -> I actually have a wireless gw/router. This Server uses a wireless ethernet bridge on eth0 to access gw/router. The client PC to be connected to eth1 will be a dual boot Linux/Solaris pc which will only be able to access the network through the Server. This is long term aim however the purpose of this post was more about why the default config is.


Say, for example I have a purposeful reason to have 2 NICs on the network.
ie. I have a physical hub, which both eth0 and eth1 are connected to & I require this for say redundancy, load balancing etc.

In such as case I believe I would want to following routing table.

Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth0
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth1
Or am I dreaming and this hypothetical isn't possible without using bonding?


Also, I just noticed that my default/eth1 only routing table has the following very undesireable line
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1
Where would 169.254.0.0/16 have come from?
I don't believe its the external addr/net of my gateway.

Thanks again
 
from "whois -h whois.arin.net 169.254"
NetRange: 169.254.0.0 - 169.254.255.255
CIDR: 169.254.0.0/16
NetName: LINKLOCAL
NetHandle: NET-169-254-0-0-1
Parent: NET-169-0-0-0-0
NetType: IANA Special Use
NameServer: BLACKHOLE-1.IANA.ORG
NameServer: BLACKHOLE-2.IANA.ORG
Comment: Please see RFC 3330 for additional information.
from RFC3330:
169.254.0.0/16 - This is the "link local" block. It is allocated for communication between hosts on a single link. Hosts obtain these addresses by auto-configuration, such as when a DHCP server may not be found.
 
Short answwer. NO.
You are looking for failover clustering. Pursue that
avenue of inquiry. There are many ways of doing this
and it is not my favorite topic, at all. ;) Not that
it's complicated..It can be very simple.

 
Damian,

What you're trying to accompish can be done if you were able to run a routing protocol like OSPF or IRGP.

You could plumb a loopback interface on the host, publish that as IP address of the host and advertise two routes to that address, one per interface, to your routing area. If one of the routers or one of the physical interfaces failed the route tables would converge on the other link. Depending on your upstream routers, you could also configure the TCP stack to provide load balancing while the two routes were up.

The redundancy could also be attained using HSRP, but not the load balancing.

However, I doubt either of these solutions would be an option on the equipment you're most likely running.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top