Page 1 of 1

Networking Problem

Posted: 1. Aug 2013, 14:51
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?

Re: Networking Problem

Posted: 1. Aug 2013, 15:12
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.

Re: Networking Problem

Posted: 1. Aug 2013, 15:12
by noteirak
What is wrong with Bridged?

Re: Networking Problem

Posted: 1. Aug 2013, 15:19
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

Re: Networking Problem

Posted: 1. Aug 2013, 15:23
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.

Re: Networking Problem

Posted: 1. Aug 2013, 15:36
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!

Re: Networking Problem

Posted: 1. Aug 2013, 16:14
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.

Re: Networking Problem

Posted: 1. Aug 2013, 16:21
by f4
I removed "gateway: 192.168.56.100" but there isn't still communication

Re: Networking Problem

Posted: 1. Aug 2013, 16:25
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.

Re: Networking Problem

Posted: 1. Aug 2013, 16:31
by f4
@Perryg: what do you mean by "information" ? how can I get it?

Re: Networking Problem

Posted: 1. Aug 2013, 16:41
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.

Re: Networking Problem

Posted: 1. Aug 2013, 17:04
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

Re: Networking Problem

Posted: 1. Aug 2013, 17:41
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?

Re: Networking Problem

Posted: 1. Aug 2013, 17:47
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

Re: Networking Problem

Posted: 1. Aug 2013, 18:48
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.