Networking (not newbie)

Discussions related to using VirtualBox on Linux hosts.
Post Reply
ckozleriii
Posts: 5
Joined: 6. Feb 2009, 04:09

Networking (not newbie)

Post by ckozleriii »

Hi everyone,

Any help on this topic would be GREATLY appreciated. Here is my case.

I am creating a small network for a school project. I can NOT hook up any routers to my Uni's ethernet connections because if they discover it, with or without DHCP, they will disable my port. Obviously, this is counter productive... So I figured I would try to just keep it strictly within VirtualBox.

I am trying to network all guests of VirtualBox together. I have tried many many things. Here is a brief overview:

NAT:

For whatever reason, I do not know if this is the case or not BUT it seems as if VirtualBox sets up a new NAT network environment for every VirtualBox guest. For instance:

Server1:
- Network Configuration: NAT
- IP Assigned via "DHCP": 10.0.2.15
- Can ping out to google.com from Server1
- All gateways, DNS, and DHCP set correctly

Server2:
- Network Configuration: NAT
- IP assigned via "DHCP": 10.0.2.15
- Can ping out to google.com from Server2
- All gateways, DNS, and DHCP set correctly

Now, what I do not get is that every Guest keeps getting the same IP even though it says its assigned via "DHCP". I tried to set Server2's default gateway, IP, and DNS but I still can not connect the Virtual Machines together through the NAT setting. No response pinging either server.


Host Interfacing (bridge connections):

I can use host interfacing BUT I run into a lot of problems with my Uni's connection for what I am trying to do (setup DNS servers, etc).

I have also tried this: http://www.virtualbox.org/wiki/Advanced ... king_Linux

But it yields the same results as above with setting the network to NAT. I setup all the guests, set the routes, set all the host tap devices but...when I try to ping another guest, no response is received and its deemed unreachable.


My main question, how can I connect all the guests together WITHOUT using host interfacing. I want my own local network of guests that I can connect together. Essentially I want to access guests from within other guests. So I can setup 4 servers and enable SSH/remote administration and access any guest from any guest.
ckozleriii
Posts: 5
Joined: 6. Feb 2009, 04:09

Post by ckozleriii »

Also, I have followed this

http://www.fridu.org/hosting/81-virtual ... ote-access

And have successfully setup DNSmasq to give my guests 192.168.1.* addresses...I still can not access my guests from other guests. Pinging doesnt even work let alone handling any kind of connections or listening for any connections. Any ideas?
Harald
Posts: 7
Joined: 6. Feb 2009, 22:33

Post by Harald »

Regarding the DHCP solution:

Each virtual machine sees its own DHCP-server, and thus gets the same IP-address. Also each machine has its own NAT gateway, which translates from the internal IP-address to the public addresses - but both machines are isolated.

Host interfacing:
this works on Layer 2 (Ethernet), so the machines appear as if they were all connected to the same Ethernet port your Host machine is connected to (as if they are all connected via a Ethernet switch). You probably shouldn't use this if you aren't allowed to connect more than one machine (depends on your configuration).

Can't check this at the moment, but you probably should try "internal networking". Choose the same setting for all VMs, and then they should be able to reach each other - but they won't be able to reach any other computer on the real network.You'll probably have to setup IP addresses yourself (no DHCP).

Using TUN-interfaces and Linux bridges should work too, but in your post there are some details missing. Most importantly, which version of VBox are you using? The networking code has changed in the recent versions... And you should start with a simpler setup for diagnosing the problem.
ckozleriii
Posts: 5
Joined: 6. Feb 2009, 04:09

Post by ckozleriii »

Harald wrote:Regarding the DHCP solution:

Each virtual machine sees its own DHCP-server, and thus gets the same IP-address. Also each machine has its own NAT gateway, which translates from the internal IP-address to the public addresses - but both machines are isolated.

Host interfacing:
this works on Layer 2 (Ethernet), so the machines appear as if they were all connected to the same Ethernet port your Host machine is connected to (as if they are all connected via a Ethernet switch). You probably shouldn't use this if you aren't allowed to connect more than one machine (depends on your configuration).

Can't check this at the moment, but you probably should try "internal networking". Choose the same setting for all VMs, and then they should be able to reach each other - but they won't be able to reach any other computer on the real network.You'll probably have to setup IP addresses yourself (no DHCP).

Using TUN-interfaces and Linux bridges should work too, but in your post there are some details missing. Most importantly, which version of VBox are you using? The networking code has changed in the recent versions... And you should start with a simpler setup for diagnosing the problem.
Thank you for the response.

I have tried "internal networking" and can not seem to find any strong information on configuring it. I have tried using internal network, selected the same internal network name for all the VM's. From there though, I am assuming i would have to connect it to some psuedo-gateway and configure it the same way (different IP's of course) for all of the VM's to get them to talk?

I need to get the VM's to talk to each other, I can use NATting and IP tables on the host to enable internet for one or all of them. Although, at this point, I am more concerned with trying to get them to talk to each other without using host interfacing.

My primary goal is to connect all the VM's together without using host interfacing while still enabling them to access the outside world. Is this possible?
baf
Volunteer
Posts: 829
Joined: 27. Sep 2008, 06:18
Primary OS: Mac OS X Leopard
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: linux,xp,win7
Location: Luleå or Skellefteå, Sweden

Post by baf »

One way:
Each machine has one nated network card setting dhcp.
And one internal network(same net-name) with either static address or one of the machines acting as dhcp-server.
Some say: "You learn as long as you live".
My way: "You live as long as you learn".
Harald
Posts: 7
Joined: 6. Feb 2009, 22:33

Post by Harald »

ckozleriii wrote: From there though, I am assuming i would have to connect it to some psuedo-gateway and configure it the same way (different IP's of course) for all of the VM's to get them to talk?
As long as machines are on the same subnet (i.e. ethernet broadcast domain), they don't need a gateway to talk to each other. Just give them all an IP address in the same (private) subnet.

If they need connectivity to the outside world, baf's solution is probably the simplest possibility.
ckozleriii
Posts: 5
Joined: 6. Feb 2009, 04:09

Post by ckozleriii »

Thanks guys. I have been messing around again tonight with it. I will give that a try right now and post back with the results.
ckozleriii
Posts: 5
Joined: 6. Feb 2009, 04:09

Post by ckozleriii »

That did it!

Thank you SO much. I have been trying to figure this out for so long. I feel dumb :oops:
Post Reply