RH 5.6上有多个networking接口

我有一个Redhat 5.6服务器,有多个networking接口插入不同的networking交换机端口,大部分都在不同的vlan /子网上。 我怎么知道哪个接口在哪个子网上?

举个例子,eth0是主界面,工作正常。 我从eth1上的另一个vlan探测到另一个IP,但是我无法ping通网关(而且是无法ping通的)。 我被告知eth1被插入到不同vlan上的一个端口(实际上它是一个聚类的心跳vlan)。 如何testing哪个控制器在特定的vlan上?

eth1(IP已更改):

[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 

添加更多信息:

 [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 ~]# 

看起来你有两个默认的网关定义。 你可以发布以下文件的输出:

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

您的eth1接口中可能不需要网关语句。 您应该使用以下格式为/etc/sysconfig/network-scripts/route-eth1文件中的辅助接口定义所需的任何路由:

10.56.36.0/24 via 10.56.36.1 dev eth1

在Red Hat上,IPconfiguration(如果用户通过RH工具configuration接口)将在ifcfg-INTERFACE文件中。 这是一个例子。

 [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 

在某些情况下,路由也将位于一个单独的文件中,其接口名称为:

 [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 

在命令行中,您也可以运行ip addr或ip route:

 [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 

要么:

 [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 

(最后一个输出来自RH5型机器)