如何在 Linux 上使用我自己的 pptp vpn 服务器在 Windows 中的客户端打开端口?

如何在 Linux 上使用我自己的 pptp vpn 服务器在 Windows 中的客户端打开端口?

我已经pptpd在 Vultr ubuntu 服务器上设置了自己的服务器,我使用 Windows 内置的客户端连接到它,我成功访问了互联网,当我检查我的 IP 时,我看到的是 VPS IP 而不是我的真实 IP,但我的问题是当我尝试使用名为 的简单工具在我的 Windows 客户端中打开端口 portlistener并开始监听端口 80 时,我转到了 checkport 工具,但我看到端口 80 已关闭。那么有人知道如何在我的客户端上使用这个端口吗?

我的ifconfig命令显示如下:

root@vultr:~# ifconfig
ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 104.238.191.125  netmask 255.255.254.0  broadcast 104.238.191.255
        inet6 fe80::5400:2ff:feec:61e8  prefixlen 64  scopeid 0x20<link>
        ether 56:00:02:ec:61:e8  txqueuelen 1000  (Ethernet)
        RX packets 3383  bytes 984017 (960.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3470  bytes 897643 (876.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens7: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1450
        inet 10.24.96.3  netmask 255.255.0.0  broadcast 10.24.255.255
        inet6 fe80::5800:2ff:feec:61e8  prefixlen 64  scopeid 0x20<link>
        ether 5a:00:02:ec:61:e8  txqueuelen 1000  (Ethernet)
        RX packets 3  bytes 370 (370.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 225  bytes 9910 (9.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1396
        inet 10.24.96.3  netmask 255.255.255.255  destination 10.24.96.5
        ppp  txqueuelen 3  (Point-to-Point Protocol)
        RX packets 340  bytes 45323 (44.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 183  bytes 47486 (46.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

iptables -L命令显示:

root@vultr:~# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     gre  --  anywhere             anywhere
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:1723 state NEW

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
TCPMSS     tcp  --  10.0.0.0/24          anywhere             tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

答案1

在这里找到了解决方案:

iptables 的端口转发(DMZ)

iptables -A PREROUTING -t nat -i eth1 -p tcp --dport 80 -j DNAT --to 192.168.1.50:80
iptables -A INPUT -p tcp -m state --state NEW --dport 80 -i eth1 -j ACCEPT

相关内容