How to configure network interfaces in CentOS

Network interface configuration files in CentOS, Fedora and other RHEL based Linux systems are located in /etc/sysconfig/network-scripts directory. It also contains the control scripts to enable or disable the interfaces.

For each network interface there is a corresponding configuration script which contains information specific to that particular interface. The interface configration file names are of the format ifcfg-<device name>. So ifcfg-eth0 will be the configuration file for network interface eth0, which is usually the first network interface card (NIC) in the system.

Network configuration files are updated when you make changes to the network using the Network Adminsitration Tool (system-config-network). Alternatively you can manually edit the configuration files for a NIC.

The most commonly used configuration parameters are :

DEVICE=<name>

<name> is the name of the device

BOOTPROTO=<protocol>

<protocol> can be none, bootp or dhcp

BROADCAST=<address>

<address> is the broadcast address

GATEWAY=<address>

<address> is the gateway IP address

HWADDR=<MAC-address>

<MAC-address> is the hardware address of the NIC

IPADDR=<address>

<address> is a static IP address assigned to the NIC

NETMASK=<mask>

<mask> is the netmask value

ONBOOT=<value>

<value> is yes for device to be activated at boot time or no if the device should not be activated at boot time

USERCTL=<value>

<value> is yes to allow non-root users to control the device or no if non-root users are not allowed to control the device


Post a comment

Name

Your Comment

Email (We dont publish it)

Comments

Nothing yet..be the first to share wisdom.