PacketTracer 5.2之GRE实验(二)
原创
©著作权归作者所有:来自51CTO博客作者tom9916的原创作品,如需转载,请与作者联系,否则将追究法律责任
动态路由和GRE:(以OSPF路由为例)
Zongbu路由器配置:(命令解释见上一篇)
interface Tunnel0
ip address 1.1.1 .1 255.255.255.0
tunnel source FastEthernet0/0
tunnel destination 10.1.1 .2
interface Tunnel1
ip address 2.1.1 .1 255.255.255.0
tunnel source FastEthernet0/0
tunnel destination 20.1.1 .2
router ospf 1
network 1.1.1 .0 0.0.0.255 area 0
network 2.1.1 .0 0.0.0.255 area 0
network 192.168.3.0 0.0.0 .255 area 0
fenbu_1路由器配置:
interface Tunnel0
ip address 1.1.1 .2 255.255.255.0
tunnel source FastEthernet0/0
tunnel destination 30.1.1.2
router ospf 1
network 1.1.1 .0 0.0.0.255 area 0
network 192.168.1.0 0.0.0 .255 area 0
fenbu_2路由器配置:
interface Tunnel0
ip address 2.1.1 .2 255.255.255.0
tunnel source FastEthernet0/0
tunnel destination 30.1.1.2
router ospf 1
network 192.168.2.0 0.0.0 .255 area 0
network 2.1.1 .0 0.0.0.255 area 0
查看OSPF邻居表和路由表:
zongbu#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.1.254 0 FULL/ - 00:00:39 1.1.1 .2 Tunnel0
192.168.2.254 0 FULL/ - 00:00:38 2.1.1 .2 Tunnel1
zongbu#show ip route
Gateway of last resort is 30.1.1.1 to network 0.0.0 .0
C 1.1.1 .0 is directly connected, Tunnel0
C 2.1.1 .0 is directly connected, Tunnel1
30.0.0.0/24 is subnetted, 1 subnets
C 30.1.1.0 is directly connected, FastEthernet0/0
O 192.168.1.0/24 [110/1001] via 1.1.1 .2, 00:30:49, Tunnel0
O 192.168.2.0/24 [110/1001] via 2.1.1 .2, 00:30:49, Tunnel1
C 192.168.3.0/24 is directly connected, FastEthernet0/1
S* 0.0.0 .0/0 [1/0] via 30.1.1.1
fenbu_1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.3.254 0 FULL/ - 00:00:36 1.1.1 .1 Tunnel0
fenbu_1#show ip route
Gateway of last resort is 10.1.1 .1 to network 0.0.0.0
C 1.1.1 .0 is directly connected, Tunnel0
O 2.1.1 .0 [110/2000] via 1.1.1.1, 00:28:13, Tunnel0
C 10.1.1 .0 is directly connected, FastEthernet0/0
C 192.168.1.0/24 is directly connected, FastEthernet0/1
O 192.168.2.0/24 [110/2001] via 1.1.1 .1, 00:28:03, Tunnel0
O 192.168.3.0/24 [110/1001] via 1.1.1 .1, 00:28:13, Tunnel0
S* 0.0.0 .0/0 [1/0] via 10.1.1 .1
fenbu_2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.3.254 0 FULL/ - 00:00:38 2.1.1 .1 Tunnel0
fenbu_2#show ip route
Gateway of last resort is 20.1.1 .1 to network 0.0.0.0
O 1.1.1 .0 [110/2000] via 2.1.1.1, 00:26:12, Tunnel0
C 2.1.1 .0 is directly connected, Tunnel0
C 20.1.1 .0 is directly connected, FastEthernet0/0
O 192.168.1.0/24 [110/2001] via 2.1.1 .1, 00:26:02, Tunnel0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
O 192.168.3.0/24 [110/1001] via 2.1.1 .1, 00:26:12, Tunnel0
S* 0.0.0 .0/0 [1/0] via 20.1.1 .1
简要分析:从上面的ospf邻居表和路由表来看,所形成的路由跟用普通的几个路由器配置ospf结果大致是一样的。那么ospf的路由信息是怎样通过GRE传递过去的呢?首先,路由器发起带有本地路由器信息的协议数据包,数据从从Tunnel接口发布出去(ospf的配置中发布这个接口的IP),路由器发现要对数据进行GRE处理,于是就给这个数据包加上公网目标和原IP,然后数据就在公网中传递到目标路由器,目标路由器接受并拆封数据,发现是GRE数据,再拆分和查看私网IP数据,学习到了OSPF的路由信息,后面的过程就跟OSPF路由协议的原理是一样的,只不过是在公网传输经过了GRE处理。
GRE代替OSPF的虚链路,完成跨普通区域与主干区域连接。其原理还是一样的,在原有的IP上再封装一层IP报头(这IP报头是在所需要跨域的区域中,是有路由的。你也可以把这些区域想象成公网)。
拓扑图如下:
详细的IP配置见附件,下面只显示下GRE关键配置。
R2路由器:
interface Tunnel0
ip address 1.1.1 .2 255.255.255.0
tunnel source FastEthernet0/1
tunnel destination 10.1.23 .1
router ospf 1
network 10.1.12 .0 0.0.0.255 area 0
network 1.1.1 .0 0.0.0.255 area 0
network 10.1.23 .0 0.0.0.255 area 1
R3路由器:
interface Tunnel0
ip address 1.1.1 .1 255.255.255.0
tunnel source FastEthernet0/1
tunnel destination 10.1.23 .2
router ospf 1
log-adjacency-changes
network 10.1.34 .0 0.0.0.255 area 2
network 10.1.23 .0 0.0.0.255 area 1
network 1.1.1 .0 0.0.0.255 area 0
查看路由表,和OSPF邻居表,请各位下载附件,仔细观察,我就不重复了。
未完待续。。。。。。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章