Host-only networking: static IP guest addresses

Discussions about using non Windows and Linux guests such as FreeBSD, DOS, OS/2, OpenBSD, etc.
com.ent
Posts: 7
Joined: 2. Aug 2009, 11:53
Primary OS: Debian Lenny
VBox Version: PUEL
Guest OSses: Debian

Host-only networking: static IP guest addresses

Post by com.ent »

Hello,

I'm trying to configure a host-only network adapter with VirtualBox 2.2.4; host operating system is GNU/Linux (distribution=Debian release=Lenny); guest operating system is GNU/HURD (latest Debian release).

The vboxnet0 interface is up and running in the host machine:

Code: Select all

$ ip add show dev vboxnet0
5: vboxnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:76:62:6e:65:74 brd ff:ff:ff:ff:ff:ff
    inet 10.10.10.150/24 brd 10.10.10.255 scope global vboxnet0
    inet6 fe80::276:62ff:fe6e:6574/64 scope link
       valid_lft forever preferred_lft forever
and it answers to the ping command from the host:

Code: Select all

$ ping -c2 10.10.10.150
PING 10.10.10.150 (10.10.10.150) 56(84) bytes of data.
64 bytes from 10.10.10.150: icmp_seq=1 ttl=64 time=0.058 ms
64 bytes from 10.10.10.150: icmp_seq=2 ttl=64 time=0.066 ms
--- 10.10.10.150 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1003ms
rtt min/avg/max/mdev = 0.058/0.062/0.066/0.004 ms
but I cannot find the way to identify the network parameters (network card address and netmask, default gateway) for the guest operating system.

The VirtualBox manual reports:
"6.7 [..] For host-only networking, like with internal networking, you may ?nd the DHCP server useful that is built into VirtualBox. This can be enabled to then manage the IP addresses in the host-only network since otherwise you would need to con?gure all IP addresses statically."
Unfortunately, DHCP is currently not supported in the guest operating system, so I have to configure the guest ethernet card with "all IP addresses statically". I tried to use the following static addresses for the ethernet card:

Code: Select all

ethernet IP address: 10.10.10.180
netmask: 255.255.255.0
gateway IP adress: 10.10.10.150
With this configuration, the guest operating system can ping itself (e.g.: ping -c2 10.10.10.180 works), but I cannot ping the host IP address (e.g.: ping -c2 10.10.10.150 fails).

I suppose I have chosen the wrong gateway IP adress in the guest operating system, but I cannot figure out what is the right one.

Can anyone give me an advice or help about how to configure guest IP addresses statically with host-only network adapter ?

Thanks in advance.


post scriptum: I believe that the guest operating system works fine because I previously configured it with success using the Virtual Box NAT interface using static IP address; I tried to used the NAT static IP address with the host-only network adapter, but it didn't work.
baf
Volunteer
Posts: 829
Joined: 27. Sep 2008, 06:18
Primary OS: Mac OS X Leopard
VBox Version: PUEL
Guest OSses: linux,xp,win7
Location: Luleå or Skellefteå, Sweden

Re: Host-only networking: static IP guest addresses

Post by baf »

Gateway ip should not matter and should not be set at all for this interface.
Do you have any firewall running on the host?

Also normal range for a host only interface is 192.168.56.X with the host at 192.168.56.1 you could try using that instead.
Put the guest at 192.168.56.10 mask 255.255.255.0 gateway unset.
Some say: "You learn as long as you live".
My way: "You live as long as you learn".
com.ent
Posts: 7
Joined: 2. Aug 2009, 11:53
Primary OS: Debian Lenny
VBox Version: PUEL
Guest OSses: Debian

Re: Host-only networking: static IP guest addresses

Post by com.ent »

