Questions? Feedback? powered by Olark live chat software
Knowledgebase
Author Avatar

NIC configuration on RedHat and CentOS

Written by: on 25 May 2017 12:23 PM 25 May 2017 12:23 PM

The article covers RedHat based operating systems

OS will have NIC config files as:

/etc/sysconfig/network-scripts/ifcfg-ethX

where X is the interface number.

Typical content of ifcfg-eth0 (usually it is a public NIC on the VPS):

DEVICE=eth0 
BOOTPROTO=none # no DHCP, static IP
ONBOOT=yes # bring it up on boot
NM_CONTROLLED=no # not controlled by NetworkManager
IPADDR=203.143.xx.yy
NETMASK=255.255.255.0
GATEWAY=203.143.xx.1
DNS1=aa.bb.cc.dd
DNS2=ee.ff.gg.hh
PEERDNS=yes # modify /etc/resolv.conf according to DNS1/2 settings
USERCTL=no

Typical content of ifcfg-eth1 (usually it is a private NIC on the VPS):

DEVICE=eth1 
BOOTPROTO=dhcp # DHCP metehod
ONBOOT=yes # bring it up on boot
NM_CONTROLLED=no # not controlled by NetworkManager
DEFROUTE=no # do not set default route here to avoid two default routes

 

Disabling NetworkManager:

service NetworkManager stop

if not using systemd:

chkconfig NetworkManager off

if using systemd:

systemctl disable NetworkManager

 

Enabling Network service:

if not using systemd:

chkconfig network on

if using systemd:

systemctl enable network
(0 vote(s))
Helpful
Not helpful