Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the below dev. environment.

  • Hardware:- Windows 7, 32bit, HP Laptop.
  • Software:- CentOs 6.5 running on VirtualBox 4.3.10.

In a nutshell The problem is that I can't access the internet and localhost at the same time in my VirtualBox. Example:


If I have my VirtualBox adapter set to Host Only. ifconfig eth0 shows me the below configuration:

#ifconfig eth0
Link encap:Ethernet  HWaddr 08:00:27:81:0F:EA
inet addr:  Bcast:  Mask:
inet6 addr: fe80::a00:27ff:fe81:fea/64 Scope:Link
RX packets:342 errors:0 dropped:0 overruns:0 frame:0
TX packets:362 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:37176 (36.3 KiB)  TX bytes:66580 (65.0 KiB)

And cat /etc/resolv.conf shows the below:

#cat /etc/resolv.conf
[root@localhost]# cat /etc/resolv.conf
; generated by /sbin/dhclient-script

Now, with those above settings. If I check I can see all is working. Nginx, Php ... all is fine. The problem here is that, if I wanted to install a package with yum install ... or yum update or even ping gives me error. Example:

[root@localhost myProject]# ping
ping: unknown host

So, I tried to switch to NAT Adapter.


Now, with NAT. I if I do ifconfig eth0 I see the below config:

Link encap:Ethernet HWaddr 08:00:27:81:0F:EA
inet addr: Bcast: Mask:
inet6 addr:fe80::a00:27ff:fe81:fea/64 Scope:Link
RX pacakets:434 errors:0 dropped:0 overruns:0 frame:0 
TX Packets:445 errors:0 dropped:0 overruns:0 carrier:0 
collisions:0 txqueuelen:1000
RX bytes:47366 (46.2 KiB TX bytes:76674 (74.8Kib)

Now, you would assume if I typed,, localhost or even I would be able to see my server running or my web pages. But, No! Nothing shows up. I get an error message, as if I was trying to access a page that did not exist. I've even adjusted my hosts file. But nothing. I can't even access CentOs using putty. But, weird enough I can install packages, ping server and all..

So, I tried to use two adapters, but sadly whichever is set Adpater 1 only seems to work, as if the Adapter 2 is being ignored. So, overall with these settings, I can either only install packages but not see my server, or vise versa.

I am looking for alternative that will allow me to see my localhost and install pacakges at the same time using only one adapter.


According to metacom's answer I added a port into the NAT adapter as below.

enter image description here

share|improve this question
up vote 1 down vote accepted

Either add a port formard to the NAT setup, or run bridged networking. Port forwarding below port 1024 will not work according to

In bridged mode, it essentially creates a virtual ethernet interface in software, appearing as another machine of the LAN.

share|improve this answer
How do I add port forward? I have no idea, as I am kinda new in this. However, I have tried bridged mode several times. It gives me a Failed error when initializing the eth0 interface – Bimlik Apr 6 '14 at 17:53
"To configure Port Forwarding you can use the graphical Port Forwarding editor which can be found in the Network Settings dialog for Network Adaptors configured to use NAT. Here you can map host ports to guest ports to allow network traffic to be routed to a specific port in the guest." The host port must be >1024, i.e. host port 8080 guest port 80 – metacom Apr 6 '14 at 18:01
Thanks. I feel like today is the day I will fix this error. But, unfortunately, I am a bit lost. I have edited my answer to include a snapshot of the settings. I have done as you suggested and rebooted network, disabled iptabes, and I can see my ifconfig eth0 show as my hosts IP. But I can't access it. I can't browse the page using any ip address. Can you checkout the image and tell me if I am doing something wrong – Bimlik Apr 6 '14 at 18:22
Edit that to add host as and guest ip as – metacom Apr 6 '14 at 18:50
On and Off. I have tried to have a fully working CentOs for 7-8 months now. And today, I've finally finished. You have no idea how much you've saved me. You are a godsend. I finally tried and was able to access my host file on NAT adapter. I will work on to remove the port number 8080. Thanks a Million. – Bimlik Apr 6 '14 at 19:07

Your Answer


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.