Router(config)#hostname R3 R3(config)#no ip domain-lookup R3(config)#line con 0
R3(config-line)#logging syn R3(config-line)#exec-timeout 0 R3(config)#interface s1/0 R3(config-if)#no shutdown
R3(config-if)#ip address 172.16.1.2 255.255.0.0 R2(config-if)#exit
Router(config)#interface s1/1 R2(config-if)#no shutdown
R2(config-if)#ip address 10.1.1.1 255.0.0.0
Router(config)#hostname R4 R4(config)#no ip domain-lookup R4(config)#line con 0
R4(config-line)#logging syn R4(config-line)#exec-timeout 0 R4(config)#interface s1/0 R4(config-if)#no shutdown
R4(config-if)#ip address 10.1.1.2 255.0.0.0 R4(config-if)#exit
R4(config)#interface loopback 0
R4(config-if)#ip address 3.3.3.3 255.0.0.0
通告show ip interface brief 查看所配置的接口。 2.在R1上配置静态路由。
r1(config)#ip route 172.16.0.0 255.255.0.0 192.168.1.2 r1(config)#ip route 10.0.0.0 255.0.0.0 192.168.1.2 r1(config)#ip route 3.0.0.0 255.0.0.0 192.168.1.2 3.在R2上配置静态路由。
r2(config)#ip route 1.0.0.0 255.0.0.0 192.168.1.1 r2(config)#ip route 10.0.0.0 255.0.0.0 172.168.1.2 r2(config)#ip route 3.0.0.0 255.0.0.0 172.16.1.2 4.在R3上配置静态路由。
r3(config)#ip route 192.168.1.0 255.255.255.0 172.16.1.1 r3(config)#ip route 1.0.0.0 255.0.0.0 172.16.1.1 r3(config)#ip route 3.0.0.0 255.0.0.0 10.1.1.2 5.在R4上配置静态路由。
r4(config)#ip route 1.0.0.0 255.0.0.0 10.1.1.1
r4(config)#ip route 192.168.1.0 255.255.255.0 10.1.1.1 r4(config)#ip route 172.16.0.0 255.255.0.0 10.1.1.1
可在特权模式下show ip route 查看路由表的信息。如: 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 C 1.0.0.0/8 is directly connected, Loopback0 S 3.0.0.0/8 [1/0] via 192.168.1.2
S 172.16.0.0/16 [1/0] via 192.168.1.2 (C 代表直连connected,S 代表静态路由) S 10.0.0.0/8 [1/0] via 192.168.1.2
C 192.168.1.0/24 is directly connected, Serial1/1 6.进行全网互ping。 在R1中ping 3.3.3.3 Ping 10.1.1.2 Ping 172.16.1.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 = 332/360/412 ms
四、 默认路由的配置。
10.1.1.2
Loopback 0 3.3.3.3 4 Loopback 0 1.1.1.1 1 192.168.1.1 2 S1/0 10.1.1.1 S1/1 172.16.1.1 S1/1 3 172.16.1.2 S1/1 S1/0 192.168.1.2 S1/0
实验要求;使用默认路由的配置进行全网互ping。
注:链路的来回不能同时配置默认路由,否则不能达到全网互ping 默认路由的格式为:ip route 0.0.0.0 0.0.0.0 <下一跳路由IP地址> 实验步骤:
1. 基本配置同静态路由实验的配置一致。 2. 在R1上的配置。
r1(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.2 3. 在R2上的配置。
r2(config)#ip route 0.0.0.0 0.0.0.0 172.16.1.2 r2(config)#ip route 1.0.0.0 255.0.0.0 192.168.1.1 4. 在R3上的配置。
r3(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.2
r3(config)#ip route 192.168.1.0 255.255.255.0 172.16.1.1 r3(config)#ip route 1.0.0.0 255.0.0.0 172.168.1.1 5. 在R4上的配置。
r4(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.1 6.进行全网互ping。 在R1中ping 3.3.3.3 Ping 10.1.1.2 Ping 172.16.1.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 = 332/360/412 ms r1#ping 10.1.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds: !!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 340/422/536 ms r1#ping 172.16.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.2, timeout is 2 seconds: !!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 264/296/356 ms
五、RIP的配置
10.1.1.255.0.0.0 192.168.1.1 255.255.255.0 S1/1 1 2 S1/0 172.16.1.1 255.255.0.0 S1/0 3 S1/1 172.16.1.2 255.255.0.0 S1/1 S1/0 4 192.168.1.1 255.255.255.0 10.1.1.1 255.0.0.0
实验要求:使用RIP协议进行全网互PING。
注:router rip进入RIP模式,格式network <目的网段> 实验步骤:
1、 基本信息的配置。 Router(config)#hostname R1
R1(config)#no ip domain-lookup R1(config)#line con 0
R1(config-line)#logging syn R1(config-line)#exec-timeout 0 R1(config)#interface s1/1 R1(config-if)#no shutdown
R1(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config)#hostname R2 R2(config)#no ip domain-lookup R2(config)#line con 0
R2(config-line)#logging syn R2(config-line)#exec-timeout 0 R2(config)#interface s1/0 R2(config-if)#no shutdown
R2(config-if)#ip address 192.168.1.2 255.255.255.0 R2(config-if)#exit
Router(config)#interface s1/1 R2(config-if)#no shutdown
R2(config-if)#ip address 172.16.1.1 255.255.0.0
R3(config)#line con 0
R3(config-line)#logging syn R3(config-line)#exec-timeout 0 R3(config)#interface s1/0 R3(config-if)#no shutdown
R3(config-if)#ip address 172.16.1.2 255.255.0.0 R2(config-if)#exit
Router(config)#interface s1/1 R2(config-if)#no shutdown
R2(config-if)#ip address 10.1.1.1 255.0.0.0
Router(config)#hostname R4 R4(config)#no ip domain-lookup R4(config)#line con 0
R4(config-line)#logging syn R4(config-line)#exec-timeout 0 R4(config)#interface s1/0 R4(config-if)#no shutdown
R4(config-if)#ip address 10.1.1.2 255.0.0.0 2、 在R1上配置RIP. r1(config)#router rip
r1(config-router)#network 192.168.1.0 3、 在R2上配置RIP.
r2(config)#router rip
r2(config-router)#network 192.168.1.0 r2(config-router)#network 172.16.0.0 4、 在R3上配置RIP. r3(config)#router rip
r3(config-router)#network 172.16.0.0 r3(config-router)#network 10.0.0.0 5、 在R4上配置RIP. r4(config)#router rip
r4(config-router)#network 10.0.0.0
6. 用show ip route 查看路由表,并进行全网互ping。 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 1.0.0.0/8 is directly connected, Loopback0
R 172.16.0.0/16 [120/1] via 192.168.1.2, 00:00:23, Serial1/1
R 10.0.0.0/8 [120/2] via 192.168.1.2, 00:00:23, Serial1/1 (路由表中R代表RIP) C 192.168.1.0/24 is directly connected, Serial1/1 r1#ping 10.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds: !!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 220/242/264 ms
六、 RIP v2的配置。
10.1.1.255.0.0.0 192.168.1.1 255.255.255.0 S1/1 1 2 S1/0 172.16.1.1 255.255.0.0 S1/0 3 S1/1 172.16.1.2 255.255.0.0 S1/1 S1/0 4 192.168.1.1 255.255.255.0 10.1.1.1 255.0.0.0
实验要求:用RIP v2进行全网互ping。 注:必须进入version 2.