Friday, May 18, 2012

Setting up the network for a CentOS-minimal install

Setting up a computer is always a journey...

I've been setting up a server that I plan to deploy a project I've been working on, Galah. Due to the seriously limited specs of the computer, I installed CentOS-minimal onto it (for those trying to do this with a USB, I really recommend just burning a CD, for those who don't listen to advice on the internet, send me a message somehow and I can help you through it, a very smart sysadmin showed me the way the other day). Getting a CentOS-minimal server to connect to your network however is very difficult. I will describe the tasks I went through in order to get it working.

First thing I faced was that my wired connection was being listed under /dev/p2p1 rather than eth0. This made things unduly difficult so I found a nice way to override this courtesy the author of this lovely blog post (if your wondering about the why the renaming was happening I recommend reading the post).

After that it's a matter of setting up your gateway and whatnot. You'll have to do this by writing to the network config files yourself (located at /etc/network and /etc/network-script). Your network will likely be different, but these are the steps I took to get it connected to my home router, I recommend glancing over them to get an idea of what you want to do.

  1. I set up my /etc/network file first by specifying my gateway and the DNS servers I wanted to use. Here is my configuration file:
    /etc/network
    NETWORKING=yes HOSTNAME=galah-zero GATEWAY=192.168.0.1 DNS1=68.190.192.35 DNS2=71.9.127
  2. I then deleted /etc/network/ifcfg-p2p1 and then set up ifcfg-eth0 with my desired network settings. Here is my configuration file:
    /etc/network-scripts/ifcfg-eth0
    DEVICE=eth0 ONBOOT=yes BOOTPROTO=static IPADDR=192.168.0.69
  3. Finally I restarted the network service (service network restart) and then I could successfully access the network and the internet (test this with ping. First try pinging your gateway, if you can do that your connected to your network. Then ping www.google.com or some other site, if this fails but you can ping your gateway your DNS isn't set up right, if this works you're all set).

As you can see, it's a little tedious to get the network up without all those nice tools were used to, but not too bad.

No comments:

Post a Comment