一、 组网需求:
总部与分支机构之间通过公网相连,由于业务需要总部需要与分支机构之间建立GRE隧道,但总部只有一个出口,需要在物理主接口上同时与两个分支建立GRE隧道
解决方案:动态GRE隧道
设备清单:SR6600 路由器 版本R2507P01 三台
二、 组网图:
三、 配置步骤:
Branch1配置 |
# version 5.20, Release 2507P01 # sysname Branch1 # interface
LoopBack0 //分支1测试地址 ip address 2.2.2.2 255.255.255.255 # interface GigabitEthernet0/0 //公网出口 ip address 172.16.1.2 255.255.255.252 # interface GigabitEthernet0/1 # interface GigabitEthernet0/2 # interface GigabitEthernet0/3 # interface
Tunnel0 //tunnel 目的地址填写总部配置的源地址 ip address 10.1.1.2 255.255.255.0 source 172.16.1.2 destination
202.1.1.2 //需要配置目的公网地址 # ip route-static 0.0.0.0 0.0.0.0
172.16.1.1 //本地公网默认路由 ip route-static 1.1.1.1 255.255.255.255
Tunnel0 //配置静态路由到总部测试地址 |
Branch2 配置 |
# version 5.20, Release 2507P01 # sysname Branch2 # interface LoopBack0 ip address 3.3.3.3 255.255.255.255 # interface GigabitEthernet0/0 ip address 192.168.1.2 255.255.255.252 # interface GigabitEthernet0/1 # interface GigabitEthernet0/2 # interface GigabitEthernet0/3 # interface Tunnel0 ip address 10.1.1.3 255.255.255.0 source 192.168.1.2 destination 202.1.1.2 # ip route-static 0.0.0.0
0.0.0.0 192.168.1.1 ip route-static 1.1.1.1 255.255.255.255 Tunnel0 |
总部 配置 |
# version 5.20, Release 2507P01 # sysname Head # interface
LoopBack0 //总部测试地址 ip address 1.1.1.1 255.255.255.255 # interface GigabitEthernet0/0 //总部公网出口地址 ip address 202.1.1.2 255.255.255.252 # interface GigabitEthernet0/1 # interface GigabitEthernet0/2 # interface GigabitEthernet0/3 # interface Tunnel0 ip address 10.1.1.1 255.255.255.0 tunnel-protocol gre
p2mp //配置GRE协议为点到多点 source
202.1.1.2 //配置隧道源地址 gre p2mp aging-time
100 // 配置隧道老化时间100s(默认为5s) gre p2mp branch-network-mask 255.255.255.0 //配置总部网关以24位掩码私网网段为单位,为不同分支的私网目的地址数据流建立隧道 # ip route-static 0.0.0.0 0.0.0.0 202.1.1.1 ip route-static 2.2.2.2 255.255.255.255
Tunnel0 ip route-static 3.3.3.3 255.255.255.255
Tunnel0 |
配置完毕后,在分支1和2上分别ping 总部的测试地址 测试tunnel 建立情况
ping -a 2.2.2.2 1.1.1.1
PING 1.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=255 time=1 ms
Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=255 time=1 ms
Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=255 time=1 ms
Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=255 time=1 ms
Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=255 time=1 ms
ping -a 3.3.3.3 1.1.1.1
PING 1.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=255 time=1 ms
Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=255 time=1 ms
Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=255 time=1 ms
Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=255 time=1 ms
Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=255 time=1 ms
在总部网关上观察tunnel 表项 (需要将老化时间改为100s 否则表项很快就老化了)
display gre p2mp tunnel-table interface tunnel 0
Dest Addr Mask Tunnel Dest Addr Gre Key
2.2.2.0 255.255.255.0 172.16.1.2
3.3.3.0 255.255.255.0 192.168.1.2
注意观察可以发现IP 路由的目的地址虽然是2.2.2.2 和3.3.3.3 但是在tunnel建立时是按照24位掩码的网段进行建立的:
gre p2mp branch-network-mask 255.255.255.0
四、 注意事项:
1. 建立动态GRE隧道后,需要Branch先访问总部触发总部的隧道建立 这样总部才能访问分支。 这是由于总部在初始情况下是动态获取分支destination地址来建立tunnel的, 因此虽然 tunnel 状态up 但是tunnel 表项是空的。分支对总部进行访问后,总部就可以获取destination 地址 进而隧道表项才能成功。如果总部先访问Branch 会出现一下现象:
ping -a 1.1.1.1 2.2.2.2
PING 2.2.2.2: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 2.2.2.2 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
display interface Tunnel 0
Tunnel0 current state: UP
Line protocol current state: UP
Description: Tunnel0 Interface
The Maximum Transmit Unit is 64000
Internet Address is 10.1.1.1/24 Primary
Encapsulation is TUNNEL, service-loopback-group ID not set.
Tunnel source 202.1.1.2
Tunnel bandwidth 64 (kbps)
Tunnel protocol/transport GRE p2mp/IP
GRE key disabled
Checksumming of GRE packets disabled
Output queue : (Urgent queuing : Size/Length/Discards) 0/100/0
Output queue : (Protocol queuing : Size/Length/Discards) 0/500/0
Output queue : (FIFO queuing : Size/Length/Discards) 0/75/0
Last clearing of counters: 16:29:30 Wed 06/01/2011
Last 300 seconds input: 0 bytes/sec, 0 packets/sec
Last 300 seconds output: 0 bytes/sec, 0 packets/sec
0 packets input, 0 bytes
0 input error
0 packets output, 0 bytes
5 output error
2. gre p2mp branch-network-mask 命令是非常重要的。这是因为在缺省情况下网关的branch-network-mask 是32位的,也就是说网关会为每一条私网数据流建立一个tunnel表项,这样表项是非常大的。
因此在实际使用中使用命令gre p2mp branch-network-mask 将掩码改小一些,可以使网关上的tunnel表项数量会大大的减少,降低了网关的负担。
3. GRE p2mp 隧道不支持动态路由协议
该案例暂时没有网友评论
✖
案例意见反馈
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作