我有一个路由器后面的Ubuntu服务器,我正在configuration一个GRE隧道到另一个远程设备的interwebs。
在configuration中,我添加行:
pre-up iptunnel add tun1 mode gre local [local ip] remote [remote ip] ttl 255
由于ubuntu服务器位于路由器的后面,因此[local ip]是路由器的wan ip吗? 或者希望隧道连接的以太网接口的实际本地IP?
服务器所在的路由器没有说任何有关将GRE 47转发到LAN设备的任何信息,所以我只是DMZ'd服务器(在产品中没有理想的,但我只是使用GRE进行testing,以允许从一个子网另一个)
这里是完整的脚本(将本地ip设置为ubuntu服务器的lan ip)
auto tun1 iface tun1 inet static address 10.0.33.1 netmask 255.255.255.0 pre-up iptunnel add tun1 mode gre local 192.168.33.72 remote xxxx ttl 255 up ifconfig tun1 multicast pointopoint 10.0.33.2 post-down iptunnel del tun1
IP是服务器的IP,而不是路由器的IP。
所以假设你在eth0上configuration了1.2.3.4/24,1.2.3.1是默认的gw / router,那么命令是:
iptunnel add tun1 mode gre local 1.2.3.4 remote xxxx ttl y