任务 5:配置默认路由

栏目:实验 4 配置和实施静态路由 作者:administrator 时间:2023-11-17 11:38:28

步骤 1:在 R1 上配置静态路由,确保 R1 的路由表中获得本来自己没有的路由(非直连路由) 

R1(config)#ip route 192.168.23.0 255.255.255.0 192.168.12.2 
R1(config)#ip route 192.168.24.0 255.255.255.0 192.168.12.2 
R1(config)#ip route 192.168.3.0 255.255.255.0 192.168.12.2 
R1(config)#ip route 192.168.4.0 255.255.255.0 192.168.12.2

分析这个步骤中的配置,发现配置的所有静态路由的下一跳都是 192.168.12.2,所有完全可以用一条路由 (目标地址为所有 IP)来替代步骤 1 配置的多条静态路由 

步骤 2:在 R1 上,使用 no ip routing 关闭路由功能,再用 ip routing 开启路由功能,这 样可以删除所有关于路由的配置

R1(config)#no ip routing 
R1(config)#ip routing

步骤 3:检查 R1 的路由表,确保现在确实只有直连网络路由 

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 
C 192.168.12.0/24 is directly connected, FastEthernet0/0.12 
C 192.168.1.0/24 is directly connected, Loopback0

步骤 4:在 R1 上,创建一条默认路由,下一跳是 192.168.12.2R2

R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.12.2

步骤 5:检查 R1 的路由表,会看到一条“S*”的路由,这条就是默认路由 

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 192.168.12.2 to network 0.0.0.0 
C 192.168.12.0/24 is directly connected, FastEthernet0/0.12 
C 192.168.1.0/24 is directly connected, Loopback0 
S* 0.0.0.0/0 [1/0] via 192.168.12.2

步骤 6:在 R3 R4 上也分别增加默认路由,分别以 Fa0/0.23 Fa0/0.24 为出站接口 

R3(config)#ip route 0.0.0.0 0.0.0.0 fastEthernet 0/0.23 
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 0.0.0.0 to network 0.0.0.0 
C 192.168.23.0/24 is directly connected, FastEthernet0/0.23 
C 192.168.3.0/24 is directly connected, Loopback0 
S* 0.0.0.0/0 is directly connected, FastEthernet0/0.23
R3#

R4(config)#ip route 0.0.0.0 0.0.0.0 fastEthernet 0/0.24 
R4#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 0.0.0.0 to network 0.0.0.0 
C 192.168.24.0/24 is directly connected, FastEthernet0/0.24 
C 192.168.4.0/24 is directly connected, Loopback0 
S* 0.0.0.0/0 is directly connected, FastEthernet0/0.24

步骤 7:到这一步为止,这个网络的任何两个接口之间都实现了互通,可以使用 ping 测试, 下面以 R1 Loopback0 R3 Loopback0 的测试为例: 

R1#ping 192.168.3.1 source loopback 0     //指定源目的PING模拟器不支持,可直接ping 192.168.3.1 ping 192.168.4.1
Type escape sequence to abort. 
Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds: 
Packet sent with a source address of 192.168.1.1  
!!!!! 
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/31/40 ms 
R1#
阅读:328次

我要留言

  

分类栏目