After a lot of RTFM'ing and reading forums, I am still having problems and need some advice. I use Virtualbox on Ubuntu and installed a Centos server as a guest. My problem is that I cannot access the web server on the guest OS from the host OS.

Here are the details: Host OS is Ubuntu 12.04 LTS (kernel 3.2.0-24-generic) 64bit.

I use Virtualbox 4.1.12.

I get my IP address from my wireless router:

eth0      Link encap:Ethernet  HWaddr 18:03:73:42:3d:ac  
          UP BROADCAST MULTICAST  MTU:1500  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:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:47 Base address:0xe000 

lo        Link encap:Local Loopback  
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:3784 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3784 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:378673 (378.6 KB)  TX bytes:378673 (378.6 KB)

wlan0     Link encap:Ethernet  HWaddr 64:27:37:69:c5:d2  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::6627:37ff:fe69:c5d2/64 Scope:Link
          RX packets:124013 errors:0 dropped:0 overruns:0 frame:0
          TX packets:82469 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:164307087 (164.3 MB)  TX bytes:9744555 (9.7 MB)

So, I installed CentOS as a guest OS and I want to access its http server. In the Network Settings in Virtualbox I have this: Attached to Bridged Adapter

Name: wlan0

I allow Promiscuous mode for the VMs.

And 'Cable Connected' ticked.

On the CentOS machine, the eth0 interface picked up IP address with mask. Everything looks OK so far, the two systems can ping each other. I started the web server and it is listening on port 80 - checked with netstat. (However haven't change the default configuration file of the webserver.)

When I wanna connect to the web server on the CentOS machine, I cannot. 'Unable to connect' Firefox says, Chrome is also unhappy: Chrome could not connect to (I am not using any proxy here.)

I tried to telnet to port 80 on the guest system - no joy:

:~$ telnet 80
telnet: Unable to connect to remote host: No route to host

Not sure if it's important, but the route table on the guest OS is here:

[root@centos ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     *        U     0      0        0 eth0
link-local      *          U     1002   0        0 eth0
default         UG    0      0        0 eth0

(It's funny, just figured it out that I can ssh from Ubuntu to CentOS.)

I tried different settings in Virtualbox, but the above is the closest to what people suggest on different forums. Tried NAT with port forwarding, Host-only adapter but I failed to fix it.

Can someone shed some lights for me, please? Cheers

  • In addition... On my host OS (Ubu) I did a traceroute and it found a route to the guest OS. And as said the machines can ping each other and ssh is working. Created a dummy html file called index_x.html and I can read the page from the guest itself with lynx. Can this be a firewall issue? – Petkaux Jun 8 '12 at 18:19
  • Do you have a firewall running on the guest OS? If so, is it blocking port 80? – Fran Jun 8 '12 at 20:08
  • Yep, you're right, Fran. iptables was blocking me on the guest CentOS. I turned it off temporarily to see what was going on and voila, I could access the web server! Yippeee! – Petkaux Jun 9 '12 at 10:24
  • @Petkaux I have a sample problem with the same environment. I'm not good in Linux.. So, can you please give me the command/steps what you have tried for you problem. ? – Mr. Black Oct 25 '12 at 15:06

The solution was to open the port on the firewall of the guest OS, as described here: http://wiki.centos.org/HowTos/Network/IPTables

The Network settings in Virtualbox was OK - Bridged Network is the correct setting.

| improve this answer | |
  • Thanks, this one took me a while to figure out. firewall-cmd --zone=external --add-service=http --permanent; firewall-cmd --reload – Christopher Markieta Jul 4 '15 at 1:49

Disabling the guest OS internal firewall as below should allow you access. Type

service iptables stop
chkconfig iptables off

at the command line when in the guest OS.

| improve this answer | |
  • Thanks, I spent hours trying different settings to access the server on my CentOS VM. – uınbɐɥs Apr 5 '13 at 22:59
  • Simple and elegant! – Edward_178118 Mar 23 '16 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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