acl 2000 rule permit so 192.168.10.0 0.0.0.255
int g0/0/0 ip add 192.168.10.254 24 dhcp sel int int g0/0/1 ip add 12.0.0.1 24 nat outbound 2000
ip route-s 0.0.0.0 0 12.0.0.2
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
上海总部IP地址、DHCP、NAT、路由
sys
sys SH
dhcp enable
acl 2000 rule permit so 192.168.20.0 0.0.0.255
int g0/0/1 ip add 192.168.20.254 24 dhcp sel int int g0/0/0 ip add 23.0.0.3 24 nat outbound 2000
ip route-s 0.0.0.0 0 23.0.0.2
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
ISP公网
sys
sys ISP
int g0/0/0 ip add 12.0.0.2 24
int g0/0/1 ip add 23.0.0.2 24
int lo 2 ip add 2.2.2.2 32
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
PC1
PC2
GRE VPN配置
青海分部
interface Tunnel0/0/1
tunnel-protocol gre
source 12.0.0.1
destination 23.0.0.3
1
2
3
4
上海总部
interface Tunnel0/0/1 #创建隧道口
tunnel-protocol gre #指定协议
source 23.0.0.3 #指定隧道源
destination 12.0.0.1 #指定隧道目标
1
2
3
4
配置完GRE隧道发现PC1和PC2还ping 不通,因为没有路由。
配置路由
静态路由 青海分部
ip route-static 192.168.20.0 255.255.255.0 Tunnel0/0/1
ip route-static 192.168.20.0 255.255.255.0 192.168.13.3
1
2
上海总部
ip route-static 192.168.10.0 255.255.255.0 Tunnel0/0/1
ip route-static 192.168.10.0 255.255.255.0 192.168.13.1
1
2
PC1与PC2之间互通,GRE VPN建成功 动态路由 实际的生产环境中基本上用的都是动态路由ospf 青海分部
ospf 1 router-id 1.1.1.1
area 0
net 192.168.10.0 0.0.0.255
net 192.168.13.0 0.0.0.255
1
2
3
4
上海总部
ospf 1 router-id 3.3.3.3
area 0
net 192.168.20.0 0.0.0.255
net 192.168.13.0 0.0.0.255
1
2
3
4
OSPF邻居建立成功
PC1与PC2仍然能通。
GRE 隧道路由宣告注意事项:使用动态路由协议宣告接口时千万不能宣告公网接口。
测试 OSPF进程中宣告公网接口
ospf 1 router-id 1.1.1.1
area 0
net 12.0.0.1 0.0.0.0
1
2
3
OSPF邻居down了,一会又开始重新建邻居变成了full。这个过程反复重复。 PC1和PC2之间ping不通!!!
验证
验证隧道、路由表
青海分部
上海总部
Keeplive
GRE:Generic Routing Encapsulation,通用路由封装
- 一种三层VPN封装技术
- 在任意一种网络协议上传送任意一种其它网络协议的封装方法
- 解决了跨越异种网络的报文传输问题,异种报文传输的通道称为Tunnel(隧道)
GRE核心功能:建立隧道,打通私网
GRE封装:穿马甲
GRE VPN数据包转发过程
GRE 隧道口虚假状态
GRE VPN隧道口虚假状态问题:只要有到达隧道目标的路由,隧道口即可激活
解决方法:开启GRE的Keeplive,用于检测隧道对端是否可达。
把上海总部R2的 Tunnel0/0/1 删掉
OSPF邻居down了
分部路由器上的Tunnel口状态都是up(隧道口虚假状态)。
在R1上配置Keeplive,检测到了R3路由器上的Tunnel口down了。
GRE隧道恢复正常!!!
欢迎关注微信公众号:新网工李白
“免费获取华为认证学习资料培训机构视频、软考学习资料和求职简历模板。”