这是我的 OpenVPN 服务器配置:
local 192.168.15.231
port 11194
proto tcp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh.pem
auth SHA512
tls-crypt tc.key
topology subnet
server 10.8.0.0 255.255.255.0
push "redirect-gateway def1 bypass-dhcp"
ifconfig-pool-persist ipp.txt
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
keepalive 10 120
cipher AES-256-CBC
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3
crl-verify crl.pem
这是我的客户端配置:
client
dev tun
proto tcp
remote 187.85.170.184 11194
resolv-retry infinite
nobind
persist-key
persist-tun
remote-cert-tls server
auth SHA512
cipher AES-256-CBC
ignore-unknown-option block-outside-dns
block-outside-dns
verb 3
<ca>
...
</ca>
<cert>
...
</cert>
<key>
....
</key>
<tls-crypt>
...
</tls-crypt>
我需要客户端在连接到 VPN 并进行诸如浏览互联网之类的操作时,保持流量通过其本地网络进行。
只有当它访问资源时192.168.15.x
才会使用 vpn。
我已经尝试过了https://community.openvpn.net/openvpn/wiki/IgnoreRedirectGateway但不起作用。
我的配置有什么错误?
答案1
解决了!
从服务器配置中删除此项:
push "redirect-gateway def1 bypass-dhcp"
添加这个:
push "route 192.168.15.0 255.255.255.0"
并从客户端配置中删除此项:
ignore-unknown-option block-outside-dns
block-outside-dns