当前位置:   article > 正文

eNSP——vpn技术-gre与mgre_ensp路由器gre

ensp路由器gre

分析 

如图,IP地址全部给好,我们只需要按着要求进行配置命令即好

1、R5作为ISP,即公网区域,公网区域包括了R5,R5的回环接口、R1的s4/0/0接口、R2的s4/0/0接口、R3的s4/0/0接口,与R4的g0/0/1接口。R1R2R3R4后连着私网。对ISP仅进行IP地址的配置,主机PC我选择手动配置。

2、点到点网络认证的配置,hdlc的封装与ppp协议的pap认证、chap认证,用户名密码随机。

3、今天的主要学习内容GRE与MGRE,用vpn虚拟专用网技术,建立隧道,实行封装,虚拟链路连通总部与分支,分支与分支,跨域公网(但实际还是要经过公网的转发),实现虚拟链路上点到点、点到多点(实际上也是gre封装)的数据传送。

4、rip协议宣告网段,形成完整的路由表,实现全网可达.就是要注意rip带来的问题:一是gre是点到点网络封装技术,即单播,而rip机制为多播(不可改变),单播导致分支上收不到中心想要传递的信息,因为中心只能发给一个分支,解决这个矛盾的方法就是改变环境,手工开启环境的多播模式;二是rip协议具有水平分割毒性逆转的防环技术,为避免环路设置,“从此口金不从此口出规则导致,仅仅依靠tunnel链路的数据包传送只能单向,分支路由表的信息不全,是rip机制问题,所以我们只能关掉rip的水平分割机制,所以对于这个问题,我们也要从最开始的规划中尽量避免环路。

5、私网可以访问公网网址,做缺省路由和nat协议,使PC可以访问R5回环

配置思路

一、路由器IP,主机IP及回环配置
二、hdlc与ppp的封装与认证
三、实现物理链路私网公网可达,私网可访问公网,但私网之间要看后面
四、建立隧道,实现r1r2r3的mgre封装
五、建立隧道,实现r1r4之间的gre封装
六、rip宣告,在mgre上,解决两个问题

配置过程:

