:::: MENU ::::

CentOS: Configure network

This tutorial is intended for system administrators wanting to either change the IP address or add additional LAN cards (NIC) on their CentOS 5 system. There are a couple of ways to configure the network card using the command line but only some commands will take immediate effect on kernel. If you are doing this remotely remember that you will lose connectivity or if your configuration on your network is incorrect be unable to connect.

Configure network with immediate effect

Using a single command line to configure the network

[or]

Configure network with setup or netconfig

If you are using netconfig (or) setup utility it will only overwrite the /etc/sysconfig/network-scripts/ifcfg-eth0 file. Then , after that u have to restart the network service like follow,

Network configuration -> Edit Devices -> eth0 (eth0) – Intel Corporation 82540EM Gigabit Ethernet Controller

Save your settings and quit

[or]

Edit Devices -> eth0 (eth0) – Intel Corporation 82540EM Gigabit Ethernet Controller

Save your settings and quit

Restart your network in order for your configuration to take effect.

Configure network by editing configuration

Lastly you can configure the network by editing the configuration files stored in the /etc/sysconfig/network-scripts/ directory.

Append/modify as follows:

Save and close the file. Define default gateway and hostname in /etc/sysconfig/network configuration file

Append/modify configuration as follows:

Save and close the file. Restart networking: