How does an OpenVPN client know the public IP address of my server?
The server's address is written in the server specific user configuration file client.ovpn
. So after downloading client.ovpn
file, if you check the file you will see remote
directive snippets like:
remote openvpn.foobar.net 3194 udp
Here openvpn.foobar.net
is the remote server address, it can also be an IP address:
remote 1.2.3.4 3194 udp
Now, if you can still reach the remote server even after commenting out the remote
snippets from client.ovpn
, then it must be cached by the client.
I have tested this on my system and getting this error instead:
Options error: --nobind doesn't make sense unless used with --remote
Use --help for more information.
but as openvpn
client caches various parameters to have faster response, the response you got is presumably due to the caching.
Related videos on Youtube
eirik-ff
Updated on September 18, 2022Comments
-
eirik-ff over 1 year
First I thought it was in the
client.ovpn
underremote my-server-1 1194
. I had added both my local and public IP under there. However, when I commented out those lines, it still worked.Where does my client know the IP address of the server? Did it just "remember" from when I didn't had those lines commented out?
-
user4556274 almost 8 yearsYou are correct; the IP address of the server is specified in client.ovpn. By "still worked" do you mean that an existing connection stayed up (expected behaviour), or that you brought the VPN down and then initiated a new connection with the
remote
directive commented out (not expected, unless the config file you were editing was not the one openvpn was using). -
eirik-ff almost 8 yearsAlright, thanks. By "still worked", I meant that I could still connect after I had disconnected. However, I wasn't using OpenVPN in the command line, but rather a third party application. So it's possible that the software didn't reload the conf file after I modified it.
-
-
eirik-ff almost 8 yearsThanks. As I just said in my comment on the main post, it was probably that the software I was using to connect didn't reload the conf file before I tried to reconnect, and thus the public IP of my server was still in the file.
-
heemayl almost 8 years@Rinzwind In my case, no reloading was needed. Also what to reload from client side? This must be cached. Check my edits..
-
heemayl almost 8 years@eirik-ff There is no reloading involved in client side. Check my edits..