How to Setup network on centos 7

After installing Centos 7, You may not able to connect network in that machine. This will happen because Ethernet interfaces are not enabled by default.This guide will help you to setup network on centos 7 .
This guide contains network configuration steps both in GUI and command mode.

Setup network on centos 7

let’s start, Type “nmcli d” command in your terminal for quick identification of Ethernet cards installed in your machine.
Setup network on centos 7
Here we have 2 interfaces named “enp0s17” and “enp0s18” . it might be different in your case ( Eg: em1 or p4p1 ).

GUI Mode

Recommended for beginners
Step 1 » Type this command “nmtui” to open Network manager and press enter after choosing ” Edit a connection” ( Use TAB for choosing options ) .
Setup network on centos 7
Step 2 » Now you can see all network interfaces, choose one and click “Edit“.
Setup network on centos 7

» DHCP configuration

Step 3 » For DHCP,
1. Choose “Automatic” in IPv4 CONFIGURATION.
2. Choose Automatic Connect check box.
3. Press OK and quit Network manager.
Setup network on centos 7
Now Restart network service by typing below command.
systemctl restart network Now your server will get IP Address from DHCP .

» Static configuration

Step 4 » For manual IP address,
1. Choose “Manual” in IPv4 CONFIGURATION.
2. Add IP Address with Subnet , Gateway and DNS server ( Refer below image ).
3. Choose Automatic Connect check box.
4. Press OK and quit Network manager.
Setup network on centos 7
Now Restart network service by typing below command.
systemctl restart network That’s it, Interface will have static IP.

Command Mode

Step 1 » Network interface config files are located in /etc/sysconfig/network-scripts/ directory. Open ifcfg-enp0s17 file ( For interface enp0s17 ) and you can see the content like below.
[root@krizna ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s17
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s17
UUID=7f1aff2d-b154-4436-9497-e3a4dedddcef
ONBOOT=no
HWADDR=00:0C:29:A1:B5:D6
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

» DHCP configuration

Step 2 » For DHCP
Find the below lines in config File.
BOOTPROTO=none
ONBOOT=no
and replace with
BOOTPROTO=dhcp
ONBOOT=yes
Now Restart network service by typing below command.
systemctl restart network Now your server will get IP Address from DHCP

» Static configuration

Step 3 » For Static IP.
Find the below lines in config File.
BOOTPROTO=none
ONBOOT=no
and replace with
BOOTPROTO=static
ONBOOT=yes
And add the below lines at the end of the file.
IPADDR=172.27.0.32
NETMASK=255.255.255.0
GATEWAY=172.27.0.1
DNS1=172.27.0.5
File will look like below after changes.
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s17
UUID=f0c5b37d-299a-43cb-b74b-618bb252d129
ONBOOT=yes
HWADDR=00:0C:29:A1:B5:CC
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPADDR=192.168.1.10
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.5

Now Restart network service by typing below command.
systemctl restart networkNow Interface will have static IP.
Additionally you can use /etc/sysconfig/network file for hostname and DNS .
HOSTNAME=server.krizna.com
DNS1=192.168.1.5
DNS2=8.8.8.8
SEARCH=krizna.com

Have a nice day

Also See
Configure a static IP address on RHEL 8 and Centos 8 .
Setup network on ubuntu 18.04

3 Comments

  1. Let me share the brutal truth: the majority of HVAC failures occur because someone skipped a step. Did not calculate the load properly. Used undersized equipment. Miscalculated the insulation needs. We’ve fixed hundreds of these disasters. And every time, we record another lesson. Like in 2017, when we decided on adding smart thermostats to every install. Why? Because Sarah, our senior tech, got sick of watching homeowners waste money on bad temperature control. Now clients save hundreds yearly.
    https://www.callupcontact.com/b/businessprofile/Product_Air_Heating_Cooling_and_Electric/9904077

  2. I need to share with you something most septic companies won’t: there are two categories of people in this world. Those who think septic systems are merely “buried containers for waste,” and those that have had raw sewage erupting into their property at midnight. I discovered this distinction the difficult way in 2005—waist-deep in muck, shivering in a Washington deluge, as my siblings and I helped a grizzled installer restore our family’s failed system. I was 14. My hands blistered. My pants were wrecked. But that evening, something crystallized: This is not just manual labor. It’s people’s lives we are preserving.
    Let me share the ugly truth: the majority of septic companies just maintain tanks. They are like quick-fix salesmen at a disaster convention. But Septic Solutions? These guys are special. It all began back in the beginning of the 2000s when Art and his family—just kids hardly tall enough to carry a shovel—helped install their family’s septic system alongside a grizzled pro. Imagine this: three pre-teens knee-deep in Pennsylvania clay, understanding how soil permeability affects drainage while their friends played Xbox. “We never just dig holes,” Art shared with me last winter, hot coffee cup in hand. “We learned how soil whispers truths. A patch of marsh plants here? That’s Mother Nature screaming ‘high water table.'”

    https://www.wikiwicca.com/forums/topic/can-i-extend-the-life-of-my-drain-field/

  3. This is the harsh truth: nearly all HVAC failures take place because someone skipped a step. Didn’t calculate the load accurately. Used cheap equipment. Got wrong the insulation needs. We’ve personally fixed dozens of these disasters. And every time, we record another insight. Like in 2017, when we started adding remote monitoring to all install. Why? Because Sarah, our senior tech, got sick of watching homeowners lose money on bad temperature management. Now clients save 20-30% yearly.
    https://www.manta.com/c/m1x5288/product-air-heating

Leave a Reply

Your email address will not be published.


*