[CentOS-virt] Virtual Box Host Networking problems

Mon Nov 12 05:33:31 UTC 2007
Todd and Margo Chester <ToddAndMargo at verizon.net>

Todd and Margo Chester wrote:
> Dear Centos-Virt:
> 
> This is actually a second request for help on the
> same issue.  I finally got to try what several
> months ago was replayed to me and no joy was to
> be had.  I am afraid the original thread got stale
> and also had extra, unnecessary data in it.
> 
> Guest=XP Pro, SP2
> Host=CentOS5; # uname -r; 2.6.18-8.1.15.el5
> 
> VirtualBox-1.5.0_24069_rhel5-2.i586.rpm
> http://www.virtualbox.org/download/1.5.0/VirtualBox-1.5.0_24069_rhel5-1.i586.rpm.run 
> 
> 
> I have two nic: eth0 is the internal network; eth1 connects to a DSL modem.
> 
> I also have a fully functioning DHCP server on eth0 (works perfectly
> with Parallels for Linux).
> 
> The directions (from hell):
> http://www.virtualbox.org/download/UserManual.pdf
> 
> I am trying to set up a "host interface" network between
> my XP guest and my Linux host (eth0).

I do believe I FINALLY have it figured out.  I wrote myself
the following how to.  Please feel free to clean it up and
make it into an "Official CentOS 5 How To".

The only problem I have left is that the Guest XP can not
browse the Host's Samba server by SMB name (IP works fine)

-T

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

T's CentOS 5 -- Virtual Box "Host Networking" bridge setup:

Note: a lot of this is taken from (with lots of refinements):
       http://www.linuxweblog.com/virtualbox-host-networking


iptables:  after creating br0 at etho's expense, you have to
            change all references to "eth0" in your firewall
            to "br0"

br0: will become the internal interface and have a "Fixed" (static)
      IP address of 192.168.255.10


Support software (required);

    "VBoxAddIF" from Virtual Basic

     bridge-utils:
        yum install bridge-utils
 
ftp://ftp.pbone.net/mirror/ftp.centos.org/5.0/os/i386/CentOS/bridge-utils-1.1-2.i386.rpm


~~~~~~~~~~~~~~ /etc/rc.d/rc.local ~~~~~~~~~~~~~~~

# Set permissions on /dev/net/tun such that Virtual Box can use it
/bin/chmod 0666 /dev/net/tun
/bin/chmod 777 /dev/vboxdrv

# Restart the firewall
/etc/{iamnottellingyou}


~~~ /etc/sysconfig/network-scripts/ifcfg-eth0 ~~~

DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
USERCTL=yes
IPV6INIT=no
PEERDNS=no
BRIDGE=br0
ONBOOT=yes
PROMISC=yes


~~~ /etc/sysconfig/network-scripts/ifcfg-br0 ~~~

DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
BROADCAST=192.168.255.255
IPADDR=192.168.255.10
NETMASK=255.255.255.0
NETWORK=192.168.255.0
GATEWAY=192.168.255.10
ONBOOT=yes
USERCTL=yes
IPV6INIT=no
PEERDNS=no
PROMISC=yes


~~~ /etc/sysconfig/network-scripts/ifcfg-br0 ~~~

IPADDR=0.0.0.0
PROMISC=yes


~~~~~~~~ Initial and permanent setup ~~~~~~~~~~~

#! /bin/bash

# load the tun module
modprobe tunvi
chmod 666 /dev/net/tun

# Create a new bridge and add the interfaces to the bridge.
brctl addbr br0
brctl addif br0 eth0
/usr/bin/VBoxDeleteIF vbox0
/usr/bin/VBoxAddIF vbox0 tony br0
brctl addif br0 vbox0

# Bring up eth0 and vbox0 in promiscuous mode
# Commended out as it should be handles in "network-scripts"
#ifconfig eth0 promisc
#ifconfig vbox0 0.0.0.0 promisc

brctl addif br0 vbox0

# Now reboot (restarting networking doesn't work)
echo "Now reboot.  (I have no idea why)"