How to Assign Static IP Address on CentOS 7

When provisioning a server, it’s usually a good practice to assign static IP addresses. I have provisioned a CentOS 7 and ran yum update -y to update the default packages.

Checking Your Current IP Address

I have logged in to the console as root so that I can check the current IP address. Enter the following command.

# ip addr

You can see that this machine has This IP address was obtained from the DHCP server. I’m going to give it Fortunately, CentOS 7 comes with an utility to make it easier for us to assign a static IP address.

Assign a Static IP Address

Enter nmtui in your terminal.

# nmtui

You will see a UI like the image below.

Hit Enter key and you will see one or more network interface for you to configure. Select the network interface and hit Enter key.

Navigate to <Show> for IPv4 and hit Enter key. And then change Automatic to Manual.

Now navigate your cursor to Addresses <Add…> and hit enter.

Add for the static IP address (it depends on your environment), for its gateway and we will use OpenDNS ( for DNS servers. Navigate your cursor to OK at the lower right corner of the screen and hit Enter key.

Restart network daemon by entering the following command.

# systemctl restart network

At this point, the terminal might look frozen because the OS’s IP address has changed to a different one if you SSH’ed into it. Check the IP address again by entering ip addr on it. You now should see the new static IP address you just configured.

Leave a Reply

Your email address will not be published.