gpt4 book ai didi

linux - archlinux、KVM VPS 上的 PPTP 服务器,客户端从未收到包

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

我正在尝试在 DigitalOcean 的 KVM VPS 上设置 PPTP 服务器。我的配置如下。

/etc/iptables/iptables.rules:

*nat
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT

/etc/pptpd.conf(localip为服务器IP,以下服务器为45.55.20.125或104.236.158.120):

option /etc/ppp/pptpd-options
logwtmp
localip SERVER_IP
remoteip 10.1.0.1-10

/etc/ppp/pptpd-选项:

name pptpd
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
proxyarp
nodefaultroute
lock
nobsdcomp
novj
novjccomp
nologfd
ms-dns 8.8.8.8
ms-dns 8.8.4.4

/etc/sysctl.conf:

net.ipv4.ip_forward=1

它适用于 Debian 操作系统(服务器 IP:45.55.20.125)。在客户端ping 8.8.8.8时,信息如下:

root@test:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 45.55.0.1 0.0.0.0 UG 0 0 0 eth0
10.1.0.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
10.134.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
45.55.0.0 0.0.0.0 255.255.224.0 U 0 0 0 eth0

root@test:~# tcpdump -n -i eth0 icmp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
04:37:22.566596 IP 45.55.20.125 > 8.8.8.8: ICMP echo request, id 64781, seq 0, length 64
04:37:22.569073 IP 8.8.8.8 > 45.55.20.125: ICMP echo reply, id 64781, seq 0, length 64
04:37:23.570903 IP 45.55.20.125 > 8.8.8.8: ICMP echo request, id 64781, seq 1, length 64
04:37:23.573515 IP 8.8.8.8 > 45.55.20.125: ICMP echo reply, id 64781, seq 1, length 64
04:37:24.571255 IP 45.55.20.125 > 8.8.8.8: ICMP echo request, id 64781, seq 2, length 64
04:37:24.573913 IP 8.8.8.8 > 45.55.20.125: ICMP echo reply, id 64781, seq 2, length 64

root@test:~# tcpdump -n -i ppp0 icmp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ppp0, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
04:37:22.566558 IP 10.1.0.1 > 8.8.8.8: ICMP echo request, id 64781, seq 0, length 64
04:37:22.569095 IP 8.8.8.8 > 10.1.0.1: ICMP echo reply, id 64781, seq 0, length 64
04:37:23.570871 IP 10.1.0.1 > 8.8.8.8: ICMP echo request, id 64781, seq 1, length 64
04:37:23.573543 IP 8.8.8.8 > 10.1.0.1: ICMP echo reply, id 64781, seq 1, length 64
04:37:24.571224 IP 10.1.0.1 > 8.8.8.8: ICMP echo request, id 64781, seq 2, length 64

但是当我使用digitalocean-debian-to-arch将一个Debian转换为Archlinux(服务器IP:104.236.158.120)之后。当我在客户端上 ping 8.8.8.8 时:

> ip route
default via 104.236.128.1 dev eth0 proto static
10.1.0.1 dev ppp0 proto kernel scope link src 104.236.158.120
104.236.128.0/18 dev eth0 proto kernel scope link src 104.236.158.120

> sudo tcpdump -n -i eth0 icmp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
16:55:28.352582 IP 104.236.158.120 > 8.8.8.8: ICMP echo request, id 51470, seq 10, length 64
16:55:28.354295 IP 8.8.8.8 > 104.236.158.120: ICMP echo reply, id 51470, seq 10, length 64
16:55:29.357393 IP 104.236.158.120 > 8.8.8.8: ICMP echo request, id 51470, seq 11, length 64
16:55:29.359129 IP 8.8.8.8 > 104.236.158.120: ICMP echo reply, id 51470, seq 11, length 64
16:55:30.361901 IP 104.236.158.120 > 8.8.8.8: ICMP echo request, id 51470, seq 12, length 64
16:55:30.363614 IP 8.8.8.8 > 104.236.158.120: ICMP echo reply, id 51470, seq 12, length 64

> sudo tcpdump -n -i ppp0 icmp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ppp0, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
16:55:24.338226 IP 10.1.0.1 > 8.8.8.8: ICMP echo request, id 51470, seq 6, length 64
16:55:25.343537 IP 10.1.0.1 > 8.8.8.8: ICMP echo request, id 51470, seq 7, length 64
16:55:26.347889 IP 10.1.0.1 > 8.8.8.8: ICMP echo request, id 51470, seq 8, length 64

没有“8.8.8.8 > 10.1.0.1”软件包,我不明白为什么。可能是什么问题?

最佳答案

哦,我现在明白了。需要开启eth0接口(interface)转发。

# echo 1 > /proc/sys/net/ipv4/conf/eth0/forwarding 

关于linux - archlinux、KVM VPS 上的 PPTP 服务器,客户端从未收到包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31450368/

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