帧中继( Frame Relay)是一种用于连接计算机系统的面向分组的通信方法。它主要用在公共或专用网上的局域网互联以及广域网连接。大多数公共电信局都提供帧中继服务,把它作为建立高性能的虚拟广域连接的一种途径。

1.实验器材

3台思科路由器   3台帧中继交换机(路由器代替)

2.实验拓扑图

103548364.png

 

fr-1配置
Router>enable 
Router#configure terminal 
Router(config)#line console 0
Router(config-line)#logging synchronous 
Router(config-line)#no exec-timeout 
Router(config-line)#exit 
Router(config)#frame-relay switching               //开启帧中继功能
Router(config)#int s0/0
Router(config-if)#encapsulation frame-relay    //封装帧中继
Router(config-if)#frame-relay intf-type dce       //运营商端口为dce
Router(config-if)#clock rate 64000                       //时钟频率
Router(config-if)#frame-relay lmi-type cisco             // 信道名称
Router(config-if)#frame-relay route 100 interface s0/1 101       //设置帧中继出口及进口的dlci值
Router(config-if)#frame-relay route 200 interface s0/2 201
Router(config-if)#no shutdown                                     //开启端口
Router(config-if)#^Z
Router#
Router#configure terminal 
Router(config)#hostname fr-1
fr-1(config)#int s0/1
fr-1(config-if)#no shutdown 
fr-1(config-if)#encapsulation frame-relay                  //封装帧中继
fr-1(config-if)#frame-relay intf-type dce               //端口为dce类型
fr-1(config-if)#clock rate 64000                            //时钟频率
fr-1(config-if)#frame-relay lmi-type cisco              
fr-1(config-if)#frame-relay route 101 interface s0/0 100
fr-1(config-if)#^Z
fr-1#
fr-1#configure terminal 
fr-1(config)#int s0/2
fr-1(config-if)#no shutdown 
fr-1(config-if)#encapsulation frame-relay 
fr-1(config-if)#frame-relay lmi-type cisco 
fr-1(config-if)#frame-relay intf-type dce 
fr-1(config-if)#clock rate 64000
fr-1(config-if)#frame-relay route 201 interface s0/0 200
fr-1(config-if)#^Z
fr-1#
fr-2配置
Router>enable 
Router#configure terminal 
Router(config)#line console 0
Router(config-line)#logging synchronous 
Router(config-line)#no exec-timeout 
Router(config-line)#exit 
Router(config)#frame-relay switching 
Router(config)#int s0/0  
Router(config-if) no shutdown
Router(config-if)#encapsulation frame-relay               
Router(config-if)#frame-relay intf-type dce
Router(config-if)#clock rate 64000
Router(config-if)#frame-relay lmi-type cisco 
Router(config-if)#frame-relay route 102 interface s0/1 101
Router(config-if)#int s0/1
Router(config-if)#no shutdown 
Router(config-if)#encapsulation frame-relay 
Router(config-if)#frame-relay intf-type dte 
Router(config-if)#frame-relay lmi-type cisco 
Router(config-if)#frame-relay route 101 interface s0/0 102
fr-3配置
Router>enable 
Router#configure terminal 
Router(config)#hostname fr-3
fr-3(config)#line console 0
fr-3(config-line)#logging synchronous 
fr-3(config-line)#no exec-timeout 
fr-3(config-line)#exit 
fr-3(config)#frame-relay switching 
fr-3(config)#int s0/0
fr-3(config-if)#no shutdown 
fr-3(config-if)#encapsulation frame-relay 
fr-3(config-if)#frame-relay lmi-type cisco 
fr-3(config-if)#frame-relay intf-type dce 
fr-3(config-if)#clock rate 64000
fr-3(config-if)#frame-relay route 202 interface s0/2 201
fr-3(config-if)#int s0/2
fr-3(config-if)#no shutdown 
fr-3(config-if)#encapsulation frame-relay 
fr-3(config-if)#frame-relay lmi-type cisco 
fr-3(config-if)#frame-relay intf-type dte 
fr-3(config-if)#frame-relay route 201 interface s0/0 202
r1的配置
Router>enable 
Router#configure terminal 
Router(config)#line console 0
Router(config-line)#logging synchronous 
Router(config-line)#no exec-timeout 
Router(config-line)#exit 
Router(config)#hostname r1
r1(config)#int f0/0                    //进入端口
r1(config-if)#ip add 192.168.1.1 255.255.255.0          //配置ip地址
r1(config-if)#no shutdown 
r1(config-if)#int s1/0
r1(config-if)#ip add 192.168.4.1 255.255.255.0 
r1(config-if)#ip add 192.168.5.1 255.255.255.0 secondary                //第二个ip地址
r1(config-if)#no shutdown 
r1(config-if)#encapsulation frame-relay                        //封装帧中继
r1(config-if)#frame-relay lmi-type cisco                    //信道名称
r1(config-if)#frame-relay map ip 192.168.4.2 100                  //映射下一跳地址 及dlci值
r1(config-if)#frame-relay map ip 192.168.5.2 200
r1(config)#ip route 192.168.2.0 255.255.255.0 192.168.4.2              //配置静态路由
r1(config)#ip route 192.168.3.0 255.255.255.0 192.168.5.2
r1(config)#^Z
r1#
查看配置的命令
r1#show running-config                              //查看主要配置
...............................
interface FastEthernet0/0
 ip address 192.168.1.1 255.255.255.0
 duplex auto
 speed auto
