我正在运行带有最新 OpenVpn 包的 Ubuntu 20.04。第一次尝试自己使用 vpn。
无法通过我的 Windows 机器客户端 ping 通当前位于 10.10.0.0 上的任何主机。
当我通过 ssh 进入该子网上的任何系统时,我可以 ping 任一方向。
UFW 目前已被禁用。
OpenVPN 连接良好,但我能够 ping 通 openvpn 主机地址 10.10.3.98。
所有系统上的 /proc/sys/net/ipv4/ip_forward 设置为 1
考虑某种路线问题,但我尝试了几种方法,但都没有成功。我需要集体。
谢谢你!
host1:/etc/openvpn$ ip 地址
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether fa:16:3e:2a:f5:f1 brd ff:ff:ff:ff:ff:ff
inet PUBLICIP/32 scope global dynamic ens3
valid_lft 70352sec preferred_lft 70352sec
inet6 2607:5300:201:2100::fdf/56 scope global
valid_lft forever preferred_lft forever
inet6 fe80::f816:3eff:fe2a:f5f1/64 scope link
valid_lft forever preferred_lft forever
3: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc fq_codel state UP group default qlen 1000
link/ether fa:16:3e:cc:88:e1 brd ff:ff:ff:ff:ff:ff
inet 10.10.3.98/16 brd 10.10.255.255 scope global dynamic ens4
valid_lft 70352sec preferred_lft 70352sec
inet6 fe80::f816:3eff:fecc:88e1/64 scope link
valid_lft forever preferred_lft forever
8: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 100
link/none
inet 10.0.0.1/24 brd 10.0.0.255 scope global tun0
valid_lft forever preferred_lft forever
inet6 fe80::22db:5c7d:76e4:21c2/64 scope link stable-privacy
valid_lft forever preferred_lft forever
服务器配置文件
port 1194
dev tun
user nobody
group nogroup
persist-key
persist-tun
keepalive 10 120
topology subnet
server 10.0.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 10.10.0.0 255.255.0.0"
push "dhcp-option DNS 8.8.8.8"
push "redirect-gateway def1 bypass-dhcp"
dh none
ecdh-curve prime256v1
tls-crypt tls-crypt.key
crl-verify crl.pem
ca ca.crt
cert server_hCBOMjVqB0C2SZat.crt
key server_hCBOMjVqB0C2SZat.key
auth SHA256
cipher AES-128-GCM
ncp-ciphers AES-128-GCM
tls-server
tls-version-min 1.2
tls-cipher TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256
client-config-dir /etc/openvpn/ccd
status /var/log/openvpn/status.log
verb 3
IP 路由
ip route
default via PUBLICGWIP dev ens3 proto dhcp src PUBLICIP metric 100
10.0.0.0/24 dev tun0 proto kernel scope link src 10.0.0.1
10.10.0.0/16 dev ens4 proto kernel scope link src 10.10.3.98
PUBLICGWIP dev ens3 proto dhcp scope link src PUBLICIP metric 100
169.254.169.254 via 10.10.0.1 dev ens4 proto dhcp src 10.10.3.98 metric 100
客户端配置(减去键)
client
proto udp
explicit-exit-notify
remote PUBLICIP 1194
dev tun
resolv-retry infinite
nobind
persist-key
persist-tun
remote-cert-tls server
verify-x509-name server_hCBOMjVqB0C2SZat name
auth SHA256
auth-nocache
cipher AES-128-GCM
tls-client
tls-version-min 1.2
tls-cipher TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256
ignore-unknown-option block-outside-dns
setenv opt block-outside-dns # Prevent Windows 10 DNS leak
verb 3
host2(我无法 ping 通的主机)
ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether fa:16:3e:02:6e:b7 brd ff:ff:ff:ff:ff:ff
inet PUBLICIP/32 scope global dynamic ens3
valid_lft 69012sec preferred_lft 69012sec
inet6 2607:5300:201:2100::862/56 scope global
valid_lft forever preferred_lft forever
inet6 fe80::f816:3eff:fe02:6eb7/64 scope link
valid_lft forever preferred_lft forever
3: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc fq_codel state UP group default qlen 1000
link/ether fa:16:3e:57:46:57 brd ff:ff:ff:ff:ff:ff
inet 10.10.3.222/16 brd 10.10.255.255 scope global dynamic ens4
valid_lft 69012sec preferred_lft 69012sec
inet6 fe80::f816:3eff:fe57:4657/64 scope link
valid_lft forever preferred_lft forever
ip route
default PUBLICGWIP dev ens3 proto dhcp src PUBLICIP metric 100
10.10.0.0/16 dev ens4 proto kernel scope link src 10.10.3.222
PUBLICGWIP dev ens3 proto dhcp scope link src PUBLICIP metric 100
169.254.169.254 via 10.10.0.2 dev ens4 proto dhcp src 10.10.3.222 metric 100
连接到 VPN 时的 Windows 客户端 ipconfig
Unknown adapter Local Area Connection:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : TAP-Windows Adapter V9 for OpenVPN Connect
Physical Address. . . . . . . . . : 00-FF-0B-15-88-B7
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::4719:c54f:b42e:fe72%50(Preferred)
IPv4 Address. . . . . . . . . . . : 10.0.0.2(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
DHCPv6 IAID . . . . . . . . . . . : 838926091
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-28-0C-DC-F8-3C-7C-3F-F3-68-C1
DNS Servers . . . . . . . . . . . : 8.8.8.8
NetBIOS over Tcpip. . . . . . . . : Enabled
答案1
host2 没有可以到达的路由10.0.0.0/24
。
它需要一条路线来10.0.0.0/24 via 10.10.3.98
了解,10.10.3.98
作为到达的门户10.0.0.0/24
。
请记住,您需要指向两个方向的路线。