【问题标题】:GRE Tunnel routing issue in Linux CentOSLinux CentOS 中的 GRE 隧道路由问题
【发布时间】:2013-11-20 18:52:37
【问题描述】:

我正在使用以下步骤在两台 Linux (CentOS6) 服务器之间创建 GRE 隧道。

在主服务器上:

chkconfig iptables 关闭

服务 iptables 停止

sysctl -w net.ipv4.conf.default.rp_filter=0

modprobe ip_gre

ip tunnel add tun1 mode gre remote 98.123.87.97 local 106.61.58.98 ttl 255

ip addr add 10.0.1.0/24 dev tun1

ip link set dev tun1 up

ip addr add 98.123.87.95/27 dev eth0

在从服务器上:

chkconfig iptables 关闭

服务 iptables 停止

sysctl -w net.ipv4.ip_forward=1

sysctl -w net.ipv4.conf.all.forwarding=1

sysctl -w net.ipv4.conf.proxy_arp=1

sysctl -w net.ipv4.conf.all.proxy_arp=1

sysctl -w net.ipv4.conf.eth0.rp_filter=0

sysctl -w net.ipv4.conf.default.rp_filter=0

modprobe ip_gre

ip tunnel add tunx mode gre remote 106.61.58.98 local 98.123.87.97 ttl 255

ip addr add 10.0.2.0/24 dev tun0

ip 链接设置 tunx up

ip route add 98.123.87.95/27 dev tun0

我需要将从属服务器的 IP 添加到我的主服务器上,我收到来自隧道 IP(从属服务器的 IP)的 ping 响应,当我尝试通过 SSH 连接隧道 IP(从属 IP)时,我正在访问主服务器(这就是我想要的)。

问题是当我尝试通过隧道 IP(从属 IP)发送诸如 DNS 查询之类的传出流量时,我收到了超时请求。

我猜这是我的一台服务器的路由问题。知道我应该怎么做才能通过隧道 IP 处理我的传出流量吗?

谢谢,

【问题讨论】:

    标签: linux networking routing tunnel tunneling


    【解决方案1】:

    你真的要添加 10.0.1.0/24 地址吗?这是一个网络地址,看起来像错误。 此外,您应该通过 gateway=another_end_of_tunnel 的隧道在客户端计算机上添加默认路由(或路由到 dns 服务器或任何您想要的)。 如果您不想断开连接,请不要忘记在您的机器上添加静态路由,然后再添加默认路由!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-26
      • 1970-01-01
      • 2014-06-22
      • 1970-01-01
      • 2015-05-11
      • 2015-03-14
      • 2015-12-13
      • 2018-11-21
      相关资源
      最近更新 更多