!
interface Serial1/0
 ip address 192.168.5.1 255.255.255.0 secondary
 ip address 192.168.4.1 255.255.255.0
 encapsulation frame-relay
 serial restart-delay 0
 frame-relay map ip 192.168.4.2 100
 frame-relay map ip 192.168.5.2 200
 frame-relay lmi-type cisco
ip classless
ip route 192.168.2.0 255.255.255.0 192.168.4.2
ip route 192.168.3.0 255.255.255.0 192.168.5.2
r1#
.........................................................
查看映射关系
r1#show frame-relay map 
Serial1/0 (up): ip 192.168.4.2 dlci 100(0x64,0x1840), static,
              CISCO, status defined, active
Serial1/0 (up): ip 192.168.5.2 dlci 200(0xC8,0x3080), static,
              CISCO, status defined, active

r2的配置
Router>enable 
Router#configure terminal 
Router(config)#line console 0
Router(config-line)#logging synchronous 
Router(config-line)#no exec-timeout 
Router(config-line)#exit 
Router(config)#hostname r2
r2(config)#int f0/0
r2(config-if)#ip add 192.168.2.1 255.255.255.0
r2(config-if)#no shutdown 
r2(config-if)#int s1/0
r2(config-if)#ip add 192.168.4.2 255.255.255.0
r2(config-if)#no shutdown 
r2(config-if)#encapsulation frame-relay 
r2(config-if)#frame-relay lmi-type cisco 
r2(config-if)#frame-relay map  ip 192.168.4.1 102    静态映射(启用动态映射也可以frame-relay inverse-arp)
r2(config-if)#exit 
r2(config)#ip route 0.0.0.0 0.0.0.0 192.168.4.1
测试ping命令
r2#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
....
00:51:32: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up.
Success rate is 0 percent (0/5)
查看主要配置
.....................................
r2#show running-config 
interface FastEthernet0/0
 ip address 192.168.2.1 255.255.255.0
 duplex auto
 speed auto
!
interface Serial1/0
 ip address 192.168.4.2 255.255.255.0
 encapsulation frame-relay
 serial restart-delay 0
 frame-relay map ip 192.168.4.1 102
 frame-relay lmi-type cisco
ip classless
ip route 0.0.0.0 0.0.0.0 192.168.4.1
查看映射关系
r2#show frame-relay map 
Serial1/0 (up): ip 192.168.4.1 dlci 102(0x66,0x1860), static,
              CISCO, status defined, active

