如何解决PPTP连上打不开网络问题
查看ubuntu后面,发现有个报错。
Cannot determine ethernet address for proxy ARP
晚上查了很多。GPT看起来也不懂,一顿官话。
有说net mask
的。也没搞懂要怎么改。
The netmask on your pptp clients is wrong... These are point-to-point links, so set a netmask of 255.255.255.255 in your pptp options. After you do this, the clients will use their default that points to the pptp server.
The reason this breaks now is because the clients consider each other reachable via ARP (since they are both on the 10.0.0.0/255.0.0.0 network); however pptp doesnt have a mac address to use.
最后看到这个贴子,好像他搞定了 https://serverfault.com/questions/423695/cannot-determine-ethernet-address-for-proxy-arp-on-pptp
After trying many solutions finally I found the answer. My ethernet interface called ens160 so for IP masquerading I should use this:
sudo iptables -t nat -A POSTROUTING -o ens160 -j MASQUERADE
ifconfig 看了一下网络信息,看起来也没有一个是公网IP。
问了一下GPT什么意思
user:sudo iptables -t nat -A POSTROUTING -o
assistant:
这个命令的完整形式应该是:
sudo iptables -t nat -A POSTROUTING -o <外部网络接口> -j MASQUERADE
其中,<外部网络接口>
是指连接到外部网络的网络接口,例如eth0或wlan0等。这个命令的作用是将从PPTP客户端发出的数据包的源IP地址改为PPTP服务器的IP地址,并将其发送到外部网络。
请注意,这个命令只是临时生效,如果您希望这个规则在系统重启后仍然生效,您需要将这个规则保存到iptables规则文件中。在Ubuntu系统中,iptables规则文件通常是/etc/iptables/rules.v4
。您可以使用以下命令将规则保存到文件中:
sudo sh -c "iptables-save > /etc/iptables/rules.v4"
然后,您可以使用以下命令将iptables规则加载到系统中:
sudo iptables-restore < /etc/iptables/rules.v4
看来就是en0
报着试一试的态度,反正坏了也只是坏pptp(本来就是坏的)。
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
It works!