ENSP上基于vrp命令的GRE简单配置实验

GRE简单配置命令

实验拓扑:

请添加图片描述

要求:

R1,R3为私网路由器,R2为运营商公网。即R2上不写任何路由,R1、R3上也不能直接写到R2的路由(缺省)。

R1和R3通过GRE搭建虚拟专线组成内网,要求R1的环回可直接ping通R3环回。

请添加图片描述

配置IP

R1

[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip add 22.1.1.1 24
[R1-GigabitEthernet0/0/0]q
[R1]interface l0
[R1-LoopBack0]ip add 192.168.1.1 24
[R1-LoopBack0]q
[R1]ip route-static 0.0.0.0 0 22.1.1.2

R2

[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 22.1.1.2 24
[R2-GigabitEthernet0/0/0]q
[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 23.1.1.1 24
[R2-GigabitEthernet0/0/1]q
[R2]int l0
[R2-LoopBack0]ip add 1.1.1.1 24

R3

[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 23.1.1.2 24
[R3-GigabitEthernet0/0/0]q
[R3]int l0
[R3-LoopBack0]ip add 192.168.2.1 24
[R3-LoopBack0]q   
[R3]ip route-static 0.0.0.0 0 23.1.1.1

配置GRE

R1

[R1]interface Tunnel 0/0/0		创建通道接口
[R1-Tunnel0/0/0]ip add 10.1.1.1 24		配置ip地址

[R1-Tunnel0/0/0]tunnel-protocol gre		定义封装方式为gre
[R1-Tunnel0/0/0]source 22.1.1.1		封装的源ip
[R1-Tunnel0/0/0]destination 23.1.1.2	封装的目标ip

R3

[R3]interface tunnel0/0/0
[R3-Tunnel0/0/0]ip add 10.1.1.2 24
[R3-Tunnel0/0/0]tunnel-protocol gre
[R3-Tunnel0/0/0]source 23.1.1.2  
[R3-Tunnel0/0/0]destination 22.1.1.1

测试:

[R1]ping 10.1.1.2
  PING 10.1.1.2: 56  data bytes, press CTRL_C to break
    Reply from 10.1.1.2: bytes=56 Sequence=1 ttl=255 time=40 ms
    Reply from 10.1.1.2: bytes=56 Sequence=2 ttl=255 time=30 ms
    Reply from 10.1.1.2: bytes=56 Sequence=3 ttl=255 time=30 ms
    Reply from 10.1.1.2: bytes=56 Sequence=4 ttl=255 time=30 ms
    Reply from 10.1.1.2: bytes=56 Sequence=5 ttl=255 time=20 ms

  --- 10.1.1.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/30/40 ms

配置静态路由,测试R1和R3之间通过GRE搭建的虚拟专线是否连通。

[R1]ip route-static 192.168.2.0 24 10.1.1.2

[R3]ip route-static 192.168.1.0 24 10.1.1.1

[R3]ping 192.168.1.1
  PING 192.168.1.1: 56  data bytes, press CTRL_C to break
    Reply from 192.168.1.1: bytes=56 Sequence=1 ttl=255 time=40 ms
    Reply from 192.168.1.1: bytes=56 Sequence=2 ttl=255 time=30 ms
    Reply from 192.168.1.1: bytes=56 Sequence=3 ttl=255 time=30 ms
    Reply from 192.168.1.1: bytes=56 Sequence=4 ttl=255 time=30 ms
    Reply from 192.168.1.1: bytes=56 Sequence=5 ttl=255 time=30 ms

  --- 192.168.1.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 30/32/40 ms

抓包查看

可以看到封装了两个IPv4地址,第一个为公网ip,第二个为搭建的虚拟连接ip。如图:

请添加图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值