linux - 如何只允许 samba 通过 vpn 隧道?
问题描述
我已经设法使用 ufw 设置了 openvpn 服务器,一切似乎都可以正常工作,但我希望客户端在连接到 vpn 时仍能通过其本地网关浏览互联网。我只希望 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
*客户端.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
解决方案
push "redirect-gateway def1 bypass-dhcp"
从 server.conf 注释上面的行就可以了。
推荐阅读
- javascript - 如何在 Svelte 中从数组中删除对象后重新渲染视图?
- broadleaf-commerce - 为什么 Broadleaf 中有两个 OrderLockManager 实现?
- r - ggplot2中的线条和图例
- javascript - 使用打字稿进行条件渲染 -
- c# - 错误:“System.InvalidOperationException:无法找到所需的服务”。怎么修?
- javascript - 如何仅在自动完成材料 Ui 中显示搜索词?
- javascript - javascript中的私有字段是如何根据对象模型实现的?
- python - 读取 2 个 TXT 文件并解析文件
- javascript - 在Javascript / ReactNative中从数组中获取For of循环的值和索引的简单方法是什么?
- python-3.x - 许多条件应用于数据框列中的字符串,然后生成新列