实验一:静态路由

 

实验一:静态路由_第1张图片

 

2、实验过程

R1

r1(config)#int lo0

r1(config-if)#ip add 1.1.1.1 255.255.255.0

r1(config-if)#int s1/0

r1(config-if)#ip add 192.168.12.1 255.255.255.0

r1(config-if)#no shut

R2

r2(config)#int lo0

r2(config-if)#ip add 2.2.2.2 255.255.255.0

r2(config-if)#int s1/0

r2(config-if)#ip add 192.168.12.2 255.255.255.0

r2(config-if)#no shut

r2(config-if)#int s1/1

r2(config-if)#ip add 192.168.23.2 255.255.255.0

r2(config-if)#no shut

R3

r3(config)#int s1/1

r3(config-if)#ip add 192.168.23.3 255.255.255.0

r3(config-if)#no shut

r3(config-if)#int lo0

r3(config-if)#ip add 3.3.3.3 255.255.255.0

测试直连的连通性

r2#ping 192.168.12.1

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 8/42/104 ms

r2#ping 192.168.23.3

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 24/58/144 ms

r2#

实验要求:使得1.1.1.0/242.2.2.0/243.3.3.0/24网段之间相互通信。

r1(config)#ip route 2.2.2.0 255.255.255.0 192.168.12.2

r1(config)#ip route 3.3.3.0 255.255.255.0 192.168.12.2

r2(config)#ip route 1.1.1.0 255.255.255.0 192.168.12.1

r2(config)#ip route 3.3.3.0 255.255.255.0 192.168.23.3

这是测试:

r2#debug ip packet

r3#debug ip packet

r1#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)

r3#

*Jul 23 18:51:46.923: IP: tableid=0, s=192.168.12.1 (Serial1/1), d=3.3.3.3 (Loopback0), routed via RIB

*Jul 23 18:51:46.923: IP: s=192.168.12.1 (Serial1/1), d=3.3.3.3, len 100, rcvd 4

*Jul 23 18:51:46.927: IP: s=3.3.3.3 (local), d=192.168.12.1, len 100, unroutable

r3#

*Jul 23 18:51:48.851: IP: tableid=0, s=192.168.12.1 (Serial1/1), d=3.3.3.3 (Loopback0), routed via RIB

*Jul 23 18:51:48.851: IP: s=192.168.12.1 (Serial1/1), d=3.3.3.3, len 100, rcvd 4

*Jul 23 18:51:48.855: IP: s=3.3.3.3 (local), d=192.168.12.1, len 100, unroutable

r3#

*Jul 23 18:51:50.835: IP: tableid=0, s=192.168.12.1 (Serial1/1), d=3.3.3.3 (Loopback0), routed via RIB

*Jul 23 18:51:50.835: IP: s=192.168.12.1 (Serial1/1), d=3.3.3.3, len 100, rcvd 4

*Jul 23 18:51:50.839: IP: s=3.3.3.3 (local), d=192.168.12.1, len 100, unroutable

r3#

*Jul 23 18:51:52.851: IP: tableid=0, s=192.168.12.1 (Serial1/1), d=3.3.3.3 (Loopback0), routed via RIB

*Jul 23 18:51:52.851: IP: s=192.168.12.1 (Serial1/1), d=3.3.3.3, len 100, rcvd 4

*Jul 23 18:51:52.855: IP: s=3.3.3.3 (local), d=192.168.12.1, len 100, unroutable

r3#

*Jul 23 18:51:54.859: IP: tableid=0, s=192.168.12.1 (Serial1/1), d=3.3.3.3 (Loopback0), routed via RIB

*Jul 23 18:51:54.859: IP: s=192.168.12.1 (Serial1/1), d=3.3.3.3, len 100, rcvd 4

*Jul 23 18:51:54.859: IP: s=3.3.3.3 (local), d=192.168.12.1, len 100, unroutable

注:在R2上无任何debug信息。

R3上配置:

r3(config)#ip route 1.1.1.0 255.255.255.0 192.168.23.2

r3(config)#ip route 192.168.12.0 255.255.255.0 192.168.23.2

r1#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 100 percent (5/5), round-trip min/avg/max = 12/56/132 ms

r1#ping 192.168.23.3

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds:

.....

Success rate is 0 percent (0/5)

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 = 8/44/112 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 100 percent (5/5), round-trip min/avg/max = 16/99/384 ms

 

实验默认路由
1、在R1、R3上删除静态路由
r1(config)#no ip route 2.2.2.0 255.255.255.0 192.168.12.2
r1(config)#no ip route 3.3.3.0 255.255.255.0 192.168.12.2
r1#sh 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, Serial1/0
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
r3(config)#no ip route 1.1.1.0 255.255.255.0 192.168.23.2
r3(config)#no ip route 192.168.12.0 255.255.255.0 192.168.23.2
r3(config)#do sh 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
 
     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Loopback0
C    192.168.23.0/24 is directly connected, Serial1/1
配置默认路由
r1(config)#ip route 0.0.0.0 0.0.0.0 192.168.12.2
r1#sh 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, Serial1/0
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
S*    0.0.0.0/0 [1/0] via 192.168.12.2
 
r3(config)#ip route 0.0.0.0 0.0.0.0 192.168.23.2
r3#sh 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.23.2 to network 0.0.0.0
 
     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Loopback0
C    192.168.23.0/24 is directly connected, Serial1/1
S*    0.0.0.0/0 [1/0] via 192.168.23.2
实验调试:
r1#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 100 percent (5/5), round-trip min/avg/max = 8/54/152 ms
r1#
r3#ping 2.2.2.2
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/42/92 ms
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/32/68 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 100 percent (5/5), round-trip min/avg/max = 8/41/124 ms

你可能感兴趣的:(职场,休闲,路由和交换)