openvpn-client
openvpn-client copied to clipboard
Can I route traffic from LAN to the vpn container?
I'm trying to use this docker image as a vpn tunnel for my home network. My router does not support vpn properly but I have an old PC which runs docker and this openvpn-client container inside it.
I have qbittorrent container connected to vpn container and it works flawlessly. However I was unable to route host traffic to vpn. Is there a way to do it?
I tried next with no success (traffic bypassed vpn and went directly to isp):
echo "2 connect" >> /etc/iproute2/rt_tables
ip rule add from 192.168.1.84/32 table connect
ip route add default via 172.18.0.2 table connect
iptables -A INPUT -s 192.168.1.84/32 -j ACCEPT
iptables -A FORWARD -d 192.168.1.84/32 -j ACCEPT
iptables -A FORWARD -s 192.168.1.84/32 -j ACCEPT
iptables -A OUTPUT -d 192.168.1.84/32 -j ACCEPT
All commands ran at host. 192.168.1.84 is the lan IP which should go to the Internet through the vpn. 172.18.0.2 is openvpn-client container's ip (obtained from docker inspect)
Did you manage to set this up?