1、拓扑图如下:
2、下面进行各个路由器的基本配置:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R1
R1(config)#no ip domain-lookup
R1(config)#line console 0
R1(config-line)#logging synchronous
R1(config-line)#exec-timeout 0 0
R1(config-line)#end
R1#
R1#
00:03:47: %SYS-5-CONFIG_I: Configured from console by console
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int s1/0
R1(config-if)#encapsulation frame-relay ietf
R1(config-if)#frame-relay lmi-type ansi
R1(config-if)#no frame-relay inverse-arp
R1(config-if)#ip addr 192.168.123.1 255.255.255.0
R1(config-if)#frame-relay map ip 192.168.123.3 103 broadcast
R1(config-if)#frame-relay map ip 192.168.123.4 104 broadcast
R1(config-if)#no shut
R1(config-if)#
00:32:51: %LINK-3-UPDOWN: Interface Serial1/0, changed state to up
R1(config-if)#exit
00:33:02: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up
R1(config-if)#exit
R1(config)#int lo
R1(config)#int loopback 0
R1(config-if)#ip addr 1.1.1.1 255.255.255.0
R1(config-if)#^Z
R1#
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R2
R2(config)#no ip domain-lookup
R2(config)#line console 0
R2(config-line)#logging synchronous
R2(config-line)#exec-timeout 0 0
R2(config-line)#end
R2#
R2#
00:03:54: %SYS-5-CONFIG_I: Configured from console by console
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#frame-relay switching //让此路由器模拟成帧中继交换机
R2(config)#int s1/0
R2(config-if)#clock rate 64000
R2(config-if)#encapsulation frame-relay ietf //帧类型为ietf
R2(config-if)#frame-relay intf-type dce //帧中继端为dce端(非物理上的dce端)
R2(config-if)#frame-relay lmi-type ansi //本地管理接口设置为ansi类型
R2(config-if)#frame-relay route 103 interface s1/1 301 //从此接口出去的并且dlci呈为103的数据包从s1/1口流出并且转换为301
R2(config-if)#frame-relay route 104 interface s1/2 401
R2(config-if)#no shut
R2(config-if)#int s1/1
R2(config-if)#clock rate 64000
R2(config-if)#encapsulation frame-relay ietf
R2(config-if)#frame-relay intf-type dce
R2(config-if)#frame-relay lmi-type ansi
R2(config-if)#frame-relay route 301 interface s1/0 103
R2(config-if)#no shut
R2(config-if)#int s1/2
R2(config-if)#clock rate 64000
R2(config-if)#encapsulation frame-relay ietf
R2(config-if)#frame-relay intf-type dce
R2(config-if)#frame-relay lmi-type ansi
R2(config-if)#frame-relay route 401 interface s1/0 104
R2(config-if)#no shut
R2(config-if)#^Z
R2#
00:27:20: %SYS-5-CONFIG_I: Configured from console by console
R2#sh frame-relay route
Input Intf Input Dlci Output Intf Output Dlci Status
Serial1/0 103 Serial1/1 301 inactive //本路由器的s1/1已经配置好,而对端路由器(R3)的s1/0还没有
配置好
Serial1/0 104 Serial1/2 401 inactive
Serial1/1 301 Serial1/0 103 active
Serial1/2 401 Serial1/0 104 active //本路由器的s1/2已经配置好,而对端路由器(R1)也配置好
R2#
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R3
R3(config)#no ip domain-lookup
R3(config)#line console 0
R3(config-line)#logging synchronous
R3(config-line)#exec-timeout 0 0
R3(config-line)#end
R3#
00:04:05: %SYS-5-CONFIG_I: Configured from console by console
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#int loopback 0
R3(config-if)#ip addr 3.3.3.3 255.255.255.0
R3(config-if)#int s1/0
R3(config-if)#encapsulation frame-relay ietf
R3(config-if)#frame-relay lmi-type ansi
R3(config-if)#no frame-relay inverse-arp
R3(config-if)#ip addr 192.168.123.3 255.255.255.0
R3(config-if)#frame-relay map ip 192.168.123.1 301 broadcast
R3(config-if)#no shut
R3(config-if)#
00:41:33: %LINK-3-UPDOWN: Interface Serial1/0, changed state to up
R3(config-if)#
00:41:44: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up
R3(config-if)#^Z
R3#
Router>
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R4
R4(config)#no ip domain-lookup
R4(config)#line console 0
R4(config-line)#logging synchronous
R4(config-line)#exec-timeout 0 0
R4(config-line)#end
R4#
R4#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R4(config)#int loopback 0
R4(config-if)#ip addr 4.4.4.4 255.255.255.0
R4(config-if)#int s1/0
R4(config-if)#encapsulation frame-relay ietf
R4(config-if)#ip addr 192.168.123.4 255.255.255.0
R4(config-if)#frame-relay lmi-type ansi
R4(config-if)#no frame-relay inverse-arp
R4(config-if)#frame-relay map ip 192.168.123.1 401 broadcast
R4(config-if)#no shut
R4(config-if)#
00:44:50: %LINK-3-UPDOWN: Interface Serial1/0, changed state to up
R4(config-if)#^Z
R4#
3、接下来进行配置rip路由协议
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#router rip
R1(config-router)#network 1.1.1.0
R1(config-router)#network 192.168.123.0
R1(config-router)#^Z
R1#sh r
01:19:11: %SYS-5-CONFIG_I: Configured from console by console
R1#sh ip ro
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
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.123.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
R 3.0.0.0/8 [120/1] via 192.168.123.3, 00:00:14, Serial1/0
R 4.0.0.0/8 [120/1] via 192.168.123.4, 00:00:21, Serial1/0
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#router rip
R3(config-router)#network 3.3.3.0
R3(config-router)#net
R3(config-router)#network 192.168.123.0
R3(config-router)#^Z
R3#sh ip ro
01:20:09: %SYS-5-CONFIG_I: Configured from console by console
R3#sh ip ro
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
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.123.0/24 is directly connected, Serial1/0
R 1.0.0.0/8 [120/1] via 192.168.123.1, 00:00:27, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
R 4.0.0.0/8 [120/2] via 192.168.123.1, 00:00:27, Serial1/0
R4#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R4(config)#router rip
R4(config-router)#network 4.4.4.0
R4(config-router)#net
R4(config-router)#network 192.168.123.0
R4(config-router)#^Z
4、下面进测试
R3#ping 1.1.1.1 //R1的Lo 0接口,通,因为R1知道用哪个dlci(103)发送reply给R3
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 = 56/87/136 ms
R3#ping 4.4.4.4 //R4的Lo 0接口,不通,因为R4不知道用哪个dlci发送reply给R3,所以要在R4的s1/0上进行map
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R3#ping 192.168.123.4 //R4的s1/0接口,不通,因为R4不知道用哪个dlci发送reply给R3,所以要在R4的s1/0上进行map
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.123.4, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R3#ping 192.168.123.3 //自己s1/0接口,不通,因为它自己也不知道用哪个dlci发送reply给自己,所以要在自己的s1/0上进行map
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.123.3, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#int s1/0
R3(config-if)#fr ma ip 192.168.123.3 301 //在自己的s1/0上进行map
R3(config-if)#^Z
R3#
R4#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R4(config)#int s1/0
R4(config-if)#fr ma ip 192.168.123.3 401 //在R4的s1/0上进行map
R4(config-if)#^Z
R4#
R3#ping 4.4.4.4 //通过上面的配置,通
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/42/60 ms
R3#ping 192.168.123.4 //通过上面的配置,通
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.123.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/42/60 ms
R3#ping 192.168.123.3 //通过上面的配置,ping自己,通
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.123.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/42/60 ms
R1#sh ip int s1/0
Serial1/0 is up, line protocol is up
Internet address is 192.168.123.1/24
Broadcast address is 255.255.255.255
Address determined by setup command
MTU is 1500 bytes
Helper address is not set
Directed broadcast forwarding is disabled
Outgoing access list is not set
Inbound access list is not set
Proxy ARP is enabled
Security level is default
Split horizon is disabled //R1的s1/0接口的水平分割在此模式下默认是关闭的,打开后,R3将学不到4.0.0.0网段的路由,R4将学不
到3.0.0.0网段的路由
ICMP redirects are always sent
ICMP unreachables are always sent
ICMP mask replies are never sent
IP fast switching is enabled
IP fast switching on the same interface is enabled
IP Flow switching is disabled
IP CEF switching is disabled
IP Fast switching turbo vector
IP multicast fast switching is enabled
IP multicast distributed fast switching is disabled
IP route-cache flags are Fast
Router Discovery is disabled
IP output packet accounting is disabled
IP access violation accounting is disabled
TCP/IP header compression is disabled
RTP/IP header compression is disabled
Probe proxy name replies are disabled
Policy routing is disabled
Network address translation is disabled
WCCP Redirect outbound is disabled
WCCP Redirect inbound is disabled
WCCP Redirect exclude is disabled
BGP Policy Mapping is disabled
IP multicast multilayer switching is disabled
R1#conf t //打开R1的s1/0上的水平分割
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int s1/0
R1(config-if)#ip sp
R1(config-if)#ip split-horizon
R1(config-if)#^Z
R1#
R3#sh ip ro
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
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.123.0/24 is directly connected, Serial1/0
R 1.0.0.0/8 [120/1] via 192.168.123.1, 00:00:17, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
R 4.0.0.0/8 [120/2] via 192.168.123.1, 00:01:35, Serial1/0 //超过30s说明,R3已经不再收到R1发过来的关于此网段的更新
R3#sh ip ro
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
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.123.0/24 is directly connected, Serial1/0
R 1.0.0.0/8 [120/1] via 192.168.123.1, 00:00:26, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
R 4.0.0.0/8 is possibly down, routing via 192.168.123.1, Serial1/0 //发出down的警告