我试图让我的路由工作在3个nics和3个子网的RHEL 7上。
我有以下几点
DEVICE=eth0 BOOTPROTO=sttic ONBOOT=yes TYPE=Ethernet USERCTL=yes PEERDNS=yes IPADDR=10.241.78.5 NETMASK=255.255.254.0 IPV6INIT=no DEVICE=eth1 BOOTPROTO=static IPADDR=10.241.74.5 NETMASK=255.255.254.0 ONBOOT=yes TYPE=Ethernet USERCTL=yes PEERDNS=yes IPV6INIT=no DEVICE=eth2 BOOTPROTO=static IPADDR=10.241.76.5 NETMASK=255.255.254.0 ONBOOT=yes TYPE=Ethernet USERCTL=yes PEERDNS=yes IPV6INIT=no ip route show 10.241.74.0/23 dev eth1 proto kernel scope link src 10.241.74.5 10.241.78.0/23 dev eth0 proto kernel scope link src 10.241.78.5 10.241.76.0/23 dev eth2 proto kernel scope link src 10.241.76.5 default via 10.241.78.1 dev eth0
在eth1后面有10.241.74.7,在eth2后面有10.241.76.7
我也有以下的sysctl.conf安装
# Controls the use of TCP syncookies net.ipv4.tcp_syncookies = 1 # Disable netfilter on bridges. net.bridge.bridge-nf-call-ip6tables = 0 net.bridge.bridge-nf-call-iptables = 0 net.bridge.bridge-nf-call-arptables = 0
我遇到的问题是,eth1背后的系统无法达到eth2,反之亦然。
还有当我从.5系统启动一个ping
ping 10.241.74.7 -I eth2 PING 10.241.74.7 (10.241.74.7) from 10.241.76.5 eth2: 56(84) bytes of data. From 10.241.76.5 icmp_seq=2 Destination Host Unreachable From 10.241.76.5 icmp_seq=3 Destination Host Unreachable From 10.241.76.5 icmp_seq=4 Destination Host Unreachable ping 10.241.76.7 -I eth1 PING 10.241.76.7 (10.241.76.7) from 10.241.74.5 eth1: 56(84) bytes of data. From 10.241.74.5 icmp_seq=2 Destination Host Unreachable From 10.241.74.5 icmp_seq=3 Destination Host Unreachable From 10.241.74.5 icmp_seq=4 Destination Host Unreachable
但是,当我从eth0 ping两个networking它的作品:
ping 10.241.76.7 -I eth0 PING 10.241.76.7 (10.241.76.7) from 10.241.78.5 eth0: 56(84) bytes of data. 64 bytes from 10.241.76.7: icmp_seq=1 ttl=64 time=0.450 ms 64 bytes from 10.241.76.7: icmp_seq=2 ttl=64 time=0.483 ms ping 10.241.74.7 -I eth0 PING 10.241.74.7 (10.241.74.7) from 10.241.78.5 eth0: 56(84) bytes of data. 64 bytes from 10.241.74.7: icmp_seq=1 ttl=64 time=0.461 ms 64 bytes from 10.241.74.7: icmp_seq=2 ttl=64 time=0.399 ms
iptables已被刷新,所以我不知道为什么stream量不通过两个networking之间…可能有路由问题?
netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 10.241.74.0 0.0.0.0 255.255.254.0 U 0 0 0 eth1 10.241.78.0 0.0.0.0 255.255.254.0 U 0 0 0 eth0 10.241.76.0 0.0.0.0 255.255.254.0 U 0 0 0 eth2 0.0.0.0 10.241.78.1 0.0.0.0 UG 0 0 0 eth0
谁能帮忙?
对于Linux在接口之间转发数据包,您需要在/etc/sysctl.conf设置net.ipv4.ip_forward=1 ,然后重启系统以使更改生效或运行sysctl -p
关于你的ping结果,如果我没有记错,通过在ping命令中指定-I ethX ,你迫使数据包实际上离开指定的接口(不pipe子网configuration和该接口上的路由)。
你需要做的是尝试ping你想检查的源地址(例如,而不是ping -I eth0 10.241.74.7尝试ping -I 10.241.78.5 10.241.74.7 )。
这样数据包将离开源地址10.241.78.5但从实际configuration10.241.78.0/23子网的适当接口10.241.78.0/23 。