CentOS 6 - First Network Setup

As you may have noticed, a new CentOS 6 installation will not have network access by default. You can run the command setup (as you were used to from CentOS 5) but might end up with the response: command not found

What to do now?

You can try to locate setup by typing: which setup
If you are lucky you will find it (often in usr/sbin/setup) but you could also get the response: no setup in....

So the next option is to configure the network settings manually:

Step 1 check if eth0 exists

  1. [root@localhost ~]# ip a
  2. 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
  3. link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  4. inet 127.0.0.1/8 scope host lo
  5. inet6 ::1/128 scope host
  6. valid_lft forever preferred_lft forever
  7. 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
  8. link/ether 0e:bf:a9:b2:64:f2 brd ff:ff:ff:ff:ff:ff
  9. inet 192.168.111.129/24 brd 192.168.111.255 scope global eth0
  10. inet6 fe80::cbf:a9ff:feb2:64f2/64 scope link
  11. valid_lft forever preferred_lft forever
  12. [root@localhost ~]



Step 2 Since eth0 exists we need to check if the onboot option is set in /etc/sysconfig/network-scripts/
  1. [root@localhost /]# nano /etc/sysconfig/network-scripts/ifcfg-eth0



Look for the line ONBOOT and make sure it is set to yes.
  1. DEVICE="eth0"
  2. BOOTPROTO="static"
  3. BROADCAST="192.168.1.255"
  4. GATEWAY="192.168.1.254"
  5. HWADDR="0E:BF:A9:B2:64:F2"
  6. IPADDR="192.168.1.129"
  7. NETMASK="255.255.255.0"
  8. NM_CONTROLLED="yes"
  9. ONBOOT="yes" <------- this line
  10. TYPE="Ethernet"



Step 3 Check if your DNS is set by editing /etc/resolv.conf
  1. [root@localhost /]# nano /etc/resolv.conf



Make sure you have nameservers enabled here (remove the comment # if necessary).
  1. nameserver 127.0.0.1
  2. nameserver 192.168.1.1
  3. nameserver 192.168.1.2



Step 4 Restart your network service
  1. [root@localhost /]# service network restart
  2. Shutting down interface eth0: [ OK ]
  3. Bringing up interface eth0: [ OK ]
  4. [root@localhost /]#


That is it, you should be able to ping www.google.com now!

Reacties

Thanks a lot. FreePBX now sees the internet.