Logo

How to Configure Static IP Address on CentOS 7

Mar 30, 2024

To Configure a Static IP Address on CentOS 7:

Step 1 : Obtain the list of interface names and UUIDs.

nmcli con show

Step 2 : Modify the IP address.

sudo nmcli con modify enp0s3 ipv4.addresses 192.168.1.30/24

Step 3 : Set the gateway.

sudo nmcli con modify enp0s3 ipv4.gateway 192.168.1.1

Step 4 : Configure DNS servers.

sudo nmcli con modify enp0s3 ipv4.dns 8.8.8.8

Step 5 : Set the method to manual.

sudo nmcli con modify enp0s3 ipv4.method manual

Step 6 : Restart the network service.

sudo nmcli con down enp0s3 && sudo nmcli connection up enp0s3

Step 7 : Verify the configuration.

ip addr show

Congratulations! You have successfully configured a static IP address on CentOS 7.