3 Easy Steps to Configure a Static IP Address in Ubuntu Server 18.04

3 Easy Steps to Configure a Static IP Address in Ubuntu Server 18.04

Although dynamic IP addresses can be easier to obtain, you may want to set up a static IP address if you want to host your own servers, use your computer as a home server, or just like the simplicity of having the same address every time you connect to the internet. Luckily, setting up a static IP address in Ubuntu Server 18.04 is quite easy! This guide will walk you through all of the steps to configure your Ubuntu Server 18.04 with a static IP address in just 3 easy steps!

Step 1: Open the terminal

The first step is to open the terminal. You can do this by pressing Ctrl+Alt+T on your keyboard or by searching for Terminal in the app launcher. Once the terminal is open, you’ll need to gain access to the root user account. You can do this by typing sudo su and entering your password when prompted. Now that you’re logged in as the root user, type ip addr show and press Enter. There will be a list of network interfaces with names like enp0s8.

Once you’ve found the name of your network interface (for example enp0s8), type ip addr add followed by an address like (or whatever subnet mask) and press Enter again. Then type netmask and press Enter one more time. Finally, enter broadcast and hit Enter once more to finish configuring your static IP address on Ubuntu Server 18.04! Remember that you can also edit these settings if necessary. If at any point you want to restore the system’s default settings, just enter the command ip addr flush dev interface-name where interface-name is the name of your network interface without quotes.

Step 2: run sudo nano /etc/network/interfaces

Now that you know what IP address, netmask, and gateway you want to use, you can tell the network interface what to do with that information. In this file, you will also need to specify the name of the network interface. You can find this information by running the command sudo ifconfig.

We will be using the nano text editor in this guide, but feel free to use whichever editor you are most comfortable with. On the line with allow-hotplug eth0, add a space followed by iface eth0 inet static. Next, insert your new IP address below it. If you wanted to keep the same netmask as well, just type in the numbers at the end of your address.

For example: would become if no other changes were made after specifying an IP address, or 192./32 if a subnet was specified (eipx). To complete this step, hit CTRL+X then Y then ENTER to save and exit from nano text editor . Next, run sudo service networking restart to apply these changes. Finally, run sudo route -n ADD default gw dev eth0 && sudo route -n ADD 2000::/3 gw 2001:4a8:4400::2 dev eth0 && \

The server’s IPv4 address is now set and ready for use!

Step 3: Scroll down, change the last line from auto eth0 iface eth0 inet dhcp

The next step is to change the last line from auto eth0 iface eth0 inet dhcp. This will ensure that your server will always have the same IP address. To do this, simply scroll down to the bottom of the file and change the last line to iface eth0 inet static. Save and close the file when you are finished.

Now we need to restart our network service so that it recognizes the changes. From a terminal window, type sudo service networking restart and press enter. You should now be able to log into your server using its new static IP address! If you would like to view your new configuration, use ip addr show and press enter. Your output should look something like this: root@ubuntu:/home/vagrant# ip addr show

eth0 brd scope global dynamic eth1 brd 169.254.255.

Leave a Reply

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