r3的配置
Router>enable 
Router#conf terminal 
Router(config)#hostname r3
r3(config)#line console 0
r3(config-line)#logging synchronous 
r3(config-line)#no exec-timeout 
r3(config-line)#exit 
r3(config)#int f0/0
r3(config-if)#ip add 192.168.3.1 255.255.255.0
r3(config-if)#no shutdown 
r3(config-if)#int s1/0
r3(config-if)#ip add 192.168.5.2 255.255.255.0
r3(config-if)#no shutdown 
r3(config-if)#encapsulation frame-relay 
r3(config-if)#frame-relay lmi-type cisco 
r3(config-if)#frame-relay map ip 192.168.5.1 202  本地映射下一跳地址 本地dlci
r3(config)#ip route 0.0.0.0 0.0.0.0 192.168.5.1
r3(config)#^Z
测试ping命令
r3#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/24/44 ms
r3#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/64/96 ms
查看映射关系
r3#show frame-relay map 
Serial1/0 (up): ip 192.168.4.1 dlci 202(0xCA,0x30A0), dynamic,
              broadcast,, status defined, active
Serial1/0 (up): ip 192.168.5.1 dlci 202(0xCA,0x30A0), static,
              CISCO, status defined, active
也可以通过show frame-relay pvc查看管道信息
至此配置就完成了

3.路由器上配置的静态路由也可以换成动态路由
配置如下:
r1的配置
Router(config)#int s1/0
Router(config-if)#no frame-relay map ip 192.168.4.2 100             //删除原来的映射
Router(config-if)#no frame-relay map ip 192.168.5.2 200
Router(config-if)#frame-relay inverse-arp                                               //启用动态映射
Router(config-if)#no ip address 
Router(config)#int s1/0.1 point-to-point                                                  //拆分端口  点对点
Router(config-subif)#ip add 192.168.4.1 255.255.255.0  
Router(config-subif)#frame-relay interface-dlci 100                                  //设置dlci值
Router(config)#int s1/0.2 point-to-point 
Router(config-subif)#ip add 192.168.5.1 255.255.255.0
Router(config-subif)#frame-relay interface-dlci 200
Router(config-fr-dlci)#^Z
Router#
Router(config)#router ospf 10                                                                      //动态路由ospf
Router(config-router)#network 192.168.1.0 0.0.0.255 area 0                                    //宣告网络
Router(config-router)#network 192.168.4.0 0.0.0.255 area 0
Router(config-router)#network 192.168.5.0 0.0.0.255 area 0
Router#show ip ospf neighbor                                                               //查看ospf的邻居信息
Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.5.2       1   FULL/  -        00:00:38    192.168.5.2     Serial1/0.2
192.168.4.2       1   FULL/  -        00:00:31    192.168.4.2     Serial1/0.1
Router#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 92/127/200 ms
Router#ping 192.168.3.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:
!!!!!

