Page 1 of 1
Windows 7 Host Ubuntu 14.04 Apach VM Can't Connect from Host
Posted: 12. Dec 2015, 05:04
by BarrysDad
I've been through more posts than I can count at this point. I'm trying to build a web server (for internal use only -- not for public consumption) in Ubuntu/Apache running in VirtualBox. I cannot connect from the host (Windows) browser to my virtual server.
If I use NAT in VirtualBox, I have access to the Internet for updates, etc., but no access into my VM server from Windows. If I use either Bridged Adapter or Host-only Adapter in VirtualBox, I have no access to the Internet for updates, etc. I also have no access to my VM server from Windows. I have no problem changing back to NAT as required for Internet access, but neither of the others gives me the results I need either.
I have run ipconfig on my Windows system and it shows 192.168.56.1 as the IPv4 Address for VirtualBox. I have run ifconfig on Ubuntu and it shows inet addr:192.168.546.1. I have no problems accessing my Apache server from Firefox in Ubuntu using either the eth0 or lo IP addresses. I just can't get to it from Firefox in my Windows host.
Please help or request additional information as required.
Thanks.
Re: Windows 7 Host Ubuntu 14.04 Apach VM Can't Connect from
Posted: 12. Dec 2015, 08:00
by BillG
Bridged should work, but why not use NAT and host only together (one NIC set to NAT, one to host only). The guest will use NAT for all traffic on the physical network and host only to communicate with the guest.
Re: Windows 7 Host Ubuntu 14.04 Apach VM Can't Connect from
Posted: 13. Dec 2015, 02:56
by BarrysDad
I really like your idea, but at this point I am sufficiently technologically challenged to set that up. From what I saw in the VirtualBox options, I need to choose either NAT or Host Only Adapter for a given "machine." When I tried both Bridged and Host Only adapters, I still could not connect to my virtual server from my Windows host. I could ping it (but maybe that's VirtualBox responding) but could not enter the IP in FireFox on Windows and have it connect.
I have no problem with FireFox in Ubuntu with both the 192.168.56.1 IP and the local host IP 127.0.0.1. And I set up a local domain that I can also access within Ubuntu but not from Windows.
Re: Windows 7 Host Ubuntu 14.04 Apach VM Can't Connect from
Posted: 13. Dec 2015, 06:09
by BillG
There is no real technical expertise required. While the guest is shut down, go to settings and then the network section. Enable a second NIC and set it to host only.
When you boot the vm, the NAT NIC will still work as before. The second NIC will have an IP of 192.168.56.x (where x is probably 101). You should be able to see your website in the vm from the host using this IP (ie
http://192.168.56.101 or whatever it is.) 192.168.56.1 will be the host's IP address for its host only interface.
If you want the web server in the guest to be accessible from other machines on your local LAN, you will need to run the vm in bridged mode so that it gets an IP in the same subnet as your LAN machines.
Re: Windows 7 Host Ubuntu 14.04 Apach VM Can't Connect from
Posted: 13. Dec 2015, 06:39
by BarrysDad
I gave it a try and added the second NIC with no problems. I brought the server up and did an ifconfig. I now have an eth1 with an IP address of 192.168.56.101 so I thought everything might be resolved. The first NIC is set to NAT and the second to Host Only. Bottom line, I still have no outbound Internet connection (for updates, etc.) and I am unable to either ping the new IP from Windows or get to it using FireFox on Windows. From ping -- "Reply from 192.168.56.1: Destination host unreachable."
I don't know if this is relevant, but when I try to ping my host machine from VM server, I'm told by 192.168.56.101 that the destination host is unreachable. When I try to ping google (216.58.219.238) I'm told by 192.168.56.1 that the host is unreachable.
Am I shooting myself in the foot somewhere in Ubuntu perhaps?
Re: Windows 7 Host Ubuntu 14.04 Apach VM Can't Connect from
Posted: 16. Dec 2015, 03:40
by BarrysDad
For those of you that stumble across this post, I have resolved the problem. It was due to a VirtualBox issue. I had both NICs set to "Cable Connected" in my settings for the server in the Oracle VM VirtualBox Manager.
When I checked the server as it was running, I looked in Devices > Network > Network Settings, neither one had the "Cable Connected" box checked, Once I checked this, I was golden. I had my Ubuntu Internet connection for updates, browsing, etc., and I was able to connect to the Ubuntu server from my Windows host.
And a big Thank You to BillG for getting me on my way on working through my initial problem.