问题原文
原帖链接 · Michal Tokarz · CC BY-SA 4.0
I have the following structure:
What I'd like to achieve is essentially route ALL traffic from laptop clients (and any possible future client) through MacOS OpenVPN client in internal network.
I know the easiest thing would be to run OpenVPN server on MacOS internal server however it is behind proxy and firewall and can't be accessed from the outside (ssh tunneling is not an option in my case) - this is why I have such a strange structure.
How clients and server should be configured to achieve this?
社区高分解答
原帖链接 · bocian85 · CC BY-SA 3.0
it is possible to route a subnet that is accessible only via another openVPN client using ccd scripts
For example in your case, you would have to add on your AWS server configuration resembling this
Let's assume that 10.80.0.1 is the IP of your AWS VPN Gateway (The VPN address, not external IP), and 10.0.2.0/24 is the subnet that you wish to route via MacOS server
in file /etc/openvpn/ccd/macos_vpn_commonname
iroute 10.0.2.0 255.255.255.0
push "route 10.0.2.0 255.255.255.0 10.80.0.1"
route 10.0.2.0 255.255.255.0 10.80.0.1"
You also need a line In your OpenVPN server main config file on the AWS server
client-config-dir /etc/openvpn/ccd
What it does it tells OpenVPN server upon the macos_vpn_commonname client connection, that the subnet 10.0.2.0 /24 is reachable via that client and enables routing via that tunnel. As far as I was testing there is no other way to do it, even manually routing the traffic via previously created tunnel will not work.
That would cover routing the subnet through a MacOS server.
If you need to redirect ALL traffic through it then let me know and I will try to help you further using iprule / iproute on the AWS OpenVPN server and redirect-gateway directive, as I'm not sure if OpenVPN is prepared for such scenario with internal mechanisms.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
