我有4个运行Centos 5的服务器。它们都有两个以太网卡。
我在他们的eth0卡上configuration了192.168.1.x IP地址。 他们都使用他们的eth0卡连接到相同的交换机,他们都在工作。
我在他们的eth1卡上configuration了10.72.11.x IP地址。他们都使用eth1卡连接到同一个交换机 – 与eth0卡不同的交换机 – 它们都不工作。
他们的configuration文件是这样的:
DEVICE=eth1 BOOTPROTO=static IPADDR=10.72.11.236 BROADCAST=10.72.11.191 NETMASK=255.255.255.192 NETWORK=10.72.11.128 HWADDR=84:2B:2B:55:4B:98 IPV6INIT=yes IPV6_AUTOCONF=yes ONBOOT=yes
接口正在启动,并根据需要进行configuration。
[root@sql1 network-scripts]# ifconfig **eth0** Link encap:Ethernet HWaddr 84:2B:2B:55:4B:97 inet addr:192.168.1.105 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::862b:2bff:fe55:4b97/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2981 errors:0 dropped:0 overruns:0 frame:0 TX packets:319 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:386809 (377.7 KiB) TX bytes:66134 (64.5 KiB) Interrupt:36 Memory:da000000-da012800 **eth1** Link encap:Ethernet HWaddr 84:2B:2B:55:4B:98 inet addr:10.72.11.236 Bcast:10.72.11.191 Mask:255.255.255.192 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) Interrupt:48 Memory:dc000000-dc012800
我还添加了一个route-eth1文件,如下所示:
10.0.0.0/8 via 10.72.11.254
路由看起来很好,我:
[root@sql1 network-scripts]# netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 10.72.11.192 0.0.0.0 255.255.255.192 U 0 0 0 eth1 192.168.1.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 10.0.0.0 10.72.11.254 255.0.0.0 UG 0 0 0 eth1 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
但是我不能从另一台服务器上ping一台服务器。
[root@sql1 network-scripts]# ping 10.72.11.235 PING 10.72.11.235 (10.72.11.235) 56(84) bytes of data. From 10.72.11.236 icmp_seq=1 Destination Host Unreachable From 10.72.11.236 icmp_seq=2 Destination Host Unreachable From 10.72.11.236 icmp_seq=3 Destination Host Unreachable From 10.72.11.236 icmp_seq=4 Destination Host Unreachable From 10.72.11.236 icmp_seq=5 Destination Host Unreachable From 10.72.11.236 icmp_seq=6 Destination Host Unreachable ^C --- 10.72.11.235 ping statistics --- 7 packets transmitted, 0 received, +6 errors, 100% packet loss, time 6033ms, pipe 3
我究竟做错了什么?
应该注意的是,你的网卡不能正常工作。 你的ifconfig输出不会显示出正确工作的链接所需的“RUNNING”。 注意从您的eth0接口UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 。 eth1的输出没有“跑”。 根据我的经验,这表明一个低级别的问题。 例如:错误/断开电缆。
你插入电缆的网卡是不是eth1? 服务器可以得到一些奇怪的命名。 尝试检查/ var / log / messages的输出,以查看是否报告正在连接(dis)的接口。 同样,请参阅在连接/断开连接时或启动过程中是否有任何诊断信息。 检查所有5个盒子是否发生这种情况。 你可能也想尝试一下graphics化configuration工具,以防万一你在configuration文件中出现拼写错误。 ( system-config-network )
想想你的子网设置:
IPADDR=10.72.11.236 BROADCAST=10.72.11.191 NETMASK=255.255.255.192 NETWORK=10.72.11.128
在基地2:
236 is 1110 1100 191 is 1011 1111 192 is 1100 0000 128 is 1000 0000
您的IP在您的子网之外 – 10.72.11.236不在10.72.11.128/26,10.72.11.172是。 17.72.11.235和10.72.11.171都不是。 请更改您的IP或将广播更改为.255,将您的networking更改为.192。 或者(除非是由你来决定),运行在10.72.11.0(即10.72.11.0/26)的下半部分,或者只是使用/ 24并且省去麻烦。
尝试从http://jodies.de/ipcalc使用ipcalc,这对configurationnetworking和子networking是一个很大的帮助。
# ipcalc 10.72.11.236/255.255.255.192 Address: 10.72.11.236 00001010.01001000.00001011.11 101100 Netmask: 255.255.255.192 = 26 11111111.11111111.11111111.11 000000 Wildcard: 0.0.0.63 00000000.00000000.00000000.00 111111 => Network: 10.72.11.192/26 00001010.01001000.00001011.11 000000 HostMin: 10.72.11.193 00001010.01001000.00001011.11 000001 HostMax: 10.72.11.254 00001010.01001000.00001011.11 111110 Broadcast: 10.72.11.255 00001010.01001000.00001011.11 111111 Hosts/Net: 62 Class A, Private Internet
理查德
我以前见过这个问题。 不是100%肯定的修复,但我记得有一些在sysctl告诉ARP考虑这些不同的设备 – 或沿着这些线路。
如果我没有记错的话,在serverfault上有几篇文章。
进入eth0的入站stream量应该通过eth0返回,反之亦然。 尝试做一个TCP转储来检查stream量的去向。
您还需要基于策略的路由来执行此操作:请参阅Linux 2网卡路由,具体取决于所使用的接口