Easy way to add DNS server to Centos 6

Table of Contents

The minimal install of Centos 6.2 is exactly that. Very minimal while this is good for appliances if you dont know your way around linux and vi it could be a bit hard to get a network connection going.

Here are a few tips i have picked up.

Setup a IP address on a nic

ifconfig eth0 netmask up
this will add a default gateway
route add default gw
These settings will be removed from the server on reboot. 
Run this to make the nic come up on boot automatically.
# cd /etc/sysconfig/network-scripts/ 
# sed -i -e 's@^ONBOOT="no@ONBOOT="yes@' ifcfg-eth0

To put a dns server in try

echo “nameserver” > /etc/resolv.conf

This adds the google dns server to the resolv.conf file and your ready to go.

If you want to use a GUI to setup a perminate IP address try

yum install system-config-network-tui

then system-config-network-tui