Configuring Network CentOS 6

when you first install CentOS 6, you will notice some changes right away off the bat. From the looks of it, the Entire Kernel changed from 5.8, although there are a lot of similarities, you still have a lot to learn/discover on new CentOS.

When you first get loaded up and ready to go, one of the first things that you will notice is that there is no NIC configured. Bummer right? the only way to do this now is to configure it Via command line (fine for the guru’s, not so cool for average joe) this tutorial will walk you through basic networking configuration on a new CentOS 6.2 system

if you issue the command ifconfig -a you will see the list of network interfaces

as you can see, your interface “eth0” is there, but is just not yet configured, so we have to go through and configure the NIC.  issue the following command:

cd /etc/sysconfig/network-scripts/

then type the following command (will show list of NIC’s available): ls

you should see similar to the above configuration, type the next command to edit “eth0”

vi ifcfg-eth0

the above image should be the next screen. hit the “a” key to append to the current text file. Scroll to the bottom, and add the following information: 

basically add the ipaddress as to what you want the NIC to respond to, Subnet Mask, and the ONBOOT=yes makes it so the NIC starts when the machine does (don’t skip that step)

from there issue the following command:

ctrl + c

:wq

basically this saves and closes the document. (if you do not want to save changes type :quit) and then enter to end.

The next step is to configure the “network” part that basically consists of the Default Gateway and DNS

issue the following command:

vi /etc/sysconfig/network

from here hit the “a” key again to append to the document change the hostname, and Gateway (default gateway) to what it needs to be for your network

Before/After

and then issue the following command to save/quit

ctrl + c

:wq

From there, the last set of settings is setting up the DNS, to do so; issue the following command:

vi /etc/resolv.conf

this should be a blank file, add your DNS servers as necessary, for this example we will use google’s dns servers 8.8.8.8 and 8.8.4.4 (make sure to include the word nameserver in front of each DNS server)

Then again, issue the famous save/quit command:

ctrl + c

:wq

from there; there is one more command to issue to restart, and refresh the network connections:

service network restart

this is what a successful restart of the network connections would look like, restarts the loopback, and the eth0 adapter.

from there all you have to do is test that you are connected to the internet, to do so, issue the command:

ping -c 5 google.com

 

as you can see we are getting ping responses from google, we now have an outside internet connection.

in order for the hostname to show up properly, you must issue one more command for the name to carry over, the command is:

reboot

That’s It! I hope you enjoyed my walk-through, let me know if anything is missing!

if for any reason you do not, retry the above steps, and make sure that it is in line with the rest of your network topology, the ipaddress/netmask/gateway were all used as an example and you should set them according to your own network.

 

to get a hosted CentOS 6.2 Server visit www.zwiegnet.com

 

Leave a Reply