How To Centos 7 Network Settings

First, let’s list the interfaces and see detailed information about their status. For this;

Run the nmcli d command.

I have 1 interface’  eno and it seems that it is not connected, as the picture below shows,

Then let’s start the process quickly. First, you need to use an editor command for interface settings. I’ll use the vi command in the default, my advice is vi, but you can use different editor commands. Of course, you can use those commands after installing and integrating them.

> vi / etc / sysconfig / network-scripts /'The name of your interface file' then press enter. If you do not know the name of the interface, you can learn it with the tab key. As the following example,

Then add the following commands to the opened file after pressing insert.

> = Static BOOTPROTO

ONBOOT = yes

IPADDR = IP address of the subnet you will use on the machine ’

NETMASK = net the netmask address of the ip address you provided ’

GATEWAY = ’gateway ip address of subnet’

We are talking about Static structure above if you are going to work through DHCP, just enter the following commands.



Anyway, after adding commands, press the last ESC key, press ‘: x’ enter key and save and exit. As shown in the figure below.

Then restart the service by running the following command.

>systemctl restart network

Now let’s enter the DNS addresses.
This could be done by entering DNS addresses in the interface file above. This first method

>DNS1=’DNS IP address’

>DNS2=’DNS IP address’

Second method

> vi / etc / sysconfig / network You can do this by entering the records into the file.

> HOSTNAME = CentOS7.domainname (if the machine will run in a domain, you can enter the .domainname after the machine name.)

> DNS1 = ’dns ip address’

> DNS2 = ’dns ip address’

> SEARCH = Domain (you can enter the .domainname if the machine will run in a domain)

Third method, I’ll use it

> vi /etc/resolv.conf Enter the following records after pressing enter.



Then ping any domain to make sure all your settings are correct and to see if DNS decodes the name.

Then run the first command at the beginning of the topic again and see if it is connected.

> Run the nmcli d command.

I hope it has been a useful article.