Ubuntu GRE 本地 ip 地址、路由器的 wan ip 或 ubuntu 服务器的 ip

Ubuntu GRE 本地 ip 地址、路由器的 wan ip 或 ubuntu 服务器的 ip

我在路由器后面有一个 ubuntu 服务器,我正在配置它通过 GRE 隧道连接到互联网上的另一个远程设备。

在配置中,我添加了以下行:

pre-up iptunnel add tun1 mode gre local [local ip] remote [remote ip] ttl 255

由于 ubuntu 服务器位于路由器后面,[本地 ip] 应该是路由器的 wan ip 吗?或者是我希望隧道连接的以太网接口的实际本地 ip?

服务器后面的路由器没有提到将 GRE 47 转发到 LAN 设备,所以我只是将服务器设置为 DMZ(在产品中并不理想,但我只是测试使用 GRE 允许从一个子网到另一个子网的多播发现)

以下是完整脚本(本地 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 x.x.x.x ttl 255
    up ifconfig tun1 multicast pointopoint 10.0.33.2
    post-down iptunnel del tun1

答案1

IP 是服务器的 IP,而不是路由器的 IP。
假设您在 eth0 上配置了 1.2.3.4/24,其中 1.2.3.1 是默认网关/路由器,则命令如下:

iptunnel add tun1 mode gre local 1.2.3.4 remote x.x.x.x ttl y

相关内容