Router#show ip route                                   //查看路由表
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.4.0/24 is directly connected, Serial1/0.1
C    192.168.5.0/24 is directly connected, Serial1/0.2
C    192.168.1.0/24 is directly connected, FastEthernet0/0
O    192.168.2.0/24 [110/65] via 192.168.4.2, 00:20:20, Serial1/0.1
O    192.168.3.0/24 [110/65] via 192.168.5.2, 00:20:20, Serial1/0.2
( 路由器r1的主要配置
         show  run
interface FastEthernet0/0
 ip address 192.168.1.1 255.255.255.0
 duplex auto
 speed auto
!
interface Serial1/0
 no ip address
 encapsulation frame-relay
 serial restart-delay 0
 frame-relay lmi-type cisco
!         
interface Serial1/0.1 point-to-point
 ip address 192.168.4.1 255.255.255.0
 frame-relay interface-dlci 100   
!         
interface Serial1/0.2 point-to-point
 ip address 192.168.5.1 255.255.255.0
 frame-relay interface-dlci 200 
router ospf 10
 log-adjacency-changes
 network 192.168.1.0 0.0.0.255 area 0
 network 192.168.4.0 0.0.0.255 area 0
 network 192.168.5.0 0.0.0.255 area 0  
r2配置
Router(config)#int s1/0   
Router(config-if)#no frame-relay map ip 192.168.4.1 102               //删除原来的映射
Router(config-if)#frame-relay  inverse-arp                                //启用动态映射
Router(config-if)#no ip address 
Router(config-if)#exit
Router(config)#int s1/0.1 point-to-point 
Router(config-subif)#ip add 192.168.4.2 255.255.255.0 
Router(config-subif)#frame-relay interface-dlci 102
Router(config-fr-dlci)#^Z
Router#conf t                
Router(config)#router ospf 10                         
Router(config-router)#network 192.168.4.0 0.0.0.255 area 0 
Router(config-router)#network 192.168.2.0 0.0.0.255 area 0 

Router#show ip ospf neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.4.1       1   EXSTART/  -     00:00:39    192.168.4.1     Serial1/0.1
Router#ping 192.168.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 80/94/112 ms

Router#ping 192.168.3.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/54/84 ms

Router#show ip route 
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.4.0/24 is directly connected, Serial1/0.1
O    192.168.5.0/24 [110/128] via 192.168.4.1, 00:19:41, Serial1/0.1
O    192.168.1.0/24 [110/65] via 192.168.4.1, 00:19:41, Serial1/0.1
C    192.168.2.0/24 is directly connected, FastEthernet0/0
O    192.168.3.0/24 [110/129] via 192.168.4.1, 00:19:41, Serial1/0.1
(r2的主要配置
interface FastEthernet0/0
 ip address 192.168.2.1 255.255.255.0
 duplex auto
 speed auto
!
interface Serial1/0
 no ip address
 encapsulation frame-relay
 serial restart-delay 0
 frame-relay lmi-type cisco
!         
interface Serial1/0.1 point-to-point
 ip address 192.168.4.2 255.255.255.0
 frame-relay interface-dlci 102   

router ospf 10
 log-adjacency-changes
 network 192.168.2.0 0.0.0.255 area 0
 network 192.168.4.0 0.0.0.255 area 0

r3配置
Router(config)#int s1/0
Router(config-if)#no frame-relay map ip 192.168.5.1 202
Router(config-if)#frame-relay inverse-arp 
Router(config-if)#no ip address 
Router(config-if)#exit
Router(config)#int s1/0.1 point-to-point 
Router(config-subif)#ip add 192.168.5.2 255.255.255.0
Router(config-subif)#frame-relay interface-dlci 202
Router(config-fr-dlci)#^Z
Router#conf t
Router(config)#router os
Router(config)#router ospf 10
Router(config-router)#network 192.168.3.0 0.0.0.255
Router(config-router)#network 192.168.3.0 0.0.0.255 area 0
Router(config-router)#network 192.168.5.0 0.0.0.255 area 0
Router(config-router)#^Z
Router#show ip ospf neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.4.1       1   FULL/  -        00:00:39    192.168.5.1     Serial1/0.1
Router#ping 192.168.1.1                                              //测试连通性
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 72/97/124 ms
Router#ping 192.168.2.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!

Router#show ip route 
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

O    192.168.4.0/24 [110/128] via 192.168.5.1, 00:05:37, Serial1/0.1
C    192.168.5.0/24 is directly connected, Serial1/0.1
O    192.168.1.0/24 [110/65] via 192.168.5.1, 00:05:37, Serial1/0.1
O    192.168.2.0/24 [110/129] via 192.168.5.1, 00:05:37, Serial1/0.1
C    192.168.3.0/24 is directly connected, FastEthernet0/0
Router#

(r3的主要配置
interface FastEthernet0/0
 ip address 192.168.3.1 255.255.255.0
 duplex auto
 speed auto
!
interface Serial1/0
 no ip address
 encapsulation frame-relay
 serial restart-delay 0
 frame-relay lmi-type cisco
!         
interface Serial1/0.1 point-to-point
 ip address 192.168.5.2 255.255.255.0
 frame-relay interface-dlci 202   
!         
interface Serial1/1
 no ip address
 shutdown 
 serial restart-delay 0

router ospf 10
 log-adjacency-changes
 network 192.168.3.0 0.0.0.255 area 0
 network 192.168.5.0 0.0.0.255 area 0