Centos Logo

Centos Network Configuration – on a Barebones from Command Line

Centos LogoCentos Network Configuration – is very simple on a full installation. However, I downloaded the Centos’ “Minimal Install” cd and used yum to install various packages I needed.

The simple way to do it if you have a standard installation is to use the Network Administration
Tool (system-config-network), which is a graphical interface to edit the configuration files. Since I haven’t installed this tool, I needed to edit the files manually.

How to Configure Network in Centos from Command Line:

A quick way to see if your interface works and if you can ping internal resources.
ifconfig eth0 192.168.0.2 netmask 255.255.255.0
Use your IP addresses.
Note that this is not persistent, at the first reboot, ot first network services restart this will be lost.

For a DHCP address assignment use:
ifdown eth0
dhclient eth0

To get a persistent centos network configuration use the following procedure:

Edit the network configuration file

vi /etc/sysconfig/network-scripts/ifcfg-eth0
Edit the configuration file so it contains your IP address configuration as follows:
DEVICE="eth0"
BOOTPROTO=none
HWADDR="00:00:00:00:00:00"
NM_CONTROLLED="yes"
ONBOOT="yes"
GATEWAY=192.168.0.1
NETMASK=255.255.255.0
IPADDR=192.168.0.2
PEERDNS=no
USERCTL=no

This configures your interface with the IP 192.168.0.2 and the netmask 255.255.255.0.
For more info about Centos’ network configuration look here: .

Set up Name Resolution

Name resolution configuration, is more consistent across various Linux distributions. Most of the Linux distros will have the configuration file at /etc/resolv.conf.
Edit this file and change according to your network:
vi /etc/resolv.conf
Modify the file so it contains pointers to your DNS servers like this:
nameserver 192.168.0.254
nameserver 192.168.0.253

Loading Facebook Comments ...

Leave a Reply

Your email address will not be published. Required fields are marked *

*