这块如果不想使用VPN实现私网互通,可以在出接口使用NAT,对端使用NATserver 端口映射
GRE 现在已经不单独使用,更多的是和 IPsec 一起使用 用作VPN嵌套
GRE封装包格式:
链路层头 | 公网头 | GRE头(47) | 私网头 | 载荷数据 |
默认已经将IP配置完毕
前置说明:两台路由器用作两地私网的出口设备,串口模拟横跨的公网(串口特性:两端IP不在一个网段也可以通信)
R1:
隧道配置 源目地址是对应的公网IP
[R1-Tunnel0]dis th
#
interface Tunnel0 mode gre
ip address 10.0.0.1 255.255.255.0
source 100.0.0.1
destination 200.0.0.1
#
[R2-Tunnel0]dis th
#
interface Tunnel0 mode gre
ip address 10.0.0.2 255.255.255.0
source 200.0.0.1
destination 100.0.0.1
#
return
此时两端并不能通信,将数据送入 隧道 使用默认路由(因为对端不一定只有一个网段)
[R1]ip route-static 0.0.0.0 0 Tunnel 0
[R2]ip route-static 0.0.0.0 0 Tunnel 0