Home » manually configure network in OEL 7, CentOS 7
disable-NetworkManager-in-OEL7-and-manually-configure-Ethernet -featuredImage

manually configure network in OEL 7, CentOS 7

by mn.sobieh

When you install CentOS, RHEL, or OEL with graphical Interface, it comes with NetworkManager. The NetworkManager daemon maks networking configuration and operation easy and automatic as possible by managing network interfaces, either Ethernet, WiFi, or Mobile Broadband devices. Besides, NetworkManager provides a rich API to control network settings and operations. However, when configuring servers It’s preferable to have their networking settings to be consistent. therefore, This article explains how to disable NetworkManager, hence, configure the network and set IP ethernet manually.

The following steps are suitable for versions 6 and 7 of RHEL, OEL, and CentOS.

Firstly, Identify which card you want to configure by executing the ifconfig command with parameter -s to shortlist the output.

[root@s59 ~]# ifconfig -s
Iface    MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg 
eno1     1500  4596894    0   5617 0        41057    0      0      0 BMRU 
lo       65536     440    0      0 0        440      0      0      0 LRU 
virbr0   1500        0    0      0 0          0      0      0      0 BMU 
[root@s59 ~]#

manually configure network in OEL 7, CentOS 7 - ifconfig-s

In view of the output of our example, you can see  that the server has three network interfaces, as follow:

eno1 LAN Network interface
lo Loopback interface
virbr0 Wireless Network interface

In our case, LAN Interface eno1 is our target.

Disable NetworkManager

Firstly, Stop NetworkManager by stopping its service.

systemctl stop NetworkManager.service

Secondly, disable Network Manager using the following command.

systemctl disable NetworkManager.service

manually configure network setting.

Initially, navigate into the network configuration directory. then, edit the configuration file for the ethernet. For example, if the card name eno1 then the filename is ifcfg-eno1.

vi / etc/sysconfig/network-scripts/ifcfg-eno1

After that, add the following parameters in the file if they are not exist

ONBOOT=yes 
NM_CONTROLLED=no 
BOOTPROTO=none 
IPADDR=XXX.XXX.XXX.XXX
NETMASK=255.255.255.0
# you can use PREFIX=24 instead of NETMASK=255.255.255.0
GATEWAY=<GATE WAY IP XXX.XXX.XXX.XXX>
manually configure network in OEL 7, CentOS 7 - ifcfg-eno1

Optional you can add the following lines to force DNS on specific Card

 DNS1=<DNS IP XXX.XXX.XXX.XXX>                
 DNS2=<DNS IP XXX.XXX.XXX.XXX>

 

Manually configure DNS resolve file.

make sure it has a reliable DNS IPs, for example, google public DNS 8.8.8.8

 vi /etc/resolv.conf  
 nameserver 8.8.8.8
manually configure network in OEL 7, CentOS 7 - resolv

Finally, type :wq to save & exit the editor.

Restart network services

For version 6, use the service command.

# Service restart network

On RHEL 7 use systemD command, though, executing the above command will redirect to systemD command

# systemctl restart network.service

You may also like

Leave a Comment