一:
环境:两台路由器,由串口相联。
要求:如下图所示,设置R1以太口的secondary地址为10.1.1.2-10.1.1.4,将10.1.1.2和10.1.1.3这两个辅助地址做动态NAT转换,地址池范围:80.1.1.2-80.1.1.9;将辅助地址10.1.1.4静态转换成80.1.1.10,将以太口的主IP地址作PAT转换。
步骤一、基本配置
R1的配置:
R1(config)#interface e0
R1(config-if)#ip address 10.1.1.1 255.255.255.0
R1(config-if)#ip address 10.1.1.2 255.255.255.0 secondary 设置辅助IP
R1(config-if)#ip address 10.1.1.3 255.255.255.0 secondary
R1(config-if)#ip address 10.1.1.4 255.255.255.0 secondary
R1(config-if)#no keepalive 关闭检测
R1(config-if)#no shutdown
R1(config-if)#interface s0
R1(config-if)#ip address 30.1.1.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shutdown
R2的配置:
R2(config)#interface loopback 0
R2(config-if)#ip address 20.1.1.1 255.255.255.0
R2(config-if)#interface s1
R2(config-if)#ip address 30.1.1.2 255.255.255.0
R2(config-if)#no shutdown
配置路由:
R2(config)#ip route 80.1.1.0 255.255.255.240 serial 1
R1(config)#ip route 0.0.0.0 0.0.0.0 serial 0
步骤二、NAT与PAT的创建
NAT的配置:
R1(config)#access-list 10 permit host 10.1.1.2 定义转换列表
R1(config)#access-list 10 permit host 10.1.1.3
R1(config)#ip nat pool ippool 80.1.1.2 80.1.1.9 prefix-length 28 定义地址池
R1(config)#ip nat inside source list 10 pool ippool 将池和列表关联
PAT的配置:
R1(config)#access-list 11 permit host 10.1.1.1 PAT转换列表
R1(config)#ip nat inside source list 11 interface serial 0 overload 与接口映射
静态NAT的配置:
R1(config)#ip nat inside source static 10.1.1.4 80.1.1.10
R1(config)#interface e0
R1(config-if)#ip nat inside 加载到接口
R1(config-if)#interface s0
R1(config-if)#ip nat outside 加载到接口
步骤三、测试
R1#ping
Protocol [ip]:
Target IP address:20.1.1.1
Extended commands [n]: y
Source address or interface: 10.1.1.1
!!!!!
R1#ping
Protocol [ip]:
Target IP address: 20.1.1.1
Extended commands [n]: y
Source address or interface: 10.1.1.2
!!!!!
R1#ping
Protocol [ip]:
Target IP address:20.1.1.1
Extended commands [n]: y
Source address or interface: 10.1.1.3
!!!!!
R1#show ip nat translation 查看转换列表
Pro Inside global Inside local Outside local Outside global
--- 80.1.1.10 10.1.1.4 --- ---
--- 80.1.1.2 10.1.1.2 --- ---
--- 80.1.1.3 10.1.1.3 --- ---
icmp 30.1.1.1:2832 10.1.1.1:2832 20.1.1.1:2832 20.1.1.1:2832
icmp 30.1.1.1:2833 10.1.1.1:2833 20.1.1.1:2833 20.1.1.1:2833
icmp 30.1.1.1:2834 10.1.1.1:2834 20.1.1.1:2834 20.1.1.1:2834
icmp 30.1.1.1:2835 10.1.1.1:2835 20.1.1.1:2835 20.1.1.1:2835
icmp 30.1.1.1:2836 10.1.1.1:2836 20.1.1.1:2836 20.1.1.1:2836
步骤四、显示当前配置
R1的当前配置:
R1#show running-config
hostname R1
!
no ip domain-lookup
!
interface Ethernet0
ip address 10.1.1.2 255.255.255.0 secondary
ip address 10.1.1.3 255.255.255.0 secondary
ip address 10.1.1.4 255.255.255.0 secondary
ip address 10.1.1.1 255.255.255.0
ip nat inside
no keepalive
!
interface Serial0
ip address 30.1.1.1 255.255.255.0
ip nat outside
clockrate 64000
!
ip nat pool ippool 80.1.1.2 80.1.1.9 prefix-length 28
ip nat inside source list 10 pool ippool
ip nat inside source list 11 interface Serial0 overload
ip nat inside source static 10.1.1.4 80.1.1.10
ip route 0.0.0.0 0.0.0.0 Serial0
!
access-list 10 permit 10.1.1.2
access-list 10 permit 10.1.1.3
access-list 11 permit 10.1.1.1
!
line con 0
exec-timeout 0 0
logging synchronous
end
R2的当前配置:
r2#show running-config
hostname r2
no ip domain-lookup
!
interface Loopback0
ip address 20.1.1.1 255.255.255.0
!
interface Serial1
ip address 30.1.1.2 255.255.255.0
!
ip route 80.1.1.0 255.255.255.240 Serial1
line con 0
exec-timeout 0 0
logging synchronous
end
二:
环境:三台路由器通过串行接口相连。
要求:配置R2为帧中继交换机,使R1和R3运行在帧中继网络上;
在R1和R3分别启用loop0口,并且运行EIGRP路由选择协议。
步骤一、帧中继的配置
fr-sw的配置:
fr-sw(config)#frame-relay switching 启用帧中继交换机
fr-sw(config)#interface serial0
fr-sw(config-if)#clock rate 64000
fr-sw(config-if)#encapsulation frame-relay 接口封装帧中继
fr-sw(config-if)#frame-relay intf-type dce 类型DCE
fr-sw(config-if)#frame-relay route 301 interface s1 103 指定路由
fr-sw(config-if)#no shutdown
fr-sw(config-if)#interface serial1
fr-sw(config-if)#encapsulation frame-relay
fr-sw(config-if)#clock rate 64000
fr-sw(config-if)#frame-relay intf-type dce
fr-sw(config-if)#frame-relay route 103 inter s0 301
fr-sw(config-if)#no shutdown
r1的配置:
r1(config)#interface serial0
r1(config-if)#encapsulation frame-relay 接口封装帧中继
r1(config-if)#ip address 30.1.1.1 255.255.255.0
r1(config-if)# frame-relay map ip 30.1.1.3 103 broadcast 指定静态映射
r1(config-if)#no frame-relay inverse-arp 关闭逆向ARP
r1(config-if)#no shutdown
r3的配置:
r3(config)#interface s1
r3(config-if)#encapsulation frame-relay
r3(config-if)#ip add 30.1.1.3 255.255.255.0
r3(config-if)# frame-relay map ip 30.1.1.1 301 broadcast
r3(config-if)#no frame-relay inverse-arp
r3(config-if)#no shutdown
步骤二、查看帧中继的状态及联通性测试
r3的查看:
r3#show frame-relay pvc 显示永久虚电路
PVC Statistics for interface Serial1 (Frame Relay DTE)
Active Inactive Deleted Static
Local 1 0 0 0
Switched 0 0 0 0
Unused 0 0 0 0
DLCI = 301, DLCI USAGE = LOCAL, PVC STATUS = ACTIVE, INTERFACE = Serial1
r3#show interface s1 显示接口封装及状态
Serial1 is up, line protocol is up
Hardware is HD64570
Internet address is 30.1.1.3/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation FRAME-RELAY, loopback not set
r3#show frame-relay map 显示映射
Serial1 (up): ip 30.1.1.1 dlci 301(0x12D,0x48D0), static,
broadcast,, status defined, active
测试帧中继连通性:
r1#ping 30.1.1.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 30.1.1.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/60/60 ms
步骤三、启用回环口,配置EIGRP路由
r1(config)#interface loopback 0
r1(config-if)#ip address 10.1.1.1 255.255.255.0
r1(config-if)#
r1(config-if)#`router eigrp 100 启用路由协议
r1(config-router)#network 10.1.1.0 0.0.0.255 发布直联网段
r1(config-router)#network 30.1.1.0 0.0.0.255
r1(config-router)#no auto-summary 关闭自动汇总
r1(config-router)#
r3(config)#interface loopback 0
r3(config-if)#ip address 20.1.1.1 255.255.255.0
r3(config-if)#router eigrp 100
r3(config-router)#network 20.1.1.0 0.0.0.255
r3(config-router)#network 30.1.1.0 0.0.0.255
r3(config-router)#no auto-summary
r3(config-router)#
步骤四、显示学习到的路由
r1#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, 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
20.0.0.0/24 is subnetted, 1 subnets
D 20.1.1.0 [90/2297856] via 30.1.1.3, 00:00:38, Serial0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Loopback0
30.0.0.0/24 is subnetted, 1 subnets
C 30.1.1.0 is directly connected, Serial0
r3#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, 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
20.0.0.0/24 is subnetted, 1 subnets
C 20.1.1.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
D 10.1.1.0 [90/2297856] via 30.1.1.1, 00:00:00, Serial1
30.0.0.0/24 is subnetted, 1 subnets
C 30.1.1.0 is directly connected, Serial1
步骤五、显示当前配置
fr-sw的当前配置:
fr-sw#show running-config
hostname fr-sw
!
no ip domain-lookup
!
frame-relay switching
!
interface Serial0
no ip address
encapsulation frame-relay
clockrate 64000
frame-relay intf-type dce
frame-relay route 301 interface Serial1 103
!
interface Serial1
no ip address
encapsulation frame-relay
clockrate 64000
frame-relay intf-type dce
frame-relay route 103 interface Serial0 301
!
end
r1的当前配置:
r1#show running-config
!
hostname r1
!
no ip domain-lookup
!
interface Loopback0
ip address 10.1.1.1 255.255.255.0
!
interface Serial0
ip address 30.1.1.1 255.255.255.0
encapsulation frame-relay
frame-relay map ip 30.1.1.3 103 broadcast
no frame-relay inverse-arp
!
router eigrp 100
network 10.1.1.0 0.0.0.255
network 30.1.1.0 0.0.0.255
no auto-summary
end
r3的当前配置:
r3#show running-config
hostname r3
!
interface Loopback0
ip address 20.1.1.1 255.255.255.0
!
interface Serial1
ip address 30.1.1.3 255.255.255.0
encapsulation frame-relay
frame-relay map ip 30.1.1.1 301 broadcast
no frame-relay inverse-arp
!
router eigrp 100
network 20.1.1.0 0.0.0.255
network 30.1.1.0 0.0.0.255
no auto-summary
!
end
三:
环境:两台路由器,由串口相连。
要求:用两台路由器来模拟帧中继环境,fr-sw为帧中继交换机,并使用静态路由使网络联通。
步骤一:配置帧中继及联通性
fr-sw的配置:
fr-sw (config)#frame-relay switching 启用帧中继交换机
fr-sw (config)#interface loopback 0
fr-sw (config-if)#ip address 1.1.1.1 255.0.0.0
fr-sw (config-if)#interface serial 0
fr-sw (config-if)#encapsulation frame-relay 封装帧中继
fr-sw (config-if)#frame-relay intf-type dce 时钟提供端
fr-sw (config-if)#clock rate 64000
fr-sw (config-if)#ip address 10.1.1.1 255.255.255.0
fr-sw (config-if)#frame-relay map ip 10.1.1.2 102 broadcast启用静态映射,此DLCI号码同时也是分配给对端设备的DLCI。因此,要求两端的DLCI号码必须相同。
fr-sw (config-if)#frame-relay map ip 10.1.1.1 102 broadcast指向自己的目的,是为了PING通本路由器的接口。
fr-sw (config-if)#no shutdown
r2的配置
r2(config)#interface loopback 0
r2(config-if)#ip address 2.2.2.2 255.0.0.0
r2(config-if)#interface serial0
r2(config-if)#encapsulation frame-relay
r2(config-if)#ip address 10.1.1.2 255.255.255.0
r2(config-if)#frame-relay map ip 10.1.1.1 102 broadcast与对端相同。
r2(config-if)#frame-relay map ip 10.1.1.2 102 broadcast与对端相同。
r2(config-if)#no shutdown
步骤二、配置路由
fr-sw (config)#ip route 2.2.2.0 255.255.255.0 10.1.1.2
r2(config)#ip route 1.1.1.0 255.255.255.0 10.1.1.1
步骤三、测试
fr-sw #ping ip
Target IP address: 2.2.2.2
Extended commands [n]: y
Source address or interface: 1.1.1.1
!!!!!
r2#ping
Protocol [ip]:
Target IP address: 1.1.1.1
Extended commands [n]: y
Source address or interface: 2.2.2.2
!!!!!
步骤四、查看状态
fr-sw的帧中继状态
fr-sw #show frame-relay pvc 查看PVC状态
PVC Statistics for interface Serial0 (Frame Relay DCE)
Active Inactive Deleted Static
Local 1 0 0 0
Switched 0 0 0 0
Unused 0 0 0 0
DLCI = 102, DLCI USAGE = LOCAL, PVC STATUS = ACTIVE, INTERFACE = Serial0
input pkts 69 output pkts 49 in bytes 6074
out bytes 5052 dropped pkts 0 in pkts dropped 0
out pkts dropped 0 out bytes dropped 0
in FECN pkts 0 in BECN pkts 0 out FECN pkts 0
out BECN pkts 0 in DE pkts 0 out DE pkts 0
out bcast pkts 0 out bcast bytes 0
pvc create time 00:48:44, last time pvc status changed 00:47:23
fr-sw #show frame-relay map 查看帧中继映射
Serial0 (up): ip 10.1.1.1 dlci 102(0x66,0x1860), static,
broadcast,
CISCO, status defined, active
Serial0 (up): ip 10.1.1.2 dlci 102(0x66,0x1860), static,
broadcast,
CISCO, status defined, active
r2帧中继的状态:
r2#show frame-relay pvc 显示PVC状态
PVC Statistics for interface Serial0 (Frame Relay DTE)
Active Inactive Deleted Static
Local 1 0 0 0
Switched 0 0 0 0
Unused 0 0 0 0
DLCI = 102, DLCI USAGE = LOCAL, PVC STATUS = ACTIVE, INTERFACE = Serial0
input pkts 26 output pkts 35 in bytes 2660
out bytes 3137 dropped pkts 0 in pkts dropped 0
out pkts dropped 0 out bytes dropped 0
in FECN pkts 0 in BECN pkts 0 out FECN pkts 0
out BECN pkts 0 in DE pkts 0 out DE pkts 0
out bcast pkts 9 out bcast bytes 477
pvc create time 00:20:07, last time pvc status changed 00:20:07
r2#show frame-relay map 显示帧中继映射
Serial0 (up): ip 10.1.1.1 dlci 102(0x66,0x1860), static,
broadcast,
CISCO, status defined, active
Serial0 (up): ip 10.1.1.2 dlci 102(0x66,0x1860), static,
broadcast,
CISCO, status defined, active
步骤五、显示当前配置
fr-sw的当前配置:
fr-sw #show running-config
hostname fr-sw
!
frame-relay switching
!
!
!
interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface Serial0
ip address 10.1.1.1 255.255.255.0
encapsulation frame-relay
clockrate 64000
frame-relay map ip 10.1.1.1 102 broadcast
frame-relay map ip 10.1.1.2 102 broadcast
frame-relay intf-type dce
!
ip route 2.2.2.0 255.255.255.0 10.1.1.2
!
end
r2的当前配置:
r2#show running-config
hostname r2
!
!
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface Serial0
ip address 10.1.1.2 255.255.255.0
encapsulation frame-relay
frame-relay map ip 10.1.1.1 102 broadcast
frame-relay map ip 10.1.1.2 102 broadcast
!
ip route 1.1.1.0 255.255.255.0 10.1.1.1
!
end