gpt4 book ai didi

linux - 两台主机(vps 和专用服务器)之间的隧道 Gre 问题

转载 作者:太空宇宙 更新时间:2023-11-04 05:13:30 26 4
gpt4 key购买 nike

大家好,我需要解决这个问题(所有服务器都安装了 centos 7):我正在尝试通过 vps(在意大利 - OpenVZ)和专用服务器(在德国)创建一个 gre 隧道,但它们不进行内部通信(ping 和 ssh 命令测试)。接下来,我创建一个通过 vps(在意大利 - OpenVZ)和 vps(在法国 - KVM OpenStack)进行通信的 gre 隧道,接下来我创建了一个通过 vps(在法国 - KVM OpenStack)和专用服务器(在德国)进行通信的隧道。我不明白为什么 vps(在意大利 - OpenVZ)和专用服务器(在德国)无法通信,关于如何修复的想法(我也尝试禁用 iptables,firewalld 未启用)?谢谢

换句话说:

在其他尝试中(我的意思是我成功地在这些机器之间创建了 GRE 隧道):

  • VPS(法国)和 VPS(意大利)内部通信(ping 和 ssh 命令测试)
  • VPS(法国)和专用服务器(德国)内部通信(ping 和 ssh 命令测试)

问题(我的意思是我无法在这些机器之间成功创建 GRE 隧道):

  • VPS(意大利)和专用服务器(德国)不进行内部通信(ping 和 ssh 命令测试)。我还询问了托管服务商是否有任何限制,但什么也没有。

我的配置:

  1. 隧道的 VPS 命令:

    echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf

    iptunnel add gre1 mode gre local VPS_IP remote DEDICATED_SERVER_IP ttl 255

    ip addr add 192.168.168.1/30 dev gre1 ip link set gre1 up

  2. 隧道专用服务器命令:

    iptunnel add gre1 mode gre local DEDICATED_SERVER_IP remote VPS_IP ttl 255

    ip addr add 192.168.168.2/30 dev gre1

    ip link set gre1 up


[root@VPS ~]# ping 192.168.168.2PING 192.168.168.2 (192.168.168.2) 56(84) bytes of data.^C--- 192.168.168.2 ping statistics ---89 packets transmitted, 0 received, 100% packet loss, time 87999ms
[root@DE ~]# ping 192.168.168.1PING 192.168.168.1 (192.168.168.1) 56(84) bytes of data.^C--- 192.168.168.1 ping statistics ---92 packets transmitted, 0 received, 100% packet loss, time 91001ms
[root@VPS ~]# tcpdump -i venet0 "proto gre" tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on venet0, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes ^C 0 packets captured 1 packet received by filter 0 packets dropped by kernel
[root@DE ~]# tcpdump -i enp2s0 "proto gre" tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on enp2s0, link-type EN10MB (Ethernet), capture size 262144 bytes ^C 0 packets captured 0 packets received by filter 0 packets dropped by kernel
[root@VPS ~]# lsmod | grep greip_gre                  4242  -2ip_tunnel               4242  -2 sit,ip_gregre                     4242  -2 ip_gre
[root@DE ~]# lsmod | grep greip_gre                 22707  0ip_tunnel              25163  1 ip_gregre                    13144  1 ip_gre

Console image with full command output

最佳答案

如果隧道需要 ip_forwarding 才能工作,则需要执行 /sbin/sysctl -p两端的iptunnelshowiprouteshow的输出是什么

关于linux - 两台主机(vps 和专用服务器)之间的隧道 Gre 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52422277/

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