Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to change the server's subnet by editing the openvpn.conf? #753

Open
darkasassin44 opened this issue Aug 1, 2023 · 2 comments

Comments

@darkasassin44
Copy link

Here is my situation.

  1. 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"
  1. 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 the openvpn.conf file, from server 10.95.0.0 255.255.0.0 to server 10.91.0.0 255.255.0.0 to change the server's subnet scope and restarted this container.

  2. 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.

@davoam
Copy link

davoam commented Aug 19, 2023

Maybe this can help

@AndreCostaaa
Copy link

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 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants