Port

如何在 linux 上使用我自己的 pptp vpn 伺服器在 windows 的客戶端打開埠?

  • August 9, 2020

我已經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

在這裡找到解決方案:

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

引用自:https://serverfault.com/questions/1029412