加载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
ip link set office mtu 1476 up 默认情况下MTU为1476
为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
# ip tunnel show 查看tunnel信息
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