加载GRE模块modprobeip_gre创建Tunnel名为officeiptunneladdofficemodegreremote111.206.164.122local111.206.0.88ttl255iplinksetofficeup为tunnel增加IP地址ip
加载GRE模块
modprobe ip_gre
创建Tunnel 名为office
ip tunnel add
office mode gre remote 111.206.164.122 local 111.206.0.88 ttl 255
ip link set office
up
为tunnel 增加IP地址
ip add add
10.100.100.1/30 dev office
创建一个路由表,,表名为136
ip route add default via 103.246.132.61 table 136
创建一条策略,使本地源IP为192.168.50.0/24 向外访问时指定路由表136
ip rule add from
192.168.50.0/24 dev office table 136
增加静态路由指向tunnel
ip route add
103.246.135.0/24 via 10.100.100.2 dev office
ip route add
192.168.50.0/24 via 10.100.100.2 dev office
gre0: gre/ip remote any
local any ttl inherit nopmtudisc
office: gre/ip remote 111.206.164.122 local 111.206.0.88 ttl 255
本文出自 “lihongweibj” 博客,请务必保留此出处