I run a Win 7 system with a CentOS 6.3 inside VirtualBox. On CentOS there is an apache, which I want to access in my host system. Moreover, I want to have an internet connection in my virtual machine. I am struggling and can't find out how to do this.
My VirtualBox is of version 4. 2. 10. I configured it to use bridged mode, as I read this is the right way to do this. In my linux guest system, I gave eth0 a static IP address. In the global settings of VirtualBox, there is a VirtualBox Host-only Ethernet Adapter with DHCP disabled. I can also see this device in my Windows network configurations. Is it normal to have it as a host-only adaptor?
With the current setup, I cannot ping my virtual machine (destination host unreachable) and from my guest I cannot ping google. com. Help very much appreciated.
Bridge to use Apache
-
BillG
- Volunteer
- Posts: 5106
- Joined: 19. Sep 2009, 04:44
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows 10,7 and earlier
- Location: Sydney, Australia
Re: Bridge to use Apache
As you might have guessed, the host only adapter connects the guest to the host only. This will allow you to contact your apache server from the host. If you also configure a NAT connection (which is the default) you will also have Internet access from the guest (using the NAT connection which shares the host's Internet connection to the guest). There is no need to use bridged mode unless you want the apache server to be visible from other machines on your network.
You should have two ethernet NICs showing up the guest, and by default neither will have a static IP. The host only NIC will get a 192.168.56.x address from the host only DHCP allocator and the NAT NIC will get its IP address (10.0.x.x) from the allocator in NAT.
To contact the apache server from the host use the guest's 192.168.56 address.
Ping is not a reliable way to check network connectivity anymore. Most personal firewalls these days block ICMP echo by default, preventing ping from working.
You should have two ethernet NICs showing up the guest, and by default neither will have a static IP. The host only NIC will get a 192.168.56.x address from the host only DHCP allocator and the NAT NIC will get its IP address (10.0.x.x) from the allocator in NAT.
To contact the apache server from the host use the guest's 192.168.56 address.
Ping is not a reliable way to check network connectivity anymore. Most personal firewalls these days block ICMP echo by default, preventing ping from working.
Bill
-
Chrisissorry
- Posts: 3
- Joined: 16. Mar 2013, 19:12
Re: Bridge to use Apache
Thanks BillG,
I followed your advice and I now have access to the internet from my guest and I can also ping 192.168.56.1. However, in my browser I am not able to find 192.168.56.1/index.html. Apache is running and just to make sure this is not a permission problem I set index.html to 777.
I followed your advice and I now have access to the internet from my guest and I can also ping 192.168.56.1. However, in my browser I am not able to find 192.168.56.1/index.html. Apache is running and just to make sure this is not a permission problem I set index.html to 777.
-
Chrisissorry
- Posts: 3
- Joined: 16. Mar 2013, 19:12
Re: Bridge to use Apache
Alright, got it working. Had to add the network-config for eth1 (my host-only) to my network scripts. Now I can access it on my Browser.
Thanks for you help, BillG!
Thanks for you help, BillG!