We will only describe the process here for the Ubuntu operating system, as that is the operating system that we have been using for years to distribute our HyperV, ESXi, Amazon AWS, and Azure appliances on. If you have another operating system you can look online how to configure things exactly. We also assume that you do not use the Ubuntu program NetworkManager. If you do, and you have a GUI on your server, you may want to instead do it via the GUI. But if you have a headless server running on a physical server, or on HyperV, ESXi, and so on, you can use this guide to set a static IP address. The process is relatively straightforward, there is a text file that contains the configuration for your network interfaces. Adjust it to look like the sample below and adjust the addresses to match your network and your desired static IP. We assume an IPv4 address because at the moment this documentation section was written the Access Server only supported incoming OpenVPN tunnel connections on IPv4.
Messing with the network interface settings could mean you lose network access to this system if you make a mistake. So be aware of this and either beforehand make a backup of your Access Server settings or make a snapshot if possible in your hypervisor, or see if can get access to the (virtual) console to make corrections afterwards. It is also important to note that if you have a DHCP server in your network you can also choose to use the DHCP reservation option there (if present) to always assign the same DHCP IP address to this server. But not all DHCP servers have this option. In such a case you can do a static IP address assignment in the Linux server operating system itself with the instructions below, but please then do not configure the static IP to one inside of the DHCP range, but outside of it. Otherwise the DHCP server may consider the IP address you have chosen for your server suitable for assignment to a DHCP client, and that can cause an IP address conflict. Some networks have no DHCP server at all, and in that case you can pick any free IP you want with the instructions below.
Open the file /etc/network/interfaces in the nano text editor:
Example contents of the interfaces file:
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto ens192 iface ens192 inet static address 192.168.70.2 netmask 255.255.255.0 network 192.168.70.0 broadcast 192.168.70.255 gateway 192.168.70.254 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 192.168.70.254
Press ctrl+x, then press y, and then press enter, to save and exit the file. You should reboot to allow the changes to take effect.
In the example above, the IP address is set to 192.168.70.2 and it is in the 192.168.70.0/24 network with an Internet gateway and DNS server at 192.168.70.254. In some situations if the DNS server needs to be changed and you have things set statically you'll need to edit /etc/resolv.conf and update it to have the correct DNS server. Without a working DNS server you'll be able to ping IP addresses like 18.104.22.168 on the Internet, but not be able to resolve and ping addresses like www.openvpn.net. In the resolv.conf file you can fix that. Another important thing to note here is that in our situation shown above we have only one network interface and it is called ens192. If it is called something else in your system, obviously make allowances for this and adjust things as necessary.
If you have successfully changed the IP address, and you can gain access via SSH to the server, but the Access Server web services are not responding, it is possible you had your Access Server configured to listen to a very specific IP address, and if you have changed this, then the Access Server web services won't start. We have a guide to reset the web services and daemon ports here to resolve that issue.