如何只允许Samba通过VPN隧道?

时间:2019-03-02 13:48:01

标签: linux opensuse openvpn ufw

我已经成功地用ufw设置了openvpn服务器,一切似乎都可以正常工作,但是我希望客户端在连接到vpn时仍可以通过其本地网关浏览Internet。我只希望samba流量通过vpn。我怎样才能做到这一点?甚至有可能请帮助:(

我可以添加一些内容到client.conf中吗?

我的配置

* server.conf *

port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key  # This file should be kept secret
dh dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
push "dhcp-option DNS 1.1.1.1"
keepalive 10 120
tls-auth ta.key 0 # This file is secret
cipher AES-256-CBC
comp-lzo
max-clients 100
user nobody
group nobody
persist-key
persist-tun
status openvpn-status.log
log         /var/log/openvpn.log
log-append  /var/log/openvpn.log
verb 3
explicit-exit-notify 1

* client.conf *

client
dev tun
proto udp
remote vpn.server 1194
resolv-retry infinite
nobind
user nobody
group nobody
persist-key
persist-tun
remote-cert-tls server
tls-auth ta.key 1
cipher AES-256-CBC
comp-lzo
verb 3

1 个答案:

答案 0 :(得分:-1)

push "redirect-gateway def1 bypass-dhcp"

对server.conf中的上述行进行注释可以解决问题。