Configuring an IP address on Linux

RSS

Configuring an IP address on Linux

Last updated June 27th, 2014

Configuring an IP address on a Linux is simple when using our 'Network Configuration' tool:

Network Config

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:

Network Config

Adding an IPv4 address

In the above images, we show a server with two IPv4 addresses assigned:

  • 192.168.11.80
  • 192.168.11.110

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:

ifup eth0:0

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:

  • fc00:192:168:11::99
  • fc00:192:168:11::98

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

For example:

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.

Next: Upgrading a server →

Can we improve this article? Suggest an improvement to this article.

Suggest an Improvement

Thank you for helping us to improve this Knowledge Base article. Please type your suggestions below:

Still need help? Get in touch with us.

If you aren't able to find the help you need then please send us a question and we can help you further.