我有一个有两个接口的RHEL服务器'foo':
eth1:inet addr:172.16.15.242 Bcast:172.16.15.247 Mask:255.255.255.248
root@foo # netstat -nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 172.16.15.240 0.0.0.0 255.255.255.248 U 0 0 0 eth1 172.16.15.64 0.0.0.0 255.255.255.224 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.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 172.16.15.94 0.0.0.0 UG 0 0 0 eth0
eth0的gw是172.16.15.94,eth1的gw是172.16.15.246
问题是,从另一个服务器,“酒吧”,我无法ping / SSH到服务器富的eth1(172.16.15.242)。
服务器栏也有两个接口:
eth1:inet addr:172.16.15.128 Bcast:172.16.15.143 Mask:255.255.255.240
root@bar # netstat -nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 172.16.15.128 0.0.0.0 255.255.255.240 U 0 0 0 eth1 172.16.15.64 0.0.0.0 255.255.255.224 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.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 172.16.15.94 0.0.0.0 UG 0 0 0 eth0 root@bar # ping 172.16.15.75 PING 172.16.15.75 (172.16.15.75) 56(84) bytes of data. 64 bytes from 172.16.15.75: icmp_seq=1 ttl=64 time=1.30 ms 64 bytes from 172.16.15.75: icmp_seq=2 ttl=64 time=0.087 ms ^C --- 172.16.15.75 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1991ms rtt min/avg/max/mdev = 0.087/0.696/1.306/0.610 ms root@bar # ping 172.16.15.242 PING 172.16.15.242 (172.16.15.242) 56(84) bytes of data.
我正在阅读有关多宿主主机,但看起来不像我在这里所需要的,因为两个接口具有相同的IP范围 – 只是不同的掩码和不同的网关。
任何想法如何解决这个问题?
通过eth0接口进行连接是可行的,因为这两台机器可以互相访问,因为这两个地址都位于networking掩码(172.16.15.64 – 172.16.15.95)定义的/27子网内。
bar直接通过eth1可以到达的IP地址范围是172.16.15.128 – 172.16.15.143。 那不包括foo的eth0地址( eth0的范围也没有)。 所以bar会使用eth0的默认路由。 我不知道你的路由器会用这个做什么。
这是我的期望基于检查子网 – 我会倾向于通过在源计算机上使用tcpdump来validation此行为,以查看正在使用哪个接口。
我看到的问题是,在第二台服务器中,eth1与第一台服务器的任何接口都不在同一个子网中。
在第二台服务器的路由表中,他所有的stream量都通过网关172.16.15.94走出去,并且不能到达不在同一个子网的接口。
看这个:
第一台服务器 – eth1
- IP:172.16.15.242 - Mask:255.255.255.248 - Gateway: 172.16.15.246
此configuration使得eth1接口位于/29 CIDR子网范围内,具有下一个ip范围:
- Minimum IP for Hosts: 172.16.15.241 - Maximum IP for Hosts: 172.16.15.246 - Broadcast: 172.16.15.247
为了从其他计算机到达这个接口,你需要在同一个子网中有一个接口,或者在路由器中有适当的静态路由规则来达到它。
您可以尝试不同的解决scheme,具体取决于您的基础架构的其余部分:
172.16.15.243和相同的网关172.16.15.246 )。 你可以得到更多关于CIDR的信息和subneting 在这里 。 这个工具可能对计算任何子网中的可用主机很有帮助。