Configuring an IP address on Linux
Configuring an IP address on a Linux is simple when using our 'Network Configuration' tool:
Clicking this button will generate and display the necessary contents of each network configuration file that you will need to update on your Linux VPS. Please note that any custom configurations that may be in place will not be included in here:
Adding an IPv4 address
In the above images, we show a server with two IPv4 addresses assigned:
To configure the second IPv4 address (192.168.11.110) on this server, we can copy the following lines from the 'Network Configuration' tool to the /etc/network/interfaces file:
auto eth0:0 iface eth0:0 inet static address 192.168.11.110 netmask 255.255.255.0
Once these lines are in place, save the changes to the file and issue the following command:
At this point, our second IPv4 address should now be successfully configured and ready to go.
Adding an IPv6 address
In the above images, we show a server with two IPv6 addresses assigned:
To configure the second IPv6 address (fc00:192:168:11::98) on this server, we will require three pieces of information from our 'Network Configuration' tool:
- The IPv6 address we would like to configure: fc00:192:168:11::98
- The netmask/prefix length: 64
- The gateway address: fc00:192:168:11::1
We can then issue the following commands, substituting in the appropriate values:
ip -6 addr add [address]/[prefix] dev eth0 ip -6 route add default via [gateway] dev eth0
ip -6 addr add fc00:192:168:11::98/64 dev eth0 ip -6 route add default via fc00:192:168:11::1 dev eth0
At this point, our second IPv6 address should now be successfully configured and ready to go.
Do I need to reboot my server for changes to take place?
Your changes made to IP addresses should start working immediately, without needing to reboot, after performing the above tasks.
However, if you have added an IP address via the Control Panel, and have not yet rebooted your server, it is extremely important that your next reboot is done via the Control Panel, not via the command line.
For this reason you may decide to perform a reboot via the Control panel, immediately after adding an IP address. Future reboots can then be performed via the command line, and your new IP will continue to work.