Hi, thanks for your answer.
baf wrote:Gateway ip should not matter and should not be set at all for this interface.
Do you have any firewall running on the host? Also normal range for a host only interface is 192.168.56.X with the host at 192.168.56.1 you could try using that instead. Put the guest at 192.168.56.10 mask 255.255.255.0 gateway unset.
I used the addresses you suggested (guest at 192.168.56.10 mask 255.255.255.0 with host operating system firewall disabled), but the commands ping -c2 10.10.10.150 and ping -c2 192.168.56.1 fail (error: destination host unreachable). The guest operating system has no firewall.

If you require further informations to help me, please ask.

Thanks.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Host-only networking: static IP guest addresses

Post by Sasquatch »

Give us a screenshot of the Host-Only adapter information you set on the Host from the VB GUI, and the terminal output of /sbin/ifconfig of both Host and Guest.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
com.ent
Posts: 7
Joined: 2. Aug 2009, 11:53
Primary OS: Debian Lenny
VBox Version: PUEL
Guest OSses: Debian

Re: Host-only networking: static IP guest addresses

Post by com.ent »

Hi, thanks for your answer.

These are the screen shot:
- VM setup
VM setup
VM setup
VBox-vm-network-setup.png (46.65 KiB) Viewed 117233 times
- VirtualBox File->Setup->Network
VBox-host-only-setup1.png
VBox-host-only-setup1.png (19.88 KiB) Viewed 117155 times
VBox-host-only-setup2.png
VBox-host-only-setup2.png (18.53 KiB) Viewed 117148 times
The /sbin/ifconfig output on host operating system is:

Code: Select all

debian:~# /sbin/ifconfig
eth1      Link encap:Ethernet  HWaddr 00:1d:72:d1:50:94
          inet addr:10.10.10.139  Bcast:10.10.10.255  Mask:255.255.255.0
          inet6 addr: fe80::21d:72ff:fed1:5094/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:799294 errors:0 dropped:0 overruns:0 frame:0
          TX packets:318238 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1133904953 (1.0 GiB)  TX bytes:22332574 (21.2 MiB)
          Interrupt:16

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2723 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2723 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:288783 (282.0 KiB)  TX bytes:288783 (282.0 KiB)

vboxnet0  Link encap:Ethernet  HWaddr 00:76:62:6e:65:74
          inet addr:10.10.10.150  Bcast:10.10.10.255  Mask:255.255.255.0
          inet6 addr: fe80::276:62ff:fe6e:6574/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:328 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:13992 (13.6 KiB)
The /sbin/ifconfig command is not available (the net-tools package is not been ported on Debian GNU/HURD). The setup is done by the settrans command; the showtrans command shows:

Code: Select all

/hurd/pfinet -i eth0 -a 192.168.56.10 -g 192.168.56.1 -m 255.255.255.0
Thanks.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Host-only networking: static IP guest addresses

Post by Sasquatch »

You are conflicting your own network with the Host-Only network. You can't have two separate networks with the same IP range, the OS will fail to use the right adapter. As you don't have a gateway for your network on the Host-Only net, but you have one for eth0, all packages received on your Host-Only adapter are send out to the default gateway. Change your Host-Only range to 192.168.56.x.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
com.ent
Posts: 7
Joined: 2. Aug 2009, 11:53
Primary OS: Debian Lenny
VBox Version: PUEL
Guest OSses: Debian

Re: Host-only networking: static IP guest addresses

Post by com.ent »

Hi,
Sasquatch wrote:[..] Change your Host-Only range to 192.168.56.x.
According to your previous post, I changed the host-only address for the host system using File->Network->Host-only-address VirtualBox form; after the VirtualBox restart, I obtained the following result on the host operating system:

Code: Select all

debian:~# /sbin/ifconfig
eth1      Link encap:Ethernet  HWaddr 00:1d:72:d1:50:94
          inet addr:10.10.10.139  Bcast:10.10.10.255  Mask:255.255.255.0
          inet6 addr: fe80::21d:72ff:fed1:5094/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:879711 errors:0 dropped:0 overruns:0 frame:0
          TX packets:345406 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1245500834 (1.1 GiB)  TX bytes:24957464 (23.8 MiB)
          Interrupt:16

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2739 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2739 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:289827 (283.0 KiB)  TX bytes:289827 (283.0 KiB)

