This guide explains how to assign Ubuntu a static IP address using the command line, this should work on all versions of Ubuntu.
How to set Ubuntu static IP address
There are several ways you configure network setting on Ubuntu, the instructions below will work on all installs including those without a GUI.
To start off with let’s open the file that contains all the network interface information:
(if you need help with Vi, see LinuxMOZ’s Vi Commands Cheat Sheet)
If you on a default install of Ubuntu your network settings will be pulled via DHCP and your file will look similar to:
1 2 3 4 5 6 7 8 9 10
Comment the existing info out and add the following Ubuntu static IP address info so it looks like:
1 2 3 4 5 6 7
Obviously replace with your own network settings.
To ensure Ubuntu uses the static IP address restart the network to apply the changes:
I would also recommend removing the DHCP client:
If you have found this Ubuntu static IP address tutorial useful then please share using the buttons below.