我正在尝试建立 OpenVPN 连接,我可以使用客户端连接到 VPN,但无法连接到服务器网络上的其他设备
拓扑
配置
IP 表 - 服务器
Endereço de rede Máscara Ender. gateway Interface Custo
0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.22 291
10.8.0.0 255.255.255.0 10.8.0.2 10.8.0.1 281
10.8.0.0 255.255.255.252 No vínculo 10.8.0.1 281
10.8.0.1 255.255.255.255 No vínculo 10.8.0.1 281
10.8.0.3 255.255.255.255 No vínculo 10.8.0.1 281
127.0.0.0 255.0.0.0 No vínculo 127.0.0.1 331
127.0.0.1 255.255.255.255 No vínculo 127.0.0.1 331
127.255.255.255 255.255.255.255 No vínculo 127.0.0.1 331
192.168.0.0 255.255.255.0 10.8.0.2 10.8.0.1 281
192.168.1.0 255.255.255.0 No vínculo 192.168.1.22 291
192.168.1.22 255.255.255.255 No vínculo 192.168.1.22 291
192.168.1.255 255.255.255.255 No vínculo 192.168.1.22 291
192.168.15.0 255.255.255.0 10.8.0.2 10.8.0.1 281
224.0.0.0 240.0.0.0 No vínculo 127.0.0.1 331
224.0.0.0 240.0.0.0 No vínculo 10.8.0.1 281
224.0.0.0 240.0.0.0 No vínculo 192.168.1.22 291
255.255.255.255 255.255.255.255 No vínculo 127.0.0.1 331
255.255.255.255 255.255.255.255 No vínculo 10.8.0.1 281
255.255.255.255 255.255.255.255 No vínculo 192.168.1.22 291
服务器配置
port 1194
proto udp4
dev tun
ca "C:\\Program Files\\OpenVPN\\easy-rsa\\pki\\ca.crt"
cert "C:\\Program Files\\OpenVPN\\easy-rsa\\pki\\issued\\server.crt"
key "C:\\Program Files\\OpenVPN\\easy-rsa\\pki\\private\\server.key" # This file should be kept secret
dh "C:\\Program Files\\OpenVPN\\easy-rsa\\pki\\dh.pem"
tls-auth "C:\\Program Files\\OpenVPN\\easy-rsa\\pki\\easytls\\tls-auth.key" 0 # This file is secret
;topology subnet
server 10.8.0.0 255.255.255.0
push "route 192.168.1.0 255.255.255.0"
route 192.168.0.0 255.255.255.0
route 192.168.15.0 255.255.255.0
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
client-to-client
client-config-dir "C:\\Program Files\\OpenVPN\\ccd"
keepalive 10 120
cipher AES-256-GCM
data-ciphers AES-256-GCM
persist-key
persist-tun
ifconfig-pool-persist "C:\\SGTM\\VPN\\LOG\\ipp.txt"
status "C:\\SGTM\\VPN\\LOG\\openvpn-status.log"
route-method exe
route-delay
verb 5
mute 20
explicit-exit-notify 1
客户端配置
client
dev tun
proto udp
remote mypublicip 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert pdc.crt
key pdc.key
tls-auth tls-auth.key 1
cipher AES-256-CBC
remote-cert-tls server
auth-nocache
verb 4
我可以使用 openVPN ip 和本地 ip 访问服务器,但无法访问服务器 LAN 中的任何其他内容
答案1
我发现了问题,我的客户端没有看到 vpn 内部网络,所以我在路由器中添加了静态路由。
在 LAN 防火墙中配置路由,在网关 192.168.1.22(服务器 ip)上添加此路由 10.8.0.0(子网 vpn)