大网数据广告活动
服务器运维问答

Machine connected to a vpn not reachable anymore from the outside

· 52CE 我爱测

My raspberry is connected to my lan network 192.168.1.0/24 and it has a static ip. From the outside I can reach it by opening some ports on the ISP router. I have installed an openvpn client on it which creates a tun0 network on …

问题原文

原帖链接 · mariuccio · CC BY-SA 4.0

My raspberry is connected to my lan network 192.168.1.0/24 and it has a static ip. From the outside I can reach it by opening some ports on the ISP router. I have installed an openvpn client on it which creates a tun0 network on 10.8.8.0/24. When the raspberry is connected to the vpn of course I cannot reach it anymore from the outside. How can I reroute the traffic on the local network, so that even if the VPN is connected I can still reach it from the outside?

Thanks a lot in advance

已采纳解答

原帖链接 · RalfFriedl · CC BY-SA 4.0

What you need is policy based routing. Basically, you want answers to packets from outside to go directly back and not to the VPN.

ip rule add from 192.168.1.0/24 table 200
ip route add 192.168.1.0/24 dev eth0 table 200
ip route add default via 192.168.1.1 table 200

This assumes that eth0 is the name of your interface and 192.168.1.1 is the address of your router.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-09-27)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。