Page 1 of 1
How do I determine the IP Address of the guest?
Posted: 8. Nov 2010, 06:39
by owkaye
I'm running Ubuntu 10.10 host and Ubuntu 8.04.4 guest. All I want to do is configure the guest to be my local web server for my web development work.
I have the guest running properly, but I have no idea how to figure out what IP Address it is running on. Can anyone help me get this info -- so I can use my host web browser to login to my guest web server?
Re: How do I determine the IP Address of the guest?
Posted: 8. Nov 2010, 15:55
by Perryg
You can log into the guest and issue the ifconfig -a command in terminal.
It really depends a lot on the network mode you are using as well. Bridged, NAT, host-only, or Internal.
How did you install the guest?
Re: How do I determine the IP Address of the guest?
Posted: 8. Nov 2010, 20:54
by owkaye
Thanks for the suggestion PerryG, here is the answer to your question:
Network Adapter 1:
PCnet-FAST III (NAT)
Network Adapter 2:
PCnet-FAST III (Host-only adapter, 'vboxnet0')
I tried using ifconfig -a as you suggested. It displays so much info in the guest window that the most important part -- the guest's IP Address -- seems to have already scrolled off the screen, and I don't know how to scroll up far enough to see it again.
Is there a trick to scrolling up far enough to see the info that's already scrolled off the screen? If I could do this then maybe I could see the IP Address I need ...
Re: How do I determine the IP Address of the guest?
Posted: 8. Nov 2010, 21:16
by Sasquatch
Your Guest will have the following IP addresses, assuming that you have enabled the DHCP for the Host-Only network and it starts with .100:
eth0:
Address: 10.0.2.15
eth1:
Address: 192.168.56.100
Using Shift+up arrow or page up, you can scroll the TTY up.
You should be able to access the VM on 192.168.56.100. Ping that address from the Host first to see if that's correct, else you need to verify it.
Re: How do I determine the IP Address of the guest?
Posted: 8. Nov 2010, 22:26
by owkaye
Hello Sasquatch,
I tried pinging (from the host) the two ip addresses you gave me (10.0.2.15 and 192.168.56.100) but there was no ping response from either address. Previously I tried to request a web page at those ip addresses and they failed too (even though Apache2 on the guest starts at bootup).
Therefore it would appear that something is broken in my network setup, or perhaps something else. Please let me describe my situation so maybe you can offer suggestions, since I may not be using the correct network settings. I am open to doing anything I can to get this to work ASAP:
My host internet service is wireless via AT&T. My host computer runs Ubuntu 10.10. I have installed VirtualBox 3.2.10 r66523, and I have created only one guest VM which runs Ubuntu 8.04.4 server (no desktop). This VM appears to bootup successfully with no apparent errors.
In File > Preferences > Network it says "Host-Only networks: vboxnet0 network" which has the following settings:
Adapter: IPv4 Address 192.168.56.1, DHCP Server: Enable Server (checked), Server Address 192.168.56.100, Server Mask 255.255.255.0, Lower Address Bound 192.168.56.101, Upper Address Bound 192.168.56.102
In Machine > Settings > Network:
Adapter1 - Enable Network Adapter (checked), Attached to NAT, Adapter Type PCnet-FAST III, Mac Address 080027B01966, Cable Connected (checked)
Adapter2 - Enable Network Adapter (checked), Attached to Host-only Adapter, Name vboxnet0, Adapter Type PCnet-FAST III, Mac Address 0800278BFCD5, Cable Connected (checked)
Can you suggest anything I might do to fix this problem? Thanks.
Re: How do I determine the IP Address of the guest?
Posted: 9. Nov 2010, 00:16
by Sasquatch
The IP that the guest has isn't .100, but .101. That's the first address the VB DHCP provides. You could've figured that out if you read the last part of my post which explains how to scroll in your TTY.
Re: How do I determine the IP Address of the guest?
Posted: 9. Nov 2010, 02:19
by owkaye
Sasquatch,
Your suggestion here does not work: "Using Shift+up arrow or page up, you can scroll the TTY up."
You suggested pinging this ip address but then you said it's the wrong one: "You should be able to access the VM on 192.168.56.100."
I already checked 192.168.56.101 and 192.168.56.102 since they are the only two DHCP addresses allowed in my settings, and neither one worked. I also checked 10.0.2.15 and that didn't work either.
Pinging from the Host always fails, and so do http requests to all the ip addresses mentioned in this thread. I read something about the possibility of ping not working, but since http fails as well I think it's a network problem.
Since none of your suggestions have helped, I wonder what else I might do to resolve the problem. Alone else have a suggestion that might work?
Re: How do I determine the IP Address of the guest?
Posted: 9. Nov 2010, 02:37
by Perryg
Your suggestion here does not work: "Using Shift+up arrow or page up, you can scroll the TTY up."
Shift+(Page Up) should be what you want to use.
Forget the NAT address if you are using host-only as that address will be the one that allows the host and guest to talk.
It should be 192.168.56.100 or 101 for the guest but that may be different depending on what the host allowed to be used. 99% of the time though it is the address we mentioned.
If you can get into the guest via ssh you can run ifconfig -a and using the shift+page up you should see the address or enter this
ifconfig -a |more
Also do this on the host so you can see what the address schemes really are.
It is also possible that the host-only adapter is not installed or not set to use dhcp. Are you doing this all by CLI? Host and guest?
See VBoxManage
VirtualBox online users manual to find out how to configure DHCP and Host-Only.
Post them here if you still have problems.
Re: How do I determine the IP Address of the guest?
Posted: 9. Nov 2010, 04:50
by owkaye
Perryg, thanks for the correct suggestion to use "Shift+(Page Up)", it works fine.
I just reinstalled the Guest OS from scratch, and I used the default settings. This is the first time I've been able to see in the TTY that the eth0 inet address is 10.0.2.15. I still cannot ping the Guest from the Host at this address, but maybe I need to add a Host-only adapter to access the Guest from the Host?
I read a suggestion in another thread that said the following, and this is what made me think I need to use a combination of NAT and Host-only:
"I solve the problem by letting all VMs using NAT function as their main
interface (the same 10.0.2.15 IP address that they get) and also add an
additional Host-only interface with an unique static address (or let built
in DHCP handle this on that network). That way, all of the VMs are able
to reach the outside world (via NAT), communicate with each other (via
Host-only network) and even reach to / be reached by the actual physical
host (which also gets vboxnet0 interface with an address on the same
host-only net)."
I don't know if this will work for me or not. I'm not even sure it applies to my goals. I have read (and re-read) Chapter 6 several times and I still find it confusing. It would be great if there were an example page where I might find a system similar to what I want, so I could just mimic those settings. Wishful thinking I know, but it makes sense, right?
So how should I proceed? Should I add a Host-only adapter now?
Re: How do I determine the IP Address of the guest?
Posted: 9. Nov 2010, 05:02
by Perryg
If you continue with NAT only you will need to setup port forwarding. NAT is in a different subnet and is not routeable.
Here is the down and dirty network settings
Bridged (if there is a router in the network) is the best for what you want to do.
Host-Only will allow the host and the guest to talk, but the guest will not have the Internet.
NAT will give the guest Internet but the host and guest can not talk without setting up port forwarding.
Give this information, if you can not use Bridged, then the best thing to do is setup an adapter as host only and get that to work.
Then add a second adapter if the guest needs to access the Internet.
Re: How do I determine the IP Address of the guest?
Posted: 9. Nov 2010, 07:05
by owkaye
"Bridged (if there is a router in the network) is the
best for what you want to do."
Thank you for stating this so clearly!
I get my internet via an AT&T Wireless DSL Modem / Gateway which offers not only wireless access but also 4 ethernet ports. So I could probably set up Bridged on the Host's wired connection by using an ethernet cable. But this is not ideal because I move the Host computer (a laptop) to different work locations frequently, so I think I should try another solution.
"If you can not use Bridged, then the best thing to
do is setup an adapter as host only and get that to
work. Then add a second adapter if the guest needs
to access the Internet."
If I need to start with a Host-only adapter first, maybe that's what I've been doing wrong. Until now I have started with NAT as the first adapter, then added Host-only later. I don't really know why the order they are created / enabled would make any difference, but maybe it does.
So ... if I change my current adapter from NAT to Host-only, what IP Address do I use to run tests to see if the Host can request a web page from the Guest? Is this where I use 192.168.56.101 or is this where I should use 10.0.2.15 ?
Re: How do I determine the IP Address of the guest?
Posted: 9. Nov 2010, 07:17
by owkaye
Perryg, your advice helped me to get Host-only working, thank you!
I just finished replacing NAT with Host-only, then I successfully requested a web page from the Guest at 192.168.56.101, so it seems I'm finally on the right track. Maybe I'll try adding a new NAT adapter tomorrow, and if that works I'll see if I can figure out how to give the Guest access to my web development files on the Host.

Re: How do I determine the IP Address of the guest?
Posted: 9. Nov 2010, 07:56
by owkaye
I stayed up a little longer to test some things and it appears that only the FIRST adapter is functional. Here's how I came up with this conclusion:
1- When the first adapter is NAT and the second is Host-only, the Guest has internet access but Apache is unreachable from the Host.
2- When the first adapter is Host-only and the second is NAT, Apache on the Guest will serve pages to the Host, but the Guest does NOT have internet access.
Does anyone know how to make more than one adapter work?
Re: How do I determine the IP Address of the guest?
Posted: 9. Nov 2010, 23:34
by Sasquatch
Oh, that I didn't think about this before! It's so easy! Both adapters must be set to DHCP, but during the installation, you are only asked for one interface. Open
/etc/network/interfaces as root (or use sudo) and add this to it. It's basically a copy of what is already there, you only add the other interface.
The complete file would be similar to this, excluding the comments:
Code: Select all
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet dhcp