Help with networking guest vm

Discussions related to using VirtualBox on Windows hosts.
Krosty
Posts: 12
Joined: 20. May 2013, 17:34

Help with networking guest vm

Post by Krosty »

I think this is an old topic. I have VirtualBox installed in win7 pro box. I created two rhel 5 guests on it. I've been pounding the net and youtube last few days only to be frustrated by lack of clear information. I tried using internal network and host-only network so far. I watched a video (http://www.youtube.com/watch?v=bAxpBChGxas) where this guy configures a second adapter for internal network (in VirtualBox gui config tool) on two guests and when he logs into his guests and does ipconfig, the machines looked like magically got ip addresses (I think dhcp was enabled for him) and he was able to ping each other. I followed his instructions which is super simple, only to see that both my machines were still sitting on the VirtualBox default ip for a newly spun up guest - 10.0.2.15. Apparently my configuration change in VirtualBox gui-based configuration tool didn't take effect. Host-only adapter is even more confusing. I found some cool schematics (http://www.slideshare.net/powerhan96/ne ... irtual-box) on this type of networking in VirtualBox where they talked about creating a second adapter (not sure how they are asking it to be created - whether its through VirtualBox gui or you have to physically create another adapter in the guest box - eth1in Linux) for all the guests (much like internal network) and then wiring up all the second (eth1) adapters with the 'VirtualBox host-only ethernet adapter'. The way I'm understanding it, is that in this scheme 'VirtualBox host-only ethernet adapter' will act as the gateway between host and guests. So if the gateway has 10.1.2.1, guests will have to have 10.1.2.x. But like, my attempt with internal network, this addition of a second adapter through the VirtualBox gui (with dhcp enabled) didn't take effect. I'm not sure if I'm picking the right ip address for the gateway and dhcp server (I kept VirtualBox's default for dhcp for 'VirtualBox host-only ethernet adapter' which is 192.168.56.100) though. Any help will be much appreciated as to selection of gateway and dhcp adrresses. Another big area of my confusion about VirtualBox is whether adapters need to be added solely from VirtualBox gui and that'll configure the guest accordingly when you launch them. Or, you have to go in each box and create the other adapter there (I was having trouble doing this in rhel 5 also)
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Help with networking guest vm

Post by Perryg »

Krosty
Posts: 12
Joined: 20. May 2013, 17:34

Re: Help with networking guest vm

Post by Krosty »

How do you determine virtualBox's internal dhcp address and 'VirtualBox Host-only Ethernet Adapter' IPv4 address?
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Help with networking guest vm

Post by noteirak »

You'll find the answers in the User Manual via the link that Perryg gave you.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Help with networking guest vm

Post by Perryg »

Actually the easiest way to see the host-only information is to click file in the VirtualBox main manager and then preference. Select network and then edit the adapter to see the information.

Defaults are as follows unless you have changed it.
host
IP = 182.168.56.1 mask = 255.255.255.0
DHCP server starts at 192.168.56.101

See screen shots.
host-only-1.png
host-only-1.png (25.24 KiB) Viewed 3030 times
host-only-2.png
host-only-2.png (28.41 KiB) Viewed 3030 times
VirtualBox Internal network does not use DHCP by default.
Krosty
Posts: 12
Joined: 20. May 2013, 17:34

Re: Help with networking guest vm

Post by Krosty »

Thanks. I'm able to ping this 192.168.56.1 from host and guest. One thing I noticed is that host and guest machines are not being able to see each other. When I'm pinging a guest (192.168.0.4) from my win7 host (192.168.0.52)
I get following reply.

Pinging 192.168.0.4 with 32 bytes of data:
Reply from 192.168.0.52: Destination host unreachable.
Reply from 192.168.30.2: TTL expired in transit.
Reply from 192.168.30.2: TTL expired in transit.
Reply from 192.168.30.2: TTL expired in transit.

Ping statistics for 192.168.0.4:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

From guest, when I ping win7 host (192.168.0.52), it just says destination unreachable and unlike ping from host to guest, this time packet received is showing 0. I was basically trying to establish ssh connection between win7 host and RHEL guests down the road. I'm planning to run some deployment scripts (that uses Fabric, which is a python library to control remote machines) in my win7 host to deploy web apps to guest RHEL web server.
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Help with networking guest vm

Post by noteirak »

You need to use the IPs in the Host-Ony range - 192.168.56.x in the example provided.
For any other IP, you need to configure routing but that is way outside of the scope of this forum.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Help with networking guest vm

Post by Perryg »

Host-only = host and guest communication without the internet for the guest nor is a network connection actually needed

Internal = guest to guest only with no Internet by default.

NAT = Guest stand alone with internet isolated from the host but port forwarding is allowed.

Bridged = Full LAN access. Appears to be just another PC on the LAN with all connection types available.
Krosty
Posts: 12
Joined: 20. May 2013, 17:34

Re: Help with networking guest vm

Post by Krosty »

The ip VirtualBox's dhcp is handing out is in the 192.168.0.x range looks like. I'm a little confused about it because it doesn't fall within VirtualBox host-only adapter's dhcp range of 192.168.56.101-254
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Help with networking guest vm

Post by Perryg »

Run the following in a host terminal/command window

VBoxManage list histonlyifs
VBoxManage list bridgedifs.

Note: Windows users, you either need to be in the folder that has VBoxManage.exe or add the folder to the %path%
Krosty
Posts: 12
Joined: 20. May 2013, 17:34

Re: Help with networking guest vm

Post by Krosty »

I ran the host-only. Here's the output

C:\Program Files\Oracle\VirtualBox>vboxmanage.exe list hostonlyifs
Name: VirtualBox Host-Only Ethernet Adapter
GUID: fa3d14c2-ba18-431f-9334-ac21e489ae0a
DHCP: Disabled
IPAddress: 192.168.56.1
NetworkMask: 255.255.255.0
IPV6Address: fe80:0000:0000:0000:7d41:c6e0:0e4c:ecb1
IPV6NetworkMaskPrefixLength: 64
HardwareAddress: 08:00:27:00:74:bf
MediumType: Ethernet
Status: Up
VBoxNetworkName: HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Help with networking guest vm

Post by noteirak »

We need the output of both commands.
Please also include the output of :

Code: Select all

vboxmanage list dhcpservers
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Krosty
Posts: 12
Joined: 20. May 2013, 17:34

Re: Help with networking guest vm

Post by Krosty »

Actually I didn't want to put the details of my adapters in a public forum.


C:\Program Files\Oracle\VirtualBox>vboxmanage.exe list dhcpservers
NetworkName: HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter
IP: 192.168.56.100
NetworkMask: 255.255.255.0
lowerIPAddress: 192.168.56.101
upperIPAddress: 192.168.56.254
Enabled: Yes
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Help with networking guest vm

Post by noteirak »

On the host-only interface :
Krosty wrote:DHCP: Disabled
Seems like an issue to me.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Help with networking guest vm

Post by Perryg »

Actually the disabled on the host side is normal and expected since it would cause a conflict.

The list shows that your host-only DHCP server is configured to give out the 192.168.56.* address scheme so if you are seeing another address I am going to say it is from your router which is probably in the 192.168.0.* scheme, or you have another DHCP server running as well.
Post Reply