OpenVPN 客户端 ping 服务器:eth0 正常,tun0 失败

OpenVPN 客户端 ping 服务器:eth0 正常,tun0 失败

通常对于 OpenVPN,人们在访问 LAN 接口时会遇到问题,但在访问 TUN 接口时却没有问题。我遇到的问题正好相反。

从客户端(10.9.0.1) ping 服务器 eth0(10.0.0.97)作品

$ sudo tcpdump -i tun0 -n
04:06:13.702540 IP 10.9.0.1 > 10.0.0.97: ICMP echo request, id 1, seq 10, length 40
04:06:13.702591 IP 10.0.0.97 > 10.9.0.1: ICMP echo reply, id 1, seq 10, length 40

从客户端(10.9.0.1) ping 服务器 tun0(10.8.0.1)暂停
OpenVPN 日志文件在动词 5 处未产生任何错误

$ sudo tcpdump -i tun0 -n
04:08:23.989997 IP 10.9.0.1 > 10.8.0.1: ICMP echo request, id 1, seq 12, length 40
(no reply from server)

$ sudo service iptables status
iptables: Firewall is not running.

从服务器(10.8.0.1)Ping 到客户端(10.9.0.1)无法到达
OpenVPN 日志文件在动词 5 处未产生任何错误

$ ping 10.9.0.1
connect: Network is unreachable

$ip route get 10.9.0.1
10.9.0.1 via 10.8.0.2 dev tun0  src 10.8.0.1

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.0.1        0.0.0.0         UG    0      0        0 eth0
10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
10.0.0.0        10.8.0.2        255.255.0.0     UG    0      0        0 tun0
10.8.0.0        10.8.0.2        255.255.255.0   UG    0      0        0 tun0
10.8.0.2        0.0.0.0         255.255.255.255 UH    0      0        0 tun0
10.9.0.0        10.8.0.2        255.255.255.0   UG    0      0        0 tun0

$ grep -vE '^#|^;|^$|^\s' server.conf
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 10.0.0.0 255.255.0.0"
route 10.0.0.0 255.255.0.0
client-config-dir ccd
route 192.168.40.128 255.255.255.248
client-config-dir ccd
route 10.9.0.0 255.255.255.0
keepalive 10 120
comp-lzo
persist-key
persist-tun
status openvpn-status.log
verb 5

$ cat ccd/client1
ifconfig-push 10.9.0.1 10.9.0.2
iroute 10.9.0.1 255.255.255.255

相关内容