CentOS eth0 Network config

Here is a short tutorial to configure the network interface under CentOS.

Here the network interface is called: eth0.

Configuring the ifcfg-eth0 file

vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE = eth0 ## Interface Name
BOOTPROTO = static ## Switch to static and non-DHCP mode
BROADCAST = 192.168.0.255 ## broadcast address
HWADDR = AA: BB: DC: DD: EE: FF ## MAC ADDRESS of the network card
IPADDR = 192.168.0.10 ## IP address of the machine
NETMASK = 255.255.255.0 ## Subnet Mask
NETWORK = 192.168.0.0 ## Network Address
ONBOOT = yes ## Mount interface to boot
NM_CONTROLLED = "no" ## No control via NetworkManager

General Network Settings

vi /etc/sysconfig/network
NETWORKING = yes ## Activate the network
NETWORKING_IPV6 = no ## Activate or not ipv6
HOSTNAME = serv centos ## The name of the machine
GATEWAY = 192.168.0.1 ## IP address of your gateway
Configure name servers (DNS)
vi /etc/resolv.conf

First I will indicate the serveur DNS local.

nameserver 192.168.0.100            ## l'ip du premier serveur de noms (mon serveur DNS local)
nameserver 8.8.8.8                  ## l'ip du serveur serveur de noms (serveur DNS google)

Application of changes

Service restart network

/etc/init.d/network restart 

It is also possible to uninstall NetwordManager, because in this case it is not necessary:

yum remove NetworkManager

Comments

comments

Leave a Reply