思科默认路由以及浮动路由_第1张图片



要求:网络互通(且每台路由都有一个虚拟接口)。每台路由上有一条浮动路由。

首先给两台PC配置同网段IP

VPCS[1]> ip 192.168.1.10 192.168.1.1

PC1 : 192.168.1.10 255.255.255.0 gateway 192.168.1.1

VPCS[1]> 2

VPCS[2]> ip 192.168.1.20 192.168.1.1

PC2 : 192.168.1.20 255.255.255.0 gateway 192.168.1.1

VPCS[2]> ping 192.168.1.10

192.168.1.10 icmp_seq=1 ttl=64 time=31.000 ms

192.168.1.10 icmp_seq=2 ttl=64 time=32.000 ms

192.168.1.10 icmp_seq=3 ttl=64 time=31.000 ms

192.168.1.10 icmp_seq=4 ttl=64 time=31.000 ms

192.168.1.10 icmp_seq=5 ttl=64 time=31.000 ms

给各个路由配IP和虚拟接口

R1

Interface                  IP-Address      OK? Method Status                      Protocol

FastEthernet0/0            192.168.1.1     YES manual up                    up  

FastEthernet0/1            12.0.0.1        YES manual up                    up  

FastEthernet1/0            13.0.0.1        YES manual up                    up  

Loopback0               1.1.1.1         YES manual up                    up  

R2

Interface                  IP-Address      OK? Method Status                Protocol

FastEthernet0/0            12.0.0.2        YES manual up                    up  

FastEthernet0/1            23.0.0.2        YES manual up                    up  

Loopback0                2.2.2.2         YES manual up                    up  

R3

Interface                  IP-Address      OK? Method Status           Pr otocol

FastEthernet0/0            23.0.0.3        YES manual up                    up  

FastEthernet0/1            unassigned      YES unset  up                    up  

Loopback0                3.3.3.3         YES manual up                    up  

给每个路由做自身所不知道的静态路由

R1

ip route 2.2.2.0 255.255.255.0 12.0.0.2

ip route 2.2.2.0 255.255.255.0 13.0.0.3

ip route 3.3.3.0 255.255.255.0 12.0.0.2

ip route 3.3.3.0 255.255.255.0 13.0.0.3

ip route 23.0.0.0 255.255.255.0 12.0.0.2

ip route 23.0.0.0 255.255.255.0 13.0.0.3

R2

ip route 1.1.1.0 255.255.255.0 12.0.0.1

ip route 1.1.1.0 255.255.255.0 23.0.0.3

ip route 3.3.3.0 255.255.255.0 12.0.0.1

ip route 3.3.3.0 255.255.255.0 23.0.0.3

ip route 13.0.0.0 255.255.255.0 12.0.0.1

ip route 13.0.0.0 255.255.255.0 23.0.0.3

#ip route 192.168.1.0 255.255.255.0 12.0.0.1

R3

ip route 1.1.1.0 255.255.255.0 13.0.0.1

ip route 1.1.1.0 255.255.255.0 23.0.0.2

ip route 2.2.2.0 255.255.255.0 13.0.0.1

ip route 2.2.2.0 255.255.255.0 23.0.0.2

ip route 12.0.0.0 255.255.255.0 13.0.0.1

ip route 12.0.0.0 255.255.255.0 23.0.0.2

ip route 192.168.1.0 255.255.255.0 13.0.0.1

到达每个目标都有了两条路可以走,设浮动路由

R1(config)#ip route 3.3.3.0 255.255.255.0 12.0.0.2 10  (都类似)

最后检验:

VPCS[2]> ping 12.0.0.2

12.0.0.2 icmp_seq=1 ttl=254 time=125.000 ms

12.0.0.2 icmp_seq=2 ttl=254 time=93.000 ms

12.0.0.2 icmp_seq=3 ttl=254 time=94.000 ms

12.0.0.2 icmp_seq=4 ttl=254 time=78.000 ms

12.0.0.2 icmp_seq=5 ttl=254 time=94.000 ms

VPCS[2]> ping 2.2.2.2

2.2.2.2 icmp_seq=1 ttl=254 time=93.000 ms

2.2.2.2 icmp_seq=2 ttl=254 time=94.000 ms

2.2.2.2 icmp_seq=3 ttl=254 time=109.000 ms

2.2.2.2 icmp_seq=4 ttl=254 time=93.000 ms

2.2.2.2 icmp_seq=5 ttl=254 time=125.000 ms

【R1和R3也可作默认路由。。因为做过浮动路由后,只有一条路生效,所以可看做是单出口】