I have Windows OpenVPN server running at 10.8.0.1.
server.ovpn is:
server 10.8.0.0 255.255.255.0port 1194topology subnetproto udp4 dev tunca "C:\\Program Files\\OpenVPN\\config\\ca.crt"cert "C:\\Program Files\\OpenVPN\\config\\server.crt"key "C:\\Program Files\\OpenVPN\\config\\server.key"dh "C:\\Program Files\\OpenVPN\\config\\dh2048.pem"#for debug, allow same certs on all clientsduplicate-cnkeepalive 10 120cipher AES-256-GCMcomp-lzopersist-keypersist-tunverb 3explicit-exit-notify 1
I start WSL and inside WSL2 (Ubuntu) I run docker image via:
docker run --gpus all --privileged -p 1777:1777 -p 1778:1778 --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 -it --rm -v/mnt/d/data:/mnt nvcr.io/nvidia/pytorch:23.06-py3
Inside docker, I install network tools and OpenVPN via:
apt updateapt -y install net-toolsapt -y install netcatapt -y install iputils-pingapt -y install iproute2apt -y install iptablesapt -y install tracerouteapt -y install OpenVPN
Now I mount to /mnt
to and run
openvpn --config client.ovpn
client.ovpn is:
clientdev tunproto udp4remote a.b.c.d 1194resolv-retry infinitenobindpersist-keypersist-tunca ca.crtcert Client1.crtkey Client1.key remote-cert-tls servercipher AES-256-GCMcomp-lzoverb 3
(certificates are in the same directory as client.ovpn)
I think that connection is established since if I do ifconfig, I can see:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.15.1.1 netmask 255.255.255.0 broadcast 172.15.1.255 ether 02:42:ac:0f:01:01 txqueuelen 0 (Ethernet) RX packets 22289 bytes 30846027 (30.8 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 10953 bytes 734146 (734.1 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 loop txqueuelen 1000 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500 inet 10.8.0.2 netmask 255.255.255.0 destination 10.8.0.2 unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
However, when I do ping 10.8.0.1
(I have also tried ping -I tun0 10.8.0.1
) from within the docker, I cannot ping the server or any other connected client.Docker over eth0
can ping internet servers without any problem.
What am I missing? Note: I am no expert in networking or VPNs