Switch to Static IP Address on Ubuntu 17.04 / 17.10

This brief tutorial shows students and new users how to configure static IP addresses on Ubuntu 17.04 / 17.10 servers or desktop computers. When installing Ubuntu, the default network setting is to configure the server or desktop to obtain its IP addresses via DHCP discover.

If you don’t configure alternative network settings during Ubuntu installation, the Ubuntu machine will continue to get its IPs via DHCP server provided there’s one on the network distributing IP addresses.

If you decide to change the server network from DHCP to static settings after installing, continue with the steps below to accomplish that.

Step 1: Change from DHCP to Static via Commandline

There are primarily two ways to change Ubuntu network settings. One is via the command line terminal and the other is using the desktop GUI with mouse clicks.

The command line options is mostly used in environments where there are no desktop interfaces, like servers.

To change Ubuntu network settings from dhcp to static via the command line interface, run the commands below to open the network interfaces configuration file.

sudo nano /etc/network/interfaces

The file should look similar to the one below:

# 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 ens33
iface ens33 inet dhcp

The ens33 is the interface name.. however, it should be different on other systems. If you have more than one interfaces, they should be under the line the reads The primary network interface

To switch to static IP address, make the change to look like the one below:

Step 2: Update Primary Network Interface to Static

To change to a static IP address, make the highlighted changes below

# 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 ens33
iface ens33 inet static
address 192.168.0.2
netmask 255.255.255.0
network 192.168.0.0
broadcst 192.168.0.255
gateway 192.168.0.1
dns-nameservers 192.168.0.3

Replace the addresses with those that correspond with your network. Entering the wrong addresses may disable your system from the network.

Save the file and reboot the server, and then you’re done.

Step 3: Changing to static IP Address on Ubuntu Desktop

To change to static IP address on Ubuntu desktop, logon and select the network interface icon and click Wired settings.

ubuntu static ip

 

When the network setting panel opens, on the Wired connection, click the settings options button.

ubuntu static ip desktop

Change the wired IPv4 Method to Manual. Then type the IP address, subnet mask and gateway. Don’t forget the DNS server addresses as well.

ubuntu desktop static ip

When you’re done, click Apply.

Setting Static IP on Ubuntu 17.10 Servers

On Ubuntu 17.10, there’s a new way to set static IPs.. Read the post below to find out.

Configuring Static IP Addresses on Ubuntu 17.10 Servers

That’s it!

Summary:

This post shows students and new users how to change Ubuntu server and desktop from DHCP to static IP addresses. It can be applied to other version of Ubuntu.

Make sure the IP information you enter is correct or your system may not be able to access the network.

Enjoy!

4 Comments

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.