Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a Redhat 5.6 server with multiple network interfaces plugged into different network switch ports, mostly each on a different vlan/subnet. How do I know which interface is on which subnet?

As an example, eth0 is the primary interface and works fine. I plumbed up another IP from a different vlan on eth1, but I can't ping the gateway (and it is unpingable). I am told eth1 is plugged into a port on a different vlan (It is actually a heartbeat vlan for clustering). How do I test which controller is on a particular vlan?

eth1 (IP's changed):

[root@tsgxd3900 ~]# ifup eth1
Error: an inet prefix is expected rather than "GATEWAY<N>=10.56.35.1".
Error: an inet prefix is expected rather than "NETMASK<N>=255.255.255.0".
Error: an inet prefix is expected rather than "ADDRESS<N>=10.56.36.122".
Error: an inet prefix is expected rather than "GATEWAY<N>=10.56.35.1".
Error: an inet prefix is expected rather than "NETMASK<N>=255.255.255.0".
Error: an inet prefix is expected rather than "ADDRESS<N>=10.56.38.35".

[root@tsgxd3900 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.56.36.0       0.0.0.0         255.255.255.0   U     0      0        0 eth1
10.56.7.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1
0.0.0.0         10.56.7.1        0.0.0.0         UG    0      0        0 eth0

[root@tsgxd3900 ~]# ping 10.56.7.1
PING 10.56.7.1 (10.56.7.1) 56(84) bytes of data.
64 bytes from 10.56.7.1: icmp_seq=1 ttl=255 time=0.450 ms
^C
--- 10.56.7.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.450/0.480/0.510/0.030 ms

[root@tsgxd3900 ~]# ping 10.56.36.1
PING 10.56.36.1 (10.56.36.1) 56(84) bytes of data.
From 10.56.36.122 icmp_seq=2 Destination Host Unreachable

[root@tsgxd3900 ~]# ifconfig eth1
eth1      Link encap:Ethernet  HWaddr B8:E3:B6:AB:1C:6D
          inet addr:10.56.36.122  Bcast:10.56.36.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:65 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:8435 (8.2 KiB)
          Interrupt:77

Adding some more information:

[root@tsgxd3900 ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=tsgxd3900
GATEWAY=10.56.7.1
[root@tsgxd3900 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# NetXen Incorporated NX3031 Multifunction 1/10-Gigabit Server Adapter
DEVICE=eth0
BOOTPROTO=static
DHCPCLASS=
HWADDR=78:E3:B5:0B:7C:6C
IPADDR=10.56.7.243
NETMASK=255.255.255.0
ONBOOT=yes
[root@tsgxd3900 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
# NetXen Incorporated NX3031 Multifunction 1/10-Gigabit Server Adapter
DEVICE=eth1
HWADDR=78:E3:B5:0B:7C:6D
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.56.36.122
NETMASK=255.255.255.0
HOTPLUG=no
[root@tsgxd3900 ~]# cat /etc/sysconfig/network-scripts/route-eth1
GATEWAY<N>=10.56.35.1
NETMASK<N>=255.255.255.0
ADDRESS<N>=10.56.36.122

GATEWAY<N>=10.56.35.1
NETMASK<N>=255.255.255.0
ADDRESS<N>=10.56.38.35
[root@tsgxd3900 ~]#
share|improve this question
    
See my comment below about the format of the route-eth1 file. What you have there now should be changed. –  ewwhite Sep 22 '11 at 2:56
add comment

2 Answers

It looks like you have two default gateways defined. Can you post the output of the following files:

/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts/ifcfg-eth1 

You probably don't need a gateway statement in your eth1 interface. You should define any needed routes for the secondary interface that in an /etc/sysconfig/network-scripts/route-eth1 file, using the format:

10.56.36.0/24 via 10.56.36.1 dev eth1

share|improve this answer
add comment

On Red Hat, the IP configuration(if the person configure the interface through RH's tools), will be in ifcfg-INTERFACE files. Here is an example.

[root@server network-scripts]# cat ifcfg-eth0:1
# Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller
DEVICE=eth0:1
BOOTPROTO=none
BROADCAST=192.168.16.255
IPADDR=192.168.16.201
NETMASK=255.255.255.0
NETWORK=192.168.16.0
GATEWAY=192.168.15.7
TYPE=Ethernet
ONPARENT=yes

In some case, the routes will also be in the a separate file with the interface name:

[root@servername network-scripts]# cat route-eth0 
ADDRESS0=192.168.16.0
NETMASK0=255.255.255.0
GATEWAY0=192.168.15.1

ADDRESS1=192.168.17.0
NETMASK1=255.255.255.0
GATEWAY1=192.168.15.1

ADDRESS2=192.168.18.0
NETMASK2=255.255.255.0
GATEWAY2=192.168.15.1

From the command line, you can run ip addr or ip route as well:

[root@servername network-scripts]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether f4:6d:04:03:b4:18 brd ff:ff:ff:ff:ff:ff
    inet 192.168.15.200/24 brd 192.168.10.255 scope global eth0
    inet 192.168.16.201/24 brd 192.168.16.255 scope global eth0:1
    inet 192.168.17.201/24 brd 192.168.17.255 scope global eth0:2
    inet 192.168.18.202/24 brd 192.168.18.255 scope global eth0:5
    inet 192.168.15.201/24 brd 192.168.15.255 scope global secondary eth0:3
    inet 192.168.16.202/24 brd 192.168.16.255 scope global secondary eth0:4
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether e0:b9:a5:00:ea:14 brd ff:ff:ff:ff:ff:ff



[root@servername network-scripts]# ip route
255.255.255.255 dev eth1  scope link 
192.168.15.0/24 dev virbr0  proto kernel  scope link  src 192.168.15.100 
172.16.15.0/24 dev eth1  proto kernel  scope link  src 172.16.15.1 
192.168.122.0/24 via 192.168.15.100 dev virbr0 
169.254.0.0/16 dev eth1  scope link  metric 1003 
169.254.0.0/16 dev virbr0  scope link  metric 1004 
default via 192.168.15.1 dev virbr0 

Or:

[root@servername network-scripts]# ip route
192.168.18.0/24 dev eth0  proto kernel  scope link  src 192.168.18.202 
192.168.17.0/24 dev eth0  proto kernel  scope link  src 192.168.17.201 
192.168.16.0/24 dev eth0  proto kernel  scope link  src 192.168.16.201 
192.168.15.0/24 dev eth0  proto kernel  scope link  src 192.168.15.200 
169.254.0.0/16 dev eth0  scope link 
default via 192.168.15.7 dev eth0

(The last output is from a RH5-type machine)

share|improve this answer
    
What does that tell me? I can see the output of these commands, but I am not sure how to tell what subnet the ports are actually configured to? I also posted some updates to my question with the config file contents. –  Charlie B Sep 22 '11 at 2:55
    
Okay, are you referring to the server or switch? If the server, then you can tell by IP and net mask, which in this case, it means that interface is configured with a /24 subnet. If you are talking about the switch, you'll have to ask you network administrator for more details about the port configuration. They can tell you that as well as what subnets configuration you should be using. –  Rilindo Sep 22 '11 at 3:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.