我使用 pivpn 访问具有特定服务的专用网络。这个网络有一个 DNS 和很多规则不允许一些简单的网站,如 youtube 或谷歌。由于 pivpn 默认情况下处于完全隧道状态,因此我的所有流量都通过我的 vpn 网络,我无法做诸如观看 youtube 视频或进行一些谷歌搜索之类的事情。我只想通过 vpn 路由我的 vpn 连接,让所有其他操作通过客户端网络。如何启用这种拆分隧道?
这是我的/etc/openvpn/server.conf
dev tun
proto tcp
port X
ca /etc/openvpn/easy-rsa/pki/ca.crt
cert /etc/openvpn/easy-rsa/pki/issued/VPN_28154d4a-2d8f-42b8-b083-a16948349746.crt
key /etc/openvpn/easy-rsa/pki/private/VPN_28154d4a-2d8f-42b8-b083-a16948349746.key
dh none
ecdh-curve secp521r1
topology subnet
server X.X.X.X 255.255.255.0
# Set your primary domain name server address for clients
push "dhcp-option xxxx.com"
push "dhcp-option DNS X.X.X.X"
push "block-outside-dns"
# Override the Client default gateway by using 0.0.0.0/1 and
# 128.0.0.0/1 rather than 0.0.0.0/0. This has the benefit of
# overriding but not wiping out the original default gateway.
push "redirect-gateway def1"
client-to-client
client-config-dir /etc/openvpn/ccd
keepalive 15 120
remote-cert-tls client
tls-version-min 1.2
tls-crypt /etc/openvpn/easy-rsa/pki/ta.key
cipher AES-256-CBC
auth SHA256
user openvpn
group openvpn
persist-key
persist-tun
crl-verify /etc/openvpn/crl.pem
status /var/log/openvpn-status.log 20
status-version 3
syslog
verb 3
#DuplicateCNs allow access control on a less-granular, per user basis.
#Remove # if you will manage access by user instead of device.
#duplicate-cn
# Generated for use by PiVPN.io
你知道我怎样才能做到这一点吗?
一切都通过 VPN 路由,因为您的配置要求:
删除“
redirect-gateway
”选项,OpenVPN 将返回到仅路由 VPN 自己的网络(即 XXXX/255.255.255.0 网络)的默认行为。如果个别客户端配置有此选项,请确保也将其从那里删除。进行更改后,您可以通过添加选项通过 VPN 路由特定的附加网络
route
,例如从服务器推送到所有客户端: