标签:广域网
还记得大学时,老师说“童鞋们,不同网段的IP是无法互通的,要记住哦”
其实,老师没说全。。。
今天本宝宝带大家回顾一下广域网协议,PPP、HDLC、PPP
因个人崇尚实验出真知,用实验总结理论
拓扑:(因HCL无法模拟FR-SW,又不想用LITO,加上好久没敲cisco了,所以用GNS3)
PPP
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int s0/0
R1(config-if)#encapsulation ppp
R1(config-if)#ip add 12.12.12.1 255.255.255.0
R1(config-if)#no shut
========================================
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#int s0/0
R2(config-if)#ip add 21.21.21.2 255.255.255.0
R2(config-if)#en
R2(config-if)#encapsulation ppp
R2(config-if)#no shut
R2(config-if)#do ping 12.12.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.12.12.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/25/36 ms
#不同网段通了,我们来看看为什么
R2(config-if)#do show ip rou
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
21.0.0.0/24 is subnetted, 1 subnets
C 21.21.21.0 is directly connected, Serial0/0
12.0.0.0/32 is subnetted, 1 subnets
C 12.12.12.1 is directly connected, Serial0/0
#现象一:
#自动生成了一条对端网络的主机路由
#为什么自动生成路由呢? PPP子协议NCP
2.HDLC
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int s0/0
R1(config-if)#en
R1(config-if)#ip add 12.12.12.1 255.255.255.0
R1(config-if)#no shut
=============================================
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#int s0/0
R2(config-if)#ip add 21.21.21.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)# do ping 12.12.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.12.12.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
#不通了,我们试试如PPP一样写主机路由试试
R1(config)#ip route 21.21.21.2 255.255.255.255 s0/0
R2(config)#ip route 12.12.12.1 255.255.255.255 s0/0
R2(config)# do ping 12.12.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.12.12.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/25/32 ms
#o了,可以总结出,PPP可以通,HDLC不可以通,因为NCP自协商路由的源故
3.FR
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int s0/0
R1(config-if)#ip add 13.13.13.1 255.255.255.0
R1(config-if)#en
R1(config-if)#encapsulation fr
R1(config-if)#encapsulation frame-relay
R1(config-if)#no shut
===================================
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#frame-relay switching
R2(config)#int s0/0
R2(config-if)#encapsulation frame-relay
R2(config-if)#frame-relay intf-type dce
R2(config-if)#frame-relay route 102 interface s0/1 201
R2(config-if)#no shut
R2(config)#int s0/1
R2(config-if)#encapsulation frame-relay
R2(config-if)#frame-relay intf-type dce
R2(config-if)#frame-relay route 201 interface s0/0 102
R2(config-if)#no shut
===================================
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#int s0/1
R3(config-if)#encapsulation frame-relay
R3(config-if)#ip add 31.31.31.3 255.255.255.0
R3(config-if)#no shut
R3(config-if)#do ping 13.13.13.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 13.13.13.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/40/44 ms
#默认情况下是可以通的,为什么呢?
R1(config-if)#do show frame-relay map
Serial0/0 (up): ip 31.31.31.3 dlci 102(0x66,0x1860), dynamic,
broadcast,
CISCO, status defined, active
#因为根据标签转发,下面让其不通
R1(config)#int s0/0
R1(config-if)#no frame-relay inverse-arp
R3(config)#int s0/1
R3(config-if)#no frame-relay inverse-arp
R3(config-if)#exit
R3(config)#exit
R3#clear frame-relay inarp
R3#ping 13.13.13.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 13.13.13.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
#其不通原因在于inverse-arp,我们尝试着不开启inverse-arp让其通
R1(config)#int s0/0
R1(config-if)#frame-relay intf-dlci 102
R3(config)#int s0/1
R3(config-if)#frame-relay intf-dlci 201
R3(config-if)#do ping 13.13.13.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 13.13.13.1, timeout is 2 seconds:
!!!!!
4.Ethernet
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int f0/0
R1(config-if)#no shutR1(config-if)#ip add 12.12.12.1 255.255.255.0
==============================================
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#int f0/0
R2(config-if)#no shut
R2(config-if)#ip add 21.21.21.2 255.255.255.0R2(config-if)#do ping 12.12.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.12.12.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
#默认肯定不通的,我们尝试写路由试试
R1(config)#ip route 21.21.21.2 255.255.255.255 f0/0
R2(config)#ip route 12.12.12.1 255.255.255.255 f0/0
R2(config)#do ping 12.12.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.12.12.1, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 20/29/44 ms
#写路由可以互通
5.总结
不同网段互通的前提在于ARP,对于HDLC和Ethernet写路由是让其学习MAC,如果手工写静态MAC也可互通
对于帧中继,默认根据DLCI转发,通过inverse-arp学习
本文出自 “抚琴煮酒” 博客,请务必保留此出处http://szk5043.blog.51cto.com/8456440/1813867
标签:广域网
原文地址:http://szk5043.blog.51cto.com/8456440/1813867