Networking Problem

Discussions related to using VirtualBox on Windows hosts.
Post Reply
f4
Posts: 11
Joined: 27. Jul 2013, 14:15

Networking Problem

Post by f4 »

ok I'm driving crazy to solve this:

I've a host Windows 7 connected to a LAN and a guest Ubuntu. What I need is a network setup that matches this conditions:

1) host-guest communication
2) guest internet access
3) STATIC IP address for the guest

In Virtualbox I chose NAT but it doesn't work as well as host-only adapter. Maybe it's a matter of host and guest setting.

ANY IDEA?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Networking Problem

Post by Perryg »

If you have a router in the LAN a single adapter set to Bridged would be the best.
If not then you need to use NAT for one adapter and add a second adapter set to host-only.
See chapter 6 in your VirtualBox users manual.
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: Networking Problem

Post by noteirak »

What is wrong with Bridged?
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
f4
Posts: 11
Joined: 27. Jul 2013, 14:15

Re: Networking Problem

Post by f4 »

Yes, but with bridged the guest is assigned a dynamic IP and what I want is a STATIC IP for the guest because I'm going to use it as a server
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Networking Problem

Post by mpack »

f4 wrote:Yes, but with bridged the guest is assigned a dynamic IP
No it isn't. The VM only gets a dynamic IP if the guest OS is configured to use DHCP, and a DHCP server is present on the network - e.g. a router.

VirtualBox itself does not assign IP addresses to VMs which are using bridged networking.
f4
Posts: 11
Joined: 27. Jul 2013, 14:15

Re: Networking Problem

Post by f4 »

ok I set the adapter to "bridged" and on the guest (ubuntu) I edited /etc/network/interfaces so as to have this:

#the primary network interface
auto eth0
iface eth0 inet static
address 192.168.56.2
netmask 255.255.255.0
gateway 192.168.56.100 (i'm not sure what to put here)

On the host, instead, I have two IP addresses:

Ethernet LAN: 10.165.132.106
VirtualBox Host-only: 192.168.56.1

and the firewall is completely disabled.

However there is no communication!
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Networking Problem

Post by mpack »

Those look awfully like host-only network addresses. It doesn't seem like a great idea to assign those to a bridged-mode guest.

I'm no networking expert, but my understanding of "gateway" is this. Every packet you send will have a from and to IP address - the endpoints of the connection. The gateway is the like the mailman: you hand the packet over to him and he moves it along to the next collection point. It would be counter productive to provide the name of a mailman (or address of a gateway) that doesn't exist.
f4
Posts: 11
Joined: 27. Jul 2013, 14:15

Re: Networking Problem

Post by f4 »

I removed "gateway: 192.168.56.100" but there isn't still communication
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Networking Problem

Post by Perryg »

10.165.132.106

You need to use an address that is in the same subnet as the router, not the host-only subnet.

Easiest way to see what to use is set the guest to use DHCP and you will see the proper information and what to use. Write down the information and then change it to static.
f4
Posts: 11
Joined: 27. Jul 2013, 14:15

Re: Networking Problem

Post by f4 »

@Perryg: what do you mean by "information" ? how can I get it?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Networking Problem

Post by Perryg »

Read my reply closer. It tells you the easiest way to find out the information that you need.

hint: ifconfig -a in the guests terminal will show the network information that the guest is using.
f4
Posts: 11
Joined: 27. Jul 2013, 14:15

Re: Networking Problem

Post by f4 »

I created a static network interface by copying the information of the dynamic one. Now everything communicates (thanks Perryg) but I wonder if there is the risk of IP conflict by setting a static IP in a DHCP environment
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Networking Problem

Post by mpack »

f4 wrote:I wonder if there is the risk of IP conflict by setting a static IP in a DHCP environment
Certainly there is. You can solve that either by disabling the DHCP server, or reconfigure it to omit your static IP. Why do you need a static IP anyway? Why not just let the DHCP server do what it's supposed to?
f4
Posts: 11
Joined: 27. Jul 2013, 14:15

Re: Networking Problem

Post by f4 »

because on the guest I want to configure OpenAM (ex Sun OpenSSO) which to work properly needs a static IP, as far as I know
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Networking Problem

Post by Perryg »

f4 wrote:I created a static network interface by copying the information of the dynamic one. Now everything communicates (thanks Perryg) but I wonder if there is the risk of IP conflict by setting a static IP in a DHCP environment
Well that would depend on your router. No one can actually answer that one for you, you need to find out yourself. Most home routers only set asside a certain amount of addresses that the DHCP server will actually give out on request. As long as the address is within the subnet and outside the DHCP server range you should be fine.
Post Reply