设为首页 收藏本站
查看: 1620|回复: 0

[经验分享] Cisco设备关于GRE的小案例

[复制链接]

尚未签到

发表于 2018-7-18 07:17:43 | 显示全部楼层 |阅读模式
Cisco设备关于GRE的小案例

  实验拓扑:
  
DSC0000.png

  实验设备:
  五台cisco路由器
  有三台分别作r1、r2、r3
  另两台作pc1、pc2
  实验步骤:
  为每个设备的各个端口配置正确的ip
  在r1和r2上配置一条通往公共网的默认路由、创建gre隧道、配置通过隧道的路由
  测试连通性
  实验目的:
  能使1.0网段的主机能通过gre隧道和2.0网段的主机通讯
  参考配置:
  r1#show ip route
  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 61.130.130.2 to network 0.0.0.0
  C    192.168.4.0/24 is directly connected, Tunnel10
  C    192.168.1.0/24 is directly connected, Serial1/1
  S    192.168.2.0/24 is directly connected, Tunnel10
  61.0.0.0/30 is subnetted, 1 subnets
  C       61.130.130.0 is directly connected, Serial1/0
  S*   0.0.0.0/0 [1/0] via 61.130.130.2
  r1#show running-config
  Building configuration...
  
  Current configuration : 1003 bytes
  !
  version 12.4
  service timestamps debug datetime msec
  service timestamps log datetime msec
  no service password-encryption
  !
  hostname r1
  !
  boot-start-marker
  boot-end-marker
  !
  !
  no aaa new-model
  memory-size iomem 5
  !
  !
  ip cef
  !
  !
  interface Tunnel10
  ip address 192.168.4.1 255.255.255.0
  tunnel source 61.130.130.1
  tunnel destination 61.130.132.1
  !
  interface FastEthernet0/0
  no ip address
  shutdown
  duplex auto
  speed auto
  !
  interface Serial1/0
  ip address 61.130.130.1 255.255.255.252
  serial restart-delay 0
  !
  interface Serial1/1
  ip address 192.168.1.254 255.255.255.0
  serial restart-delay 0
  !
  interface Serial1/2
  no ip address
  shutdown
  serial restart-delay 0
  !
  interface Serial1/3
  no ip address
  shutdown
  serial restart-delay 0
  !
  ip http server
  ip route 0.0.0.0 0.0.0.0 61.130.130.2
  ip route 192.168.2.0 255.255.255.0 Tunnel10
  !
  !
  
control-plane  !
  !
  
  line con 0
  line aux 0
  line vty 0 4
  !
  !
  end
  r2#show running-config
  Building configuration...
  Current configuration : 757 bytes
  !
  version 12.4
  service timestamps debug datetime msec
  service timestamps log datetime msec
  no service password-encryption
  !
  hostname r2
  !
  boot-start-marker
  boot-end-marker
  !
  !
  no aaa new-model
  memory-size iomem 5
  !
  !
  ip cef
  !
  !
  interface FastEthernet0/0
  no ip address
  shutdown
  duplex auto
  speed auto
  !
  interface Serial1/0
  ip address 61.130.130.2 255.255.255.252
  serial restart-delay 0
  !
  interface Serial1/1
  ip address 61.130.132.2 255.255.255.252
  serial restart-delay 0
  !
  interface Serial1/2
  no ip address
  shutdown
  serial restart-delay 0
  !
  interface Serial1/3
  no ip address
  shutdown
  serial restart-delay 0
  !
  ip http server
  !
  !
  control-plane
  !
  !
  line con 0
  line aux 0
  line vty 0 4
  !
  !
  end
  r3#show ip route
  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 61.130.132.2 to network 0.0.0.0
  C    192.168.4.0/24 is directly connected, Tunnel20
  S    192.168.1.0/24 is directly connected, Tunnel20
  C    192.168.2.0/24 is directly connected, Serial1/0
  61.0.0.0/30 is subnetted, 1 subnets
  C       61.130.132.0 is directly connected, Serial1/1
  S*   0.0.0.0/0 [1/0] via 61.130.132.2
  r3#show running-config
  Building configuration...
  Current configuration : 1018 bytes
  !
  version 12.4
  service timestamps debug datetime msec
  service timestamps log datetime msec
  no service password-encryption
  !
  hostname r3
  !
  boot-start-marker
  boot-end-marker
  !
  !
  no aaa new-model
  memory-size iomem 5
  !
  !
  ip cef
  !
  !
  interface Tunnel20
  ip address 192.168.4.2 255.255.255.0
  tunnel source 61.130.132.1
  tunnel destination 61.130.130.1
  !
  interface FastEthernet0/0
  no ip address
  shutdown
  duplex auto
  speed auto
  !
  interface Serial1/0
  ip address 192.168.2.254 255.255.255.0
  serial restart-delay 0
  !
  interface Serial1/1
  ip address 61.130.132.1 255.255.255.252
  serial restart-delay 0
  !
  interface Serial1/2
  no ip address
  shutdown
  serial restart-delay 0
  !
  interface Serial1/3
  no ip address
  shutdown
  serial restart-delay 0
  !
  ip http server
  ip route 0.0.0.0 0.0.0.0 61.130.132.2
  ip route 192.168.1.0 255.255.255.0 Tunnel20
  !
  !
  control-plane
  !
  !
  line con 0
  line aux 0
  line vty 0 4
  !
  !
  End
  测试:
  Pc1ping pc2
  pc1#ping 192.168.2.100
  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 = 136/148/172 ms
  Pc2pingpc1
  pc2#ping 192.168.1.100
  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 = 100/147/204 ms
  跟踪一下路由:
  pc1#traceroute ip
  Target IP address: 192.168.2.100
  Source address: 192.168.1.100
  Numeric display [n]:
  Timeout in seconds [3]:
  Probe count [3]:
  Minimum Time to Live [1]:
  Maximum Time to Live [30]:
  Port Number [33434]:
  Loose, Strict, Record, Timestamp, Verbose[none]:
  Type escape sequence to abort.
  Tracing the route to 192.168.2.1
  1 192.168.1.254 68 msec 36 msec 52 msec
  2 192.168.4.2 100 msec 136 msec 140 msec
  3 192.168.2.100 188 msec 228 msec *
  很显然ping包是从虚拟的隧道通过的

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-538188-1-1.html 上篇帖子: Cisco 路由器的配置命令 下篇帖子: Cisco 2950-48端口汇聚
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表