我在 CentOS 6.5 機器上設定了 PPTP 伺服器,以使用來自公共網路的 VPN 和其他雜項腳本。一切似乎都工作正常,除了一旦連接後我無法通過其公共 IP 或名稱 ping VPN 伺服器!
假設我有以下設置
伺服器
host: vpn.myserver.com,
public ip: 178.62.x.x
private ip (pptp): 10.0.0.1
host range /dhcp: 10.0.0.100-200
客戶
private ip:= 10.241.0.76
在連接到 VPN 之前,我可以很好地 ping 伺服器(透過名稱或公用 IP)。然而,一旦連接,我必須使用伺服器的私人位址來 ssh 到伺服器。
Iptable 規則(轉儲到檔案)
# Generated by iptables-save v1.4.7 on Tue Sep 29 10:51:16 2015
*nat
:PREROUTING ACCEPT [3279:270754]
:POSTROUTING ACCEPT [16:1761]
:OUTPUT ACCEPT [354:21503]
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
# Completed on Tue Sep 29 10:51:16 2015
# Generated by iptables-save v1.4.7 on Tue Sep 29 10:51:16 2015
*filter
:INPUT ACCEPT [76829:9558834]
:FORWARD ACCEPT [67632:61015363]
:OUTPUT ACCEPT [90822:67426561]
COMMIT
# Completed on Tue Sep 29 10:51:16 2015
系統配置:
# Controls IP packet forwarding
net.ipv4.ip_forward = 1
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
網路統計
netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.0.0.100 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
10.0.0.101 0.0.0.0 255.255.255.255 UH 0 0 0 ppp1
178.62.xx.xx 0.0.0.0 255.255.192.0 U 0 0 0 eth0
10.131.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
0.0.0.0 178.62.xx.xx 0.0.0.0 UG 0 0 0 eth0
是否缺少某些路由規則?
更新
忘記新增追蹤路由詳細資訊..
traceroute to 178.62.x.x (178.62.x.x), 64 hops max, 52 byte packets
1 10.241.254.254 (10.241.254.254) 15.450 ms 15.955 ms 10.267 ms
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *