CentOS IP Address Not Detected On VirtualBox – How To Fix?

Recently i installed Centos 6.4 on my Virtualbox and the network card doesn’t start automatically at first boot. My network card IP details doesn’t show up. Have you got the same problem just like mine? If yes, don’t worry. You’re on the right track. Here is the quick steps about how do i enable it on every reboot?

#ifconfig 
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)

As you see in the above output, my server network card doesn’t found.

To resolve this:

Edit /etc/sysconfig/network-scripts/ifcfg-eth0 file,

and change ONBOOT=no to ONBOOT=yes.

For Dynamic IP:

DEVICE=eth0
HWADDR=08:00:27:3F:95:CF
TYPE=Ethernet
UUID=84331ed6-f36d-44a0-978e-b3ca381b234f
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp

For Static IP:

DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
NM_CONTROLLED=no
HWADDR=08:00:27:3F:95:CF
IPADDR=10.1.1.219
NETMASK=255.255.255.0
GATEWAY=10.1.1.1

Edit the /etc/resolve.conf file and add the DNS details.

##google nameservers 
nameserver 8.8.8.8 
nameserver 8.8.4.4

That’s it.Reboot and enjoy!

Check Network Card IP Details

# ifconfig 
eth0 Link encap:Ethernet HWaddr 08:00:27:3F:95:CF 
inet addr:10.1.1.219 Bcast:10.1.1.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe3f:95cf/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:22853 errors:0 dropped:0 overruns:0 frame:0
TX packets:458 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000 
RX bytes:2670599 (2.5 MiB) TX bytes:59792 (58.3 KiB)
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)
# ping yahoo.com
PING yahoo.com (98.139.183.24) 56(84) bytes of data.
64 bytes from ir2.fp.vip.bf1.yahoo.com (98.139.183.24): icmp_seq=1 ttl=46 time=102 ms
64 bytes from ir2.fp.vip.bf1.yahoo.com (98.139.183.24): icmp_seq=2 ttl=46 time=138 ms
64 bytes from ir2.fp.vip.bf1.yahoo.com (98.139.183.24): icmp_seq=3 ttl=46 time=102 ms^