gpt4 book ai didi

linux - Linux CentOS 中的 GRE 隧道路由问题

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:01:11 25 4
gpt4 key购买 nike

我正在使用以下步骤在两个 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 地址添加 10.0.1.0/24 dev tun1

ip 链接设置 dev tun1

ip 地址添加 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 地址添加 10.0.2.0/24 dev tun0

ip链接设置tunx up

ip 路由添加 98.123.87.95/27 dev tun0

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

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

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

谢谢,

最佳答案

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

关于linux - Linux CentOS 中的 GRE 隧道路由问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19864539/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com