Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I just started using the VirtualBox, but I don't seem to have any internet on the CentOS when I type yum update. Is there a solution to my problem? (it could possibly be a problem with misconfigured VirtualBox)

Here is an output of ifconfig.

Image

share|improve this question
    
What is the output of your ifconfig? –  Tillman32 Jun 23 '13 at 22:07
    
puu.sh/3mHVp.jpg –  Vlad Bondarenko Jun 23 '13 at 22:10
    
Yeah, you have no eth0 - just the loop back. I think I have the answer for you. –  Tillman32 Jun 23 '13 at 22:11
    
I have just installed it, it's 100% clean. Maybe I need to configure my VirtualBox? –  Vlad Bondarenko Jun 23 '13 at 22:12
    
@user0000001 - Update your question with the screenshot and I will upvote this question. –  Ramhound Sep 26 '13 at 13:29

3 Answers 3

up vote 32 down vote accepted

Looks like your eth0 is not set up. Here is what I did to fix mine on CentOS 6.4.

sudo su -

cat /etc/sysconfig/network |grep -i network

This should return: NETWORKING=yes - If it does not, then change it to yes.

vi /etc/sysconfig/network-scripts/ifcfg-eth0

This should look like:

DEVICE="eth0"
HWADDR="08:00:27:07:9e:57"
NM_CONTROLLED="YES"
ONBOOT="NO"

There are a few options that we want to change here, NM_CONTROLLED needs to be NO, ONBOOT needs to be YES, and finally add this code at the bottom:

BOOTPROTO="dhcp"

This will allow you to grab an IP from your DHCP and essentially enable IPV4.

Now the whole file should 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:

ifconfig

You should now see 'eth0'.

share|improve this answer
    
About to try this. –  Vlad Bondarenko Jun 23 '13 at 22:18
    
Did you get it working? –  Tillman32 Jun 24 '13 at 22:17
    
Yes sir, it works like a charm. –  Vlad Bondarenko Jun 25 '13 at 0:34
2  
To me it looks like your virtual box VM is in a bridged mode ( attached to your hosts NIC ) and not getting it's own IP from your DHCP server. ( your router ) You tried to ping a 192.168.X.X address from a different subnet 10.X.X.X. Try to change your VMs NIC settings in virtualbox to NAT or independent. –  Tillman32 Feb 18 at 14:44
1  
This worked wonders for me when setting up CentOS in VirtualBox. –  Xerosigma Mar 10 at 19:48

When you're installing CentOS, on the networking page, there is a button at the bottom left that allows you to configure the network settings. Click edit next to eth0 and find the checkbox to set the network to connect automatically.

share|improve this answer

You have no networking configured. you should have enabled it during install (its not obvious, I missed it too during my first minimal-install). Try:

dhclient eth0 # gets you DHCP on en0

This will get you started. Then try:

yum install system-config-network-tui

Which will give you a curses based network config program where you can set things permanently.

share|improve this answer
    
Awesome, it works. Thanks. Will I have to type the dhclient eth0 each time I reboot my virtual machine? –  Vlad Bondarenko Jun 23 '13 at 22:16
    
Btw, getting an error puu.sh/3mIhT.png –  Vlad Bondarenko Jun 23 '13 at 22:18
    
No, use the network tool that you just installed with yum to enable DHCP on boot. –  Rich Homolka Jun 23 '13 at 22:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.