OpenVPN helps in securing network data transfer. And, it depends largely on your network properties.
Network changes like switching internet providers often involves changing OpenVPN server IP address too. Unfortunately, wrong steps during IP change can even break the network.
That’s why, we often get queries from our customers in Managed VPN Services regarding modifying OpenVPN setup in the correct way.
Today, we’ll see how our Dedicated Engineers effectively change the OpenVPN server IP address without breaking the network.
When do we change OpenVPN server IP address?
Before we proceed further, let’s have a look at the typical scenarios in which there is a need to change OpenVPN server IP.
Recently, one of our customers was changing their backbone internet provider. And, he was left with new pubic IP address. As a result, he had to make a change to his OpenVPN server IP address.
Similarly, some customers prefer to have a specific IP address on their OpenVPN server. This may be due to factors like preferred network range, easy remembrance and so on.
How to change OpenVPN server IP address?
In OpenVPN, the change of server IP address is really critical and involves multiple steps. This can be done either from OpenVPN admin panel or from the command line.
Now, let’s take a look on how our Support Engineers change the OpenVPN server IP.
1. From command-line
To change the OpenVPN server IP, our Dedicated Engineers modify the OpenVPN server configuration file at /etc/openvpn/server.conf
There will be an entry “local x.x.x.x
” that specifies the IP on which the VPN server should listen. So we have to change this entry with the new IP address.
Before adding the new IP, we verify that the IP listens fine on the server. For this, we first check the IP address using:
ip addr | grep inet
Also to check if the port is ready, we check with
netstat -lpan | grep :1194
When there is no such directive, then the server will listen on all IPs of all interfaces.
Further, it requires modification in the client configuration xxx.ovpn file too. This should reflect in the entry
remote 18.xx.yy.105 1194
Here, the IP 18.xx.yy.105 is the new IP address of the server.
Further, to modify the range of IP addresses assigned by the VPN server, we edit the line.
server 10.6.0.0 255.255.255.0
We substitute it with the new IP address and its subnet mask.
Finally, we restart OpenVPN service on the server and that’s it.
In a more simple way, it will be ideal to reconfigure the VPN server and then reissue the client configuration using the openvpn-install.sh too.
2. From Web interface
At times, manual modification of the files can be tedious. That’s where the web-based interface helps.
Here, to change the OpenVPN server IP address, our Support Engineers first log in to the Appliance Management web interface. Then, we click on the “Network Tab” and then on “Address”. Further, we add new network properties.
In order for network settings changes to take effect, we reboot the server. When the server is running again, it will have the new OpenVPN server IP address.
Common errors with OpenVPN IP address change
Although the steps to change server IP looks pretty straight forward, we often find customers finding problems with it.
Now, let’s take a look at the common OpenVPN problems that our Support Engineers see.
1. OpenVPN still listening to old IP address
Recently, one of our customers reported that even after setting the new IP address and restarting, OpenVPN was still showing the old IP address.
Normally, this can happen when there are references to old IP in any of the OpenVPN configuration files. That’s why our Dedicated Engineers first checked and ensured that the new IP address is not overridden later in the configuration file.
Then to fix the problem, we had to execute OpenVPN restart commands in the following order.
/etc/init.d/openvpn restart
/etc/init.d/openvpn restart server
2. Problems with DNS
Again, DNS can cause problems with the VPN connection after server IP change. Some VPN providers allow clients to connect to a hostname instead of an IP address. Therefore, even when the OpenVPN server IP changes, there is no need for modification at the client-side.
But, if the OpenVPN server hostname do not resolve to the new IP address, it can create problems.
Here, our Support Engineers begin the investigation by checking the IP address to which the OpenVPN server resolves to. If there are DNS resolution issues, we suggest customers to correct it at their end.
Again, to avoid such DNS resolution problems, we always lower the DNS TTL value for the OpenVPN server hostname before switching the IP address.
[Need help in changing the OpenVPN server IP address? We are here to help you.]
Conclusion
In a nutshell, changing the OpenVPN server IP address involves a series of steps. Doing it in the right way can avoid OpenVPN configuration errors. Today, we saw the proper way to change OpenVPN server IP, common problems, and how our Support Engineers fix it.
Is there anyway we can add time to change automatically after 10 minutes or so?
Hello Muazam,
We’ll be happy to talk to you on chat (click on the icon at right-bottom).