一、路由器

  1. [R1]int g0/0/0
  2. [R1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
  3. Jan 25 2024 12:04:24-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
  4. on the interface GigabitEthernet0/0/0 has entered the UP state.
  5. [R1-GigabitEthernet0/0/0]q
  6. [R1]int s4/0/0
  7. [R1-Serial4/0/0]ip add 15.0.0.1 24
  8. [R1-Serial4/0/0]q
  1. [R2]int g0/0/0
  2. [R2-GigabitEthernet0/0/0]ip add 192.168.2.1 24
  3. Jan 25 2024 12:07:03-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
  4. on the interface GigabitEthernet0/0/0 has entered the UP state.
  5. [R2-GigabitEthernet0/0/0]q
  6. [R2]
  7. [R2]int s4/0/0
  8. [R2-Serial4/0/0]ip add 25.0.0.1 24
  9. [R2-Serial4/0/0]q
  1. [R3]int g0/0/0
  2. [R3-GigabitEthernet0/0/0]ip add 192.168.3.1 24
  3. Jan 25 2024 12:08:24-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
  4. on the interface GigabitEthernet0/0/0 has entered the UP state.
  5. [R3-GigabitEthernet0/0/0]q
  6. [R3]
  7. [R3]int s4/0/0
  8. [R3-Serial4/0/0]ip add 35.0.0.1 24
  9. [R3-Serial4/0/0]q
  1. [R4]int g0/0/0
  2. [R4-GigabitEthernet0/0/0]ip add 192.168.4.1 24
  3. Jan 25 2024 12:10:17-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
  4. on the interface GigabitEthernet0/0/0 has entered the UP state.
  5. [R4-GigabitEthernet0/0/0]q
  6. [R4]
  7. [R4]int g0/0/1
  8. [R4-GigabitEthernet0/0/1]ip add 45.0.0.1 24
  9. Jan 25 2024 12:10:36-08:00 R4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
  10. on the interface GigabitEthernet0/0/1 has entered the UP state.
  11. [R4-GigabitEthernet0/0/1]q
  1. [ISP]int g0/0/0
  2. [ISP-GigabitEthernet0/0/0]ip add 45.0.0.2 24
  3. Jan 25 2024 12:12:25-08:00 ISP %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
  4. on the interface GigabitEthernet0/0/0 has entered the UP state.
  5. [ISP-GigabitEthernet0/0/0]q
  6. [ISP]int s3/0/0
  7. [ISP-Serial3/0/0]ip add 15.0.0.2 24
  8. [ISP-Serial3/0/0]
  9. Jan 25 2024 12:12:50-08:00 ISP %%01IFNET/4/LINK_STATE(l)[1]:The line protocol PP
  10. P IPCP on the interface Serial3/0/0 has entered the UP state.
  11. [ISP-Serial3/0/0]q
  12. [ISP]int s3/0/1
  13. [ISP-Serial3/0/1]ip add 25.0.0.2 24
  14. [ISP-Serial3/0/1]
  15. Jan 25 2024 12:13:22-08:00 ISP %%01IFNET/4/LINK_STATE(l)[2]:The line protocol PP
  16. P IPCP on the interface Serial3/0/1 has entered the UP state.
  17. [ISP-Serial3/0/1]q
  18. [ISP]int s4/0/0
  19. [ISP-Serial4/0/0]ip add 35.0.0.2 24
  20. [ISP-Serial4/0/0]
  21. Jan 25 2024 12:14:04-08:00 ISP %%01PPP/4/SAMEIP(l)[3]:On the interface Serial4/0
  22. /0, IPCP negotiation failed because the peer IP address was the same as local ad
  23. dress.
  24. [ISP-Serial4/0/0]q
  25. [ISP]
  26. [ISP]int lo0
  27. [ISP-LoopBack0]ip add 5.5.5.5 24
  28. [ISP-LoopBack0]q
  29. [ISP]

 

二、认证

用户名为huawei,密码为123456

R1和R5之间使用ppp的pap认证且R5为主认证方
  1. [ISP]aaa
  2. [ISP-aaa]local-user huawei password cipher 123456
  3. Info: Add a new user.
  4. [ISP-aaa]local-user huawei service-type ppp
  5. [ISP]interface serial3/0/0
  6. [ISP-Serial3/0/0]link-pro ppp
  7. [ISP-Serial3/0/0]ppp au
  8. [ISP-Serial3/0/0]ppp authentication-mode pap
  9. [ISP-Serial3/0/0]q
  1. [R1]interface s4/0/0
  2. [R1-Serial4/0/0]link-pro ppp
  3. [R1-Serial4/0/0]ppp pap local-user huawei password cipher 123456
  4. [R1-Serial4/0/0]shutdown
  5. Jan 25 2024 12:29:48-08:00 R1 %%01PPP/4/PHYSICALDOWN(l)[10]:On the interface Ser
  6. ial4/0/0, PPP link was closed because the status of the physical layer was Down.
  7. [R1-Serial4/0/0]undo shutdown

 查看接口状况 up证明协商成功

R1和R5之间使用ppp的chap认证且R5为主认证方
  1. [ISP]int s3/0/1
  2. [ISP-Serial3/0/1]link-pro ppp
  3. [ISP-Serial3/0/1]ppp au
  4. [ISP-Serial3/0/1]ppp authentication-mode chap
  5. [ISP-Serial3/0/1]q
  1. [R2]int s4/0/0
  2. [R2-Serial4/0/0]link-type ppp
  3. ^
  4. Error: Unrecognized command found at '^' position.
  5. [R2-Serial4/0/0]link-pro ppp
  6. [R2-Serial4/0/0]ppp chap user huawei
  7. [R2-Serial4/0/0]ppp chap password c
  8. [R2-Serial4/0/0]ppp chap password cipher 123456
  9. [R2-Serial4/0/0]
  10. [R2-Serial4/0/0]
  11. [R2-Serial4/0/0]shutdown
  12. Jan 25 2024 12:44:01-08:00 R2 %%01IFPDT/4/IF_STATE(l)[10]:Interface Serial4/0/0
  13. has turned into DOWN state.
  14. [R2-Serial4/0/0]
  15. [R2-Serial4/0/0]undo shutdown
  16. [R2-Serial4/0/0]
  17. Jan 25 2024 12:44:17-08:00 R2 %%01IFPDT/4/IF_STATE(l)[11]:Interface Serial4/0/0
  18. has turned into UP state.
  19. [R2-Serial4/0/0]q
  20. [R2]

 

 协商成功

R3和R5之间使用HDLC封装
  1. [ISP]interface Serial 4/0/0
  2. [ISP-Serial4/0/0]link-pro hdlc
  3. Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
  4. :y
  5. Jan 25 2024 12:49:39-08:00 ISP %%01IFNET/4/CHANGE_ENCAP(l)[7]:The user performed
  6. the configuration that will change the encapsulation protocol of the link and t
  7. hen selected Y.
  8. [ISP-Serial4/0/0]
  1. [R3]int s4/0/0
  2. [R3-Serial4/0/0]link-pro hdlc
  3. Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
  4. :y
  5. Jan 25 2024 12:51:21-08:00 R3 %%01IFNET/4/CHANGE_ENCAP(l)[7]:The user performed
  6. the configuration that will change the encapsulation protocol of the link and th
  7. en selected Y.
  8. [R3-Serial4/0/0]
  9. [R3-Serial4/0/0]shutdown
  10. Jan 25 2024 12:51:26-08:00 R3 %%01IFPDT/4/IF_STATE(l)[11]:Interface Serial4/0/0
  11. has turned into DOWN state.
  12. [R3-Serial4/0/0]
  13. [R3-Serial4/0/0]
  14. Jan 25 2024 12:51:26-08:00 R3 %%01IFNET/4/LINK_STATE(l)[12]:The line protocol IP
  15. on the interface Serial4/0/0 has entered the DOWN state.
  16. [R3-Serial4/0/0]
  17. [R3-Serial4/0/0]undo shutdown
  18. [R3-Serial4/0/0]
  19. Jan 25 2024 12:51:35-08:00 R3 %%01IFPDT/4/IF_STATE(l)[13]:Interface Serial4/0/0
  20. has turned into UP state.
  21. [R3-Serial4/0/0]
  22. Jan 25 2024 12:51:35-08:00 R3 %%01IFNET/4/LINK_STATE(l)[14]:The line protocol IP
  23. on the interface Serial4/0/0 has entered the UP state.
  24. [R3-Serial4/0/0]

 

成功

三、物理链路PC访问公网
  1. [R1]ip route-static 0.0.0.0 0 15.0.0.2
  2. [R1]acl 2000
  3. [R1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
  4. [R1-acl-basic-2000]q
  5. [R1]int s4/0/0
  6. [R1-Serial4/0/0]nat outbound 2000
  7. [R1-Serial4/0/0]q
  8. [R1]
  1. [R2]ip route-static 0.0.0.0 0 25.0.0.2
  2. [R2]
  3. [R2]acl 2000
  4. [R2-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
  5. [R2-acl-basic-2000]q
  6. [R2]int s4/0/0
  7. [R2-Serial4/0/0]nat outbound 2000
  8. [R2-Serial4/0/0]q
  1. [R3]ip route-static 0.0.0.0 0 35.0.0.2
  2. [R3]
  3. [R3]acl 2000
  4. [R3-acl-basic-2000]rule permit source 192.168.3.0 0.0.0.255
  5. [R3-acl-basic-2000]q
  6. [R3]int s4/0/0
  7. [R3-Serial4/0/0]nat outbound 2000
  8. [R3-Serial4/0/0]q
  1. [R4]ip route-static 0.0.0.0 0 45.0.0.2
  2. [R4]
  3. [R4]acl 2000
  4. [R4-acl-basic-2000]rule permit source 192.168.4.0 0.0.0.255
  5. [R4-acl-basic-2000]q
  6. [R4]int g0/0/1
  7. [R4-GigabitEthernet0/0/1]nat outbound 2000
  8. [R4-GigabitEthernet0/0/1]q

 

全部成功!

四、mgre

R1为中心,R2、R3为分支

  1. [R1]
  2. [R1]int tunnel 0/0/0
  3. [R1-Tunnel0/0/0]ip add 192.168.5.1 24
  4. [R1-Tunnel0/0/0]tunnel-protocol gre p2mp
  5. [R1-Tunnel0/0/0]source 15.0.0.1
  6. Jan 25 2024 13:20:07-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
  7. on the interface Tunnel0/0/0 has entered the UP state.
  8. [R1-Tunnel0/0/0]
  9. [R1-Tunnel0/0/0]nhrp network-id 100
  10. [R1-Tunnel0/0/0]q
  1. [R2]int t0/0/0
  2. [R2-Tunnel0/0/0]ip add 192.168.5.2 24
  3. [R2-Tunnel0/0/0]tunnel-protocol gre p2mp
  4. [R2-Tunnel0/0/0]source s4/0/0
  5. Jan 25 2024 13:24:06-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
  6. on the interface Tunnel0/0/0 has entered the UP state.
  7. [R2-Tunnel0/0/0]nhrp network-id 100
  8. [R2-Tunnel0/0/0]nhrp entry 192.168.5.1 15.0.0.1 r
  9. [R2-Tunnel0/0/0]nhrp entry 192.168.5.1 15.0.0.1 register
  10. [R2-Tunnel0/0/0]q
  1. [R3]int t0/0/0
  2. [R3-Tunnel0/0/0]tunnel-protocol gre p2mp
  3. [R3-Tunnel0/0/0]ip add 192.168.5.3 24
  4. [R3-Tunnel0/0/0]source 35.0.0.1
  5. Jan 25 2024 13:28:31-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
  6. on the interface Tunnel0/0/0 has entered the UP state.
  7. [R3-Tunnel0/0/0]
  8. [R3-Tunnel0/0/0]nhrp network-id 100
  9. [R3-Tunnel0/0/0]nhrp entry 192.168.5.1 15.0.0.1 register
  10. [R3-Tunnel0/0/0]q

 中心获取到了这样一个nhrp表

r2r3都有去往中心的

两个分支之间没有,且主机之间仍不能相互访问因为路由表不全,随后我们解决这个问题。

五、gre

R1和R4之间为点到点的GRE

  1. [R1]int tunnel0/0/1
  2. [R1-Tunnel0/0/1]ip add 192.168.6.1 24
  3. [R1-Tunnel0/0/1]tunnel-protocol gre
  4. [R1-Tunnel0/0/1]source 15.0.0.1
  5. [R1-Tunnel0/0/1]de
  6. [R1-Tunnel0/0/1]destination 45.0.0.1
  7. Jan 25 2024 13:40:04-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
  8. on the interface Tunnel0/0/1 has entered the UP state.
  9. [R1-Tunnel0/0/1]
  10. [R1-Tunnel0/0/1]q
  1. [R4]int t0/0/1
  2. [R4-Tunnel0/0/1]ip add 192.168.6.2 24
  3. [R4-Tunnel0/0/1]tunnel-pro gre
  4. [R4-Tunnel0/0/1]source 45.0.0.1
  5. [R4-Tunnel0/0/1]destination 15.0.0.1
  6. Jan 25 2024 13:42:04-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
  7. on the interface Tunnel0/0/1 has entered the UP state.
  8. [R4-Tunnel0/0/1]
  9. [R4-Tunnel0/0/1]q

此时主机之间还是不能访问,两个直连接口可以通。因为没有互相路由

[R4]ip route-static 192.168.1.0 24 192.168.6.1
[R1]ip route-static 192.168.4.0 24 192.168.6.2

再次测试

pc1成功访问pc4

pc4成功访问pc1

gre环境建立成功

六、私有网络基于RIP全网可达
  1. [R1]rip 1
  2. [R1-rip-1]ver 2
  3. [R1-rip-1]network 192.168.1.0
  4. [R1-rip-1]network 192.168.6.0
  5. [R1-rip-1]q
  6. [R1]rip 1
  7. [R1-rip-1]network 192.168.5.0
  8. [R1-rip-1]q
  1. [R2]rip 1
  2. [R2-rip-1]ver 2
  3. [R2-rip-1]network 192.168.2.0
  4. [R2-rip-1]network 192.168.5.0
  5. [R2-rip-1]q
  1. [R3]rip 1
  2. [R3-rip-1]ver 2
  3. [R3-rip-1]network 192.168.3.0
  4. [R3-rip-1]network 192.168.5.0
  5. [R3-rip-1]q
  1. [R4]rip 1
  2. [R4-rip-1]ver 2
  3. [R4-rip-1]network 192.168.4.0
  4. [R4-rip-1]network 192.168.6.0
  5. [R4-rip-1]q

 

R1的路由表是全的

R2上查不到,R3上也查不到

解决分支无路由表情况

一吧gre环境改变为多播,二把rip水平分割机制关闭 

  1. [R1]int t0/0/0
  2. [R1-Tunnel0/0/0]nhrp entry mu
  3. [R1-Tunnel0/0/0]nhrp entry multicast dy
  4. [R1-Tunnel0/0/0]nhrp entry multicast dynamic
  5. [R1-Tunnel0/0/0]
  6. [R1-Tunnel0/0/0]q
  7. [R1]
  8. [R1]int t0/0/0
  9. [R1-Tunnel0/0/0]undo rip split
  10. [R1-Tunnel0/0/0]undo rip split-horizon
  11. [R1-Tunnel0/0/0]
  12. [R1-Tunnel0/0/0]
  13. [R1-Tunnel0/0/0]q
  14. [R1]
七、发现问题

我们来查看一下路由表

通向r4的rip为非活跃

是因为静态路由的优先级更高

在R4上也一样静态优先

这说明,R1 与R4的主机相互访问没有问题, R1R2R3的主机相互访问没有问题

pc1/pc2/pc3相互访问没有问题

问题在于,正常应该全网可通,但是如下图

4.0网段不能与2.0、3.0网段互通,即使R4的路由表里有2.0与3.0网段,但是发现R2、R3的路由表里没有4.0网段

 明明宣告都没有问题,为什么会这样?

正是因为静态路由的优先级比RIP优先级高,R1作为中心,把学习来的路由表共享给分支R2和R3,R1路由表里静态配置的4.0网段并不是通过RIP学习得来,R1并没有把4.0网段分享给R2和R3。

当我们将R1上通往R4的静态路由拿掉

[R1]undo ip route-static 192.168.4.0 255.255.255.0 192.168.6.2

路由表更新,通向R4为RIP学习

对于R4并没有影响

再次查看r2和r3路由表

路由表里有了R1分享来的4.0网段

检测

成功达到全网互通!!

总结

本次实验要求直接的关联性并不大,每一个点都是可以单独进行学习的,放在一起考察配置,可以发现某一块问题还是很清晰的。本次的重要是GRE环境与MGER环境 的工作原理,数据包的封装,和配置思路,最终实现全网可达。

没什么问题了叭。。。

这次没有可指正的错误,欢迎提问

拜拜~~~~

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/567669
推荐阅读
相关标签
  

闽ICP备14008679号