CentOS 8: Set Static IP Command Line

Sometimes you need to configure Linux with a static IP address, and when you don’t have the GUI, you wont be able to configure IP address in Linux graphically. I was in this particular situation since my CentOS 8 Minimal Installation was pulling IP addresses from DHCP. This was causing the IP address to change and I needed it to stay the same. As such, time to to configure static IP address via command line.

After reading this post, you will be able to configure CentOS with a Static IP using the nmcli command line utility. I’ve also provided links to alternative methods:

Using nmcli To Set a Static IPv4 Address

In my case, I want to set a static IP on eth0. But first, I want to go ahead and change it to an address outside of my DHCP scope. Here’s how to change ip address using nmcli:

sudo nmcli connection modify eth0 IPv4.address 192.168.1.99/24

Add a Comment

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