vboxnet0  Link encap:Ethernet  HWaddr 00:76:62:6e:65:74
          inet addr:192.168.56.10  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::276:62ff:fe6e:6574/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:379 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:16134 (15.7 KiB)
I kept the previous configuration for the guest IP addresses, but when I try to ping the host IP address from the guest, the command:

Code: Select all

ping -c2 10.10.10.139
continues to fail with "host unreachable" error. I think I'm missing something, but I can't figure out what it is.

Thanks.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Host-only networking: static IP guest addresses

Post by Sasquatch »

The Host should have 192.168.56.1, the Guest needs a different IP in the same range, like 192.168.56.10. You can't ping your 10.x.y.z range, as I stated before and is clearly documented in the Manual. You're confined to the Host, you can't go outside. So no physical network access, no internet, no nothing. What part of Host-Only do you not understand? I suggest you do some reading on networking too, as you make some beginner mistakes. No offence, but it seems you have no clue on what you're doing.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
com.ent
Posts: 7
Joined: 2. Aug 2009, 11:53
Primary OS: Debian Lenny
VBox Version: PUEL
Guest OSses: Debian

Re: Host-only networking: static IP guest addresses

Post by com.ent »

Thanks for your answers; probably, I've misunderstood the host-only option even If I have read the manual. Bye.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Host-only networking: static IP guest addresses

Post by Sasquatch »

If you want to make your VM a part of your physical network, then you have to use Bridged. Good luck.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
jpppdk
Posts: 6
Joined: 9. Jun 2010, 17:14
Primary OS: MS Windows 2003
VBox Version: PUEL
Guest OSses: Solaris10, Linux

Re: Host-only networking: static IP guest addresses

Post by jpppdk »

I have the same problem as com.ent and is not so simple to resolve. It is a missing Virtualbox information. First of all let me state my situation.

I have Virtualbox 3.1.6 and 3.2.4 running on identical Hosts on Windows 2003. My guests are Winxp and Solaris10.

1. Please do not ask me to use DHCP anywhere. Thats not how my virtual network needs to work.
2. Please do not ask me to setup this or that specific IP subnets/masks etc. My IP addresses are already defined by my network design.
3. I do NOT want to be part of a physical network nor do I care about browsing the internet.
4. But I DO want to communicate from ALL of my Guests to ALL of the other Guests and ALL of the Guests to ALL local IP addresses on the Host.

HOST: Win2003
IP1: 10.1.1.1/24
IP2: 10.2.2.1/24
IP3: 10.3.3.1/24

GUEST 01: Solaris10
IP1: 10.1.1.2/24
IP2: 10.2.2.2/24
IP3: 10.3.3.2/24

Guest 02: WinXP
IP1: 10.1.1.3/24
IP2: 10.2.2.3/24
IP3: 10.3.3.3/24

Guest 03: Linux 2.6
IP1: 10.1.1.4/24
IP2: 10.2.2.4/24
IP3: 10.3.3.4/24

I had the exact same setup under VMware, fully working for many years so please dont tell me I dont know about basic concepts etc. So if this can/cannot be done on VirtualBox please kindly post here for the benefit of me and others like com.ent. Else, I may have to go back to Vmware.

thanks in advance
JPP
jpppdk
Posts: 6
Joined: 9. Jun 2010, 17:14
Primary OS: MS Windows 2003
VBox Version: PUEL
Guest OSses: Solaris10, Linux

Re: Host-only networking: static IP guest addresses

Post by jpppdk »

found the issue.
Its the order in which each Guest Operating system picks up the virtual NICs provided by Virtualbox. It cannot be assumed that:
Adapter 1
Adapter 2
Adapter 3
in the virtualbox guest settings will correspond to
eth0
eth1
eth2

within the Linux Guest OS. Atleast in my installation it was not.

