How one can configure a CentOS eight static community handle from the command line

Every CentOS administrator should know easy methods to configure a static IP handle utilizing solely the terminal.

How one can configure a CentOS eight static community handle from the command line
Every CentOS administrator should know easy methods to configure a static IP handle utilizing solely the terminal.

CentOS eight is right here and is filled with new options and enhancements. One function that has not modified a lot is the configuration of a static community handle. Though Ubuntu has migrated to the significantly better netplan instrument, CentOS nonetheless makes use of the old-school methodology.

For those who have no idea easy methods to manually configure a community handle from DHCP to static, I'll present you the way.

SEE: Job Package: Community Administrator (TechRepublic Premium)

What you have to

All you have to to do that job is:

An occasion working CentOS 8An IP handle obtainable
A person with sudo privileges

How one can find the identify of the gadget

The very first thing to do is to find the identify of the gadget to configure. Do that with the command:

ip a

This could reveal the identify of your community interface (Determine a).

Determine a

My interface identify is enp0s3.

How one can again up your configuration file

Then we are going to save the unique configuration file with the command:

sudo mv /and many others/sysconfig/network-scripts/ifcfg-NAME/and many others/sysconfig/network-scripts/ifcfg-NAME.bak

The place NAME is the identify of your community interface.

How one can create a brand new configuration

Now we create a brand new configuration file with the next command:

sudo nano / and many others / sysconfig / network-scripts / ifcfg-NAME

The place NAME is the identify of your community interface.

On this file, paste the next:

TYPE = "Ethernet"
BOOTPROTO = "none"
NAME = "NAME"
IPADDR = "IP_ADDRESS"
NETMASK = "255.255.255.zero"
GATEWAY = GATEWAY
DEVICE = "NAME"
ONBOOT = "sure"
PEERDNS = no

Or:

NAME is the identify of the community interfaceIP_ADDRESS is the static IP handle that you just wish to apply to the interface.
GATEWAY is the gateway handle of your community.

Save and shut the file.

Restart the community supervisor with the command:

sudo systemctl restart NetworkManager

Your static IP handle has been utilized

How one can configure DNS servers

Since we use a static IP handle, we may additionally use static addresses for DNS decision (which is why we added PEERDNS = no to the configuration file). To configure the DNS servers, challenge the command:

sudo nano /and many others/resolv.conf

On this file, add your static DNS addresses below the final line as follows:

identify server eight.eight.four.four,eight.eight.eight.eight

Save and shut the file.

And that's all it takes to arrange a static IP handle in CentOS eight.

Open Supply Weekly Information Letter

You’ll not wish to miss our suggestions, tutorials and feedback on the Linux working system and open supply functions.
Delivered on Tuesday

Enroll as we speak

Enroll as we speak

Look additionally

Picture: CentOS

Leave a Reply

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