Restarting Networking on VM and Host

Discussions related to using VirtualBox on Linux hosts.
Post Reply
Angry
Posts: 24
Joined: 4. Sep 2008, 17:36

Restarting Networking on VM and Host

Post by Angry »

I have some VM's bridged to their own physical interface via instructions on this link. I've always wondered what exactly I should see in ifconfig for a Ubuntu host and any guest o/s. For example, sometimes I'll lose connection while a vm is running. So, on the host I'll do

Code: Select all

/etc/init.d/networking restart
And that may or may not work. I do the same thing on the guest o/s and that may or may not work as well. Is Virtualbox sensitive to restarting networking in this manner?

Here's another question. Sometimes ifconfig will show br0 having an ip address, or eth0, or vbox0, or any other interface on the host o/s. Should the host o/s interfaces be getting ip addresses, or should the guest o/s's show the ip address? Sometimes, I'll have an ip address on the host interface, and then a different one on the guest o/s so I've just taken up two ip addresses from they dhcp server.

I think summarily I want to know what is the best and safest way to troubleshoot a sudden loss of communication between a bridged VM and the node(s) to which it is communicating.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

Since you followed my advise from that topic, what is your current interfaces file config? Do you have Network Manager, that might get in the way? Be sure that only the bridge interface (br0 or similar) has a config stanza, the rest should be on manual or empty.
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.
Angry
Posts: 24
Joined: 4. Sep 2008, 17:36

Post by Angry »

Hi, Sasquatch :D I have the same configuration file except that I renamed the interfaces eth0, eth1, and eth2 by changing the association of their mac in /etc/udev/rules.d/70-persistent-net.rules. I'm not directly in front of the machine now but if you need me to post outputs I can get them momentarily.

I have it set up so eth0 is always the host interface, and eth1 and 2 are bridged to VM's. br1 and br2 connect eth1, vbox1 and eth2, vbox2. eth0 is of course not bridged and set to auto.

I usually use /etc/init.d/networking restart but sometimes I've had to set the host interface statically with a default gateway and I didn't know how to do it other than the network-admin applet (if that's what you meant when you said Network Manager).
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

Yeah, network-admin-applet is Network Manager (short NM-applet).

If you can, post your exact config. I'm assuming that your Host Interfaces eth1 and eth2 are physical interfaces and you note the virtual interfaces vbox1 and vbox2 in the VM settings.
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.
Angry
Posts: 24
Joined: 4. Sep 2008, 17:36

Post by Angry »

Yes, they are physical interfaces - I have three NIC's in the machine - and I do have each VM mapped to vbox1 and vbox2, respectively. I'm not at the machine right now but I should be able to get you a copy of that config tomorrow.
Angry
Posts: 24
Joined: 4. Sep 2008, 17:36

Post by Angry »

Finally got to the machine.

Code: Select all

auto lo
iface lo inet loopback

auto br1 br2
iface br1 inet static
address 0.0.0.0
netmask 255.0.0.0
bridge_ports eth1 vbox1

iface br2 inet static
address 0.0.0.0
netmask 255.0.0.0
bridge_ports eth2 vbox2

iface vbox1 inet manual
iface vbox2 inet manual



iface eth0 inet static
address 10.2.1.4
netmask 255.255.255.0
gateway 10.2.1.1

auto eth0

iface eth3 inet static
address 10.0.2.16
netmask 255.0.0.0

auto eth3
The reason that I wanted to restart networking was because 15 minutes before my professor entered the room it was all working, DNS was even going across the WAN link. Then when it was time to show him, it wasn't working :(

I dunno how the eth3 entry got in there but there is no eth3 so I'm just going to remove it.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

Well, that looks ok. Try adding eth1 and eth2 like you have vbox1 and vbox2 interfaces. If you haven't done already, remove NM-applet/Network Manager. That tends to get things really messed up. One time you have it working, and the next NM went along and changed your setup, making it no longer work.
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.
Post Reply