拓扑图三路由联通模拟实验_多路由                                       

操作步骤

一:配置IP

A: ifconfig ens33 172.100.0.100/16

route add default gw 172.100.0.1

R1: ifconfig eth0 172.100.0.1/16

ifconfig eth1 14.0.0.1/8

R2:  ifconfig eth0 14.0.0.2/8

ifconfig eth1 10.0.0.1/8

R3: ifconfig eth0 10.0.0.2/8

ifconfig eth1192.168.0.1/24

B: ifconfig ens33 192.168.0.100/24

route add default gw 192.168.0.1

二:关闭所有机器的防火墙

iptables -F

三:打开R1 R2机器的路由功能

echo 1 > /proc/sys/net/ipv4/ip_forwd

四:添加路由记录

R1:route add -net 192.168.0.0/24 gw 14.0.0.2

route add -net 10.0.0.0/8 gw 14.0.0.2

R2:route add -net 172.100.0.0/16 gw 14.0.0.2

route add -net 192.168.0.1/24 gw 10.0.0.2

R3:route add -net 172.100.0.1/16 gw 10.0.0.1

route add -net 14.0.0.0/8 gw 10.0.0.1

注:ifconfig 添加的ip地址有可能会丢失,实验时后如果Aping不通B请依次pingR1 R2 R3的各个端口,查询问题所在。

AB联通的情况下

A 的路由表

三路由联通模拟实验_多路由_02

R1

三路由联通模拟实验_多路由_03

R2

三路由联通模拟实验_配置_04

R3

三路由联通模拟实验_配置_05

B

三路由联通模拟实验_配置_06


一切正常后,A可以ping通B。