Knowledgebase
Knowledgebase
NIC configuration on RedHat and CentOS
Posted by Ilya Vasilenko on 15 November 2017 11:01 AM

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
 # 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 protocol
 # 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