docker-openvpn
docker-openvpn copied to clipboard
Is it possible to change the server's subnet by editing the `openvpn.conf`?
Here is my situation.
- I ran this command to generate the server configurtation:
docker run --rm \
-v $OVPN_DATA_DIR_TEST_0:/etc/openvpn \
kylemanna/openvpn ovpn_genconfig \
-u udp://www.mydomain.com \
-s 10.95.0.0/16 \
-n 8.8.8.8 \
-n 8.8.4.4 \
-n {myDns1} \
-n {myDns2} \
-p "route 172.18.0.0 255.255.0.0"
-
Then, I recognized that I mistyped the subnet argument
-s 10.95.0.0/16
, which is already occupied with another existing OpenVPN server. I should type something like-s 10.99.0.0/16
, instead of-s 10.95.0.0/16
. Therefore I edited theopenvpn.conf
file, fromserver 10.95.0.0 255.255.0.0
toserver 10.91.0.0 255.255.0.0
to change the server's subnet scope and restarted this container. -
Client can connect to VPN server. Client can ping to server(10.95.0.1), and server can ping to client either. (also connection log can be found via
docker logs
) But the client cannot use the internet.
I scrutinized every part of the problem that could arise, like routing tables for both host and container, my custom docker network which is still working well with other OpenVPN container, DNS test, and so on. I'm already running a several OpenVPN container in this single host for more than a year, and I think that there is no problem with setting or configuration in host OS or docker.
I strongly suspect that it is caused by a typo in the subnet when executing the ovpn_genconfig
command, and that this is not reflected by modifying the openvpn.conf
file.
Because when I re-entered the ovpn_genconfig
command without a typo after everything was cleaned up, it all worked as expected.
If anyone knows about this, please let me know if my assumption is correct or not.
Maybe this can help
Had the same problem after trying to change the subnet on the openvpn.conf file
Rerunning the ovpn_genconfig
script solved it for me aswell. Thank you :+1: