网络拓扑图
三个网段
vmnet2:192.168.37.0/24
vmnet3:10.0.0.0/8
vmnet4:172.16.0.200/16
网卡配置
server A
eth1:
inet 192.168.37.6 netmask 255.255.255.0 broadcast 192.168.37.255
R1
eth1:
inet 192.168.37.200 netmask 255.255.255.0 broadcast 192.168.37.255
eth2:
inet 10.0.0.1 netmask 255.0.0.0 broadcast 10.255.255.255
R2
eth1:
inet 10.0.0.2 netmask 255.0.0.0 broadcast 10.255.255.255
eth2:
inet 172.16.0.200 netmask 255.255.0.0 broadcast 172.16.255.255
server B
eth1:
inet 172.16.128.0 netmask 255.255.0.0 broadcast 172.16.255.255
路由表设置
R1
[root@80_12 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 0.0.0.0 255.0.0.0 U 102 0 0 eth2
172.16.0.0 10.0.0.2 255.255.0.0 UG 0 0 0 eth2
192.168.37.0 0.0.0.0 255.255.255.0 U 101 0 0 eth1
R2
[root@80_13 ~]# route add -net 192.168.37.0/24 gw 10.0.0.1
[root@80_13 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 0.0.0.0 255.0.0.0 U 101 0 0 eth1
172.16.0.0 0.0.0.0 255.255.0.0 U 102 0 0 eth2
192.168.37.0 10.0.0.1 255.255.255.0 UG 0 0 0 eth1
R1,R2启动路由转发
echo 1 > /proc/sys/net/ipv4/ip_forward
检测
traceroute 172.16.0.7
traceroute 192.168.37.6
mtr