The only option I had was to make myself a table of all MAC addresses as found by the guest OSes and find out which Virtual adapter that was in virtualbox settings. Then I had to make sure the subnets matched between those virtual adapters and my Host machine adapters that were connected to: e.g:
Guest: Adapter 1 [MAC 00-00-00-00-D8-10] > linked to > "VirtualBox Host-Only Ethernet Adapter #3" > IP subnet 10.1.1.0
Inside the guest eth3 was [MAC 00-00-00-00-D8-10]. So I had to assign IP subnet 10.1.1.0 to eth3

Did the same with all the other Guests and now they all see and talk to each other.

Hope its clear and helps somebody.

regards
JPPP
openguy
Posts: 1
Joined: 19. Jul 2010, 08:01
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: Ubuntu32.1004

Re: Host-only networking: static IP guest addresses

Post by openguy »

Sasquatch wrote:You're confined to the Host, you can't go outside. So no physical network access, no internet, no nothing. What part of Host-Only do you not understand?
Well, this only applies to what VirtualBox will do for you automatically.

You can easily get off the host If you enable IP forwarding on your host and already have or can add appropriate routes for the "host-only" network from the other nodes on your network back to your virtualbox host. (Well, "easily" might not be the right term for a newbie, but it's just a matter of configuration.)

I have a dozen or so physical machines on my home network. There's no need for NAT within my lan, and I don't want to use bridging, so I did the above. The router between the lan and the internet does all the NAT. It all works fine.

I need to do this because I can't run DHCP on the VM. Well, technically I can, but I use my company's VPN solution on the VM and it dies a horrible death whenever the DHCP lease gets renewed, so I need to avoid DHCP.

From what I can tell, I can't choose the IP address for the host-only network. This was a little painful because I had to change all my external routes, but it was not a show-stopper for me. Still, it would prevent me doing something similar on one of my other machines. I don't see why I shouldn't be able to configure the host-only network address, so hopefully this limitation will get removed.

I'm currently testing out switching from vmware to virtualbox. The configuration of the virtual networks in virtualbox seems a lot more restrictive than in vmware. Does anyone know if maintaining these restrictions is a goal (as opposed to not having enough helpers)?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Host-only networking: static IP guest addresses

Post by Sasquatch »

I find the networking of VMWare more confusing. NAT for example still gives the ability for VMs to interact with each other, while they should be separated. VB created Internal Networking for that. Bridged is the same, however, VMWare uses a virtual interface for that, no so for VB. Host-Only is just that, without any additional configuration, the network is limited between the VM(s) and the Host. Similar to Internal, only that the Host participates too and you can use some routing magic on the Host to configure a NAT solution.
There's no need for NAT within my lan, and I don't want to use bridging, so I did the above. The router between the lan and the internet does all the NAT. It all works fine.

I need to do this because I can't run DHCP on the VM. Well, technically I can, but I use my company's VPN solution on the VM and it dies a horrible death whenever the DHCP lease gets renewed, so I need to avoid DHCP.
You don't want NAT, because your router does it for you, yet you create a NAT environment. You can't use Bridged because you don't like it? Is that even a reason you're not able to use it?
With Bridged, the VM becomes just a like another computer on your network, so you can configure it with a static address outside the DHCP scope of your router. What's with the route through China just to get to Rome from Berlin? You're making it yourself a lot harder than you need to.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
pomponiu
Posts: 1
Joined: 6. Apr 2011, 19:44
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: Windows XP

Re: Host-only networking: static IP guest addresses

Post by pomponiu »

Hi,

i have a similar problem (i.e., cannot ping the host IP address). First i will explain the context:
1) host OS - ubuntu 10.04 LTS

2) guest OS - windows XP prof.
IP address - 192.168.56.101

3) Network adapter type for the guest VM: host-only adapter
host-only adapter details:
-IP address:192.168.56.1
-DHCP server IP address: 192.168.56.100
-range: 192.168.56.101-192.168.56.254

When I try to ping 192.168.56.1 from guest - doesn't work.
When I try to ping 192.168.56.101 from host - doesn't work.

Could someone help me?
Thanks a lot,
Regards,
Victor
Post Reply