When first installing CentOS 6.4 on most systems, you’ll need to configure DHCP to obtain an IPV4 IP address in order to connect to the network. This can be done by editing the network configs, you’ll need root access, so go ahead and switch users now:
[root@Development ~]# sudo -su
Lets check to see if networking is enabled:
[root@Development ~]# cat /etc/sysconfig/network |grep -i network
This should return NETWORKING=YES , if it does not, edit the file to make it say YES.
Lets get starting editing the config for eth0.
[root@Development ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
You’ll see something similar to this:
DEVICE="eth0" HWADDR="08:00:27:07:9e:57" NM_CONTROLLED="YES" ONBOOT="NO" [/bash] There are two options we want to change here: NM_CONTROLLED="NO" ONBOOT="YES"
Now add this to the bottom:
BOOTPROTO="dhcp"
This will allow you to grab an IP from your DHCP and essentially enable IPV4.
The whole file should now look like this:
DEVICE="eth0" HWADDR="08:00:27:07:9e:57" NM_CONTROLLED="NO" ONBOOT="YES" BOOTPROTO="dhcp"
Save and close. Now, lets restart the network service to reload with these settings.
[root@Development ~]# service network restart Shutting down interface eth0: [ OK ] Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface eth0: Determining IP information for eth0... done. [ OK ]
Notice the ‘eth0′ – awesome! Now lets check to see if we got an IPV4 from our DHCP!
[root@Development ~]# ifconfig eth0 Link encap:Ethernet HWaddr 08:00:27:07:9E:57 inet addr:192.168.0.110 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe07:9e57/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:24485 errors:0 dropped:0 overruns:0 frame:0 TX packets:931 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2279234 (2.1 MiB) TX bytes:114720 (112.0 KiB) Interrupt:19 Base address:0xd020 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Sweet, we’re now up and running. That wasn’t so bad!