实验9: 静态路由和默认路由
Posted 钟桂耀
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了实验9: 静态路由和默认路由相关的知识,希望对你有一定的参考价值。
静态路由和默认路由
实验目的
通过本实验,需要掌握以下技能:
1) 路由表的概念
2) IP route 命令的使用
3) 根据需求正确配置静态路由
4) 根据需求使用默认路由
拓扑结构
实现1.1.1.0/24, 2.2.2.0/24, 3.3.3.0/24网络之间能互相通信
实验步骤
n 步骤1:在各路由器上配置IP 地址、保证直连链路的连通性
R2(config)#int loopback0
R2(config-if)#ip address 2.2.2.2 255.255.255.0
R2(config)#int s1/0
R2(config-if)#ip address 12.1.1.2 255.255.255.0
R2(config-if)#no shutdown
R1(config)#int loopback0
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R1(config)#int s1/0
R1(config-if)#clock rate 64000
R1(config-if)#ip address 12.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config)#int s1/1
R1(config-if)#clock rate 64000
R1(config-if)#ip address 13.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R3(config)#int loopback0
R3(config-if)#ip address 3.3.3.3 255.255.255.0
R3(config)#int s1/1
R3(config-if)#ip address 13.1.1.3 255.255.255.0
R3(config-if)#no shutdown
n 步骤2:R2 上配置静态路由
R2(config)#ip route 1.1.1.0 255.255.255.0 s1/0
// 下一跳为接口形式,s1/0是点到点的链路,注意应该是R2上的s1/0
R2(config)#ip route 3.3.3.0 255.255.255.0 12.1.1.1
// 下一跳为IP地址形式,12.1.1.1是R1上的IP地址
n 步骤3:R1 上配置静态路由
R1(config)#ip route 2.2.2.0 255.255.255.0 s1/0
R1(config)#ip route 3.3.3.0 255.255.255.0 s1/1
n 步骤4:R3 上配置静态路由
R3(config)#ip route 1.1.1.0 255.255.255.0 s1/1
R3(config)#ip route 2.2.2.0 255.255.255.0 s1/1
实验调试
n 在R2,R1,R3上查看路由表
R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
S 1.1.1.0 is directly connected, Serial1/0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
3.0.0.0/24 is subnetted, 1 subnets
S 3.3.3.0 [1/0] via 12.1.1.1
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/0
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
S 2.2.2.0 is directly connected, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
S 3.3.3.0 is directly connected, Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/0
13.0.0.0/24 is subnetted, 1 subnets
C 13.1.1.0 is directly connected, Serial1/1
R3#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
S 1.1.1.0 is directly connected, Serial1/1
2.0.0.0/24 is subnetted, 1 subnets
S 2.2.2.0 is directly connected, Serial1/1
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
13.0.0.0/24 is subnetted, 1 subnets
C 13.1.1.0 is directly connected, Serial1/1
n 在各路由器上ping其它路由器的环回口
R2#ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/20/60 ms
R2#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R2#ping 3.3.3.3 source 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
Packet sent with a source address of 2.2.2.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/44/92 ms
【实验结论】
1) 各路由器上ping loopback地址所在的直连网段都能通
2) R1上ping 2.2.2.2和3.3.3.3都能通
3) R2上ping 3.3.3.3和R3上ping 2.2.2.2是不通的,但R2上ping 3.3.3.3 source 2.2.2.2和R3上ping 2.2.2.2 source 3.3.3.3能通
【提示】
用ping测试不设置源IP地址,默认以接口地址为源地址,查看R3的路由表,没有到目标网段12.1.1.0的路由条目,故R3无法响应R2的报文
【解决方法】
R3(config)#ip route 12.1.1.0 255.255.255.0 s1/1
R3(config)#ip route 0.0.0.0 0.0.0.0 s1/1
以上是关于实验9: 静态路由和默认路由的主要内容,如果未能解决你的问题,请参考以下文章