Wireguard Container + Server
SawToday at 9:18 AM
Evening, maybe someone can help me. I am really not a network professional. I installed the Wireguard container on my rootserver, and on my server here in my own lan. The connection works too, but I can't get the route right, so the docker host can access the lan of the VPN.
OxyTJToday at 9:25 AM
@Saw what I had to do for this issue is first run the following to get your subnet:
ip route | awk '!/ (docker0|br-)/ && /src/ {print $1}'
After connecting the VPN, I run the following to add the routes, where SUBNET is the ip you got from the previous command:
ip route add ${SUBNET} via $(ip route | grep default | awk '{print $3}')
iptables -A FORWARD -s ${SUBNET} -j ACCEPT
iptables -A FORWARD -d ${SUBNET} -j ACCEPT
iptables -A INPUT -s ${SUBNET} -j ACCEPT
iptables -A OUTPUT -d ${SUBNET} -j ACCEPT
Lastly, make sure your exposed ports for other containers are forwarded in the VPN container.
One thing to note, in case you have the same problem, it appears the INPUT and OUTPUT get wiped from the iptables every so often, or whenever the VPN connects. In case you have the same.
No Comments