Page 10 of 15 FirstFirst ... 89101112 ... LastLast
Results 91 to 100 of 150

Thread: HOWTO VirtualBox Host networking

  1. #91
    Join Date
    Jan 2008
    Beans
    24

    Re: HOWTO VirtualBox Host networking

    If you create TAP/TUN interface and network bridge using /etc/network/interfaces, uml_proxy* lines are not needed.

    My /etc/network/interfaces looks like this.
    Code:
    auto lo
    iface lo inet loopback
    
    iface eth0 inet manual
    
    auto tap0
    iface tap0 inet manual
      tunctl_user myusername
    
    auto br0
    iface br0 inet dhcp
      bridge_ports eth0 tap0
      bridge_maxwait 0
    The TUN/TAP interface must be created before the bridge starts ('auto tap0' before 'auto br0').
    The user account (myusername) must be a member of vboxusers and uml-net groups to be able to use tap0 wtith VirtualBox.

    My br0 get an IP address (192.168.x.x) automatically from DHCP server on another computer. My guest OS also gets an IP address (192.168.x.x) automatically from the DHCP server and can communicate well with other computers on the network.

    My network use 2 subnet on the same LAN hardware, so I added another IP address from different subnet to the bridge interface by editing /etc/network/interfaces file and add these lines.
    Code:
    auto br0:1
    iface br0:1 inet static
      address 10.0.0.99
      netmask 255.0.0.0
      gateway 10.0.0.9
    Now my computer has 2 IP addresses and can communicate with both subnet. The virtual machine still communicates well like before.


    To allow multiple users to run virtual machine with host network bridge, the file /etc/network/interfaces can be written like this.
    Code:
    auto lo
    iface lo inet loopback
    
    iface eth0 inet manual
    
    auto tap0 tap1 tap2 tap3
    iface tap0 inet manual
      tunctl_user cid
    iface tap1 inet manual
      tunctl_user barret
    iface tap2 inet manual
      tunctl_user cloud
    iface tap3 inet manual
      tunctl_user cid
    
    auto br0
    iface br0 inet dhcp
      bridge_ports eth0 tap0 tap1 tap2 tap3
      bridge_maxwait 0
    cid, barret, cloud must be members of vboxusers and uml-net groups to use these TUN/TAP interface with VirtualBox.

    In this example, cid will be able to run 2 virtual machines that can communicate with each other, host machine, and other computers in the network (using tap0, tap3).
    While one of cid's virtual machine is running, if cloud comes and logon to his account, then starts his virtual machine (using tap2), his virtual machine will be able to can communicate with cid's virtual machine, host machine, and other machines on the network as well.
    I have not tried running more than 2 virtual machines at the same time.
    Last edited by karyonix; January 23rd, 2008 at 06:03 PM.

  2. #92
    Join Date
    May 2007
    Beans
    46

    Re: HOWTO VirtualBox Host networking

    Hallo

    I read and tried a lot but I can't get it working after reboot:
    I use Ubuntu 7.10 64bit and installed the deb package from virtualbox 1.5.4.
    I installed bridge-utils + uml-utilities

    Now I made this for networking:

    sudo modprobe tun

    sudo tunctl -u username -t tap0

    sudo ifconfig tap0 0.0.0.0 promisc up

    sudo tunctl -u username -t tap1

    sudo ifconfig tap1 0.0.0.0 promisc up

    sudo tunctl -u username -t tap2

    sudo ifconfig tap2 0.0.0.0 promisc up

    sudo chmod 0666 /dev/net/tun

    sudo brctl addbr br0

    sudo brctl addif br0 eth0

    sudo brctl addif br0 tap0

    sudo brctl addif br0 tap1

    sudo brctl addif br0 tap2

    sudo ifconfig br0 192.168.2.9 netmask 255.255.255.0 broadcast 192.168.2.255 up

    sudo ifconfig eth0 0.0.0.0 promisc up

    sudo route add default gw 192.168.2.1

    +++
    So, 192.168.2.9 ist my host ubuntu and i can give my VM's static IP's like 192.168.2.10 etc.

    This works now ! Now I like to have this after reboot. I tried to add this to the rc.local file
    (/etc/rc.local) but nothing works after reboot. I have to do it again !
    This would not be the biggest prob, but if I make a reboot via vnc I cannot make this by hand cause after one of these commands the network dies and I can't reconnect.

    this is what I added:

    # For VirtualBox Host Interface Networking
    /sbin/modprobe tun
    /usr/sbin/tunctl -u username -t tap0
    /sbin/ifconfig tap0 0.0.0.0 promisc up
    /usr/sbin/tunctl -u username -t tap1
    /sbin/ifconfig tap1 0.0.0.0 promisc up
    /usr/sbin/tunctl -u username -t tap2
    /sbin/ifconfig tap2 0.0.0.0 promisc up
    /bin/chmod 0666 /dev/net/tun
    /usr/sbin/brctl addbr br0
    /usr/sbin/brctl addif br0 eth0
    /usr/sbin/brctl addif br0 tap0
    /usr/sbin/brctl addif br0 tap1
    /usr/sbin/brctl addif br0 tap2
    /sbin/ifconfig br0 192.168.2.9 netmask 255.255.255.0 broadcast 192.168.2.255 up
    /sbin/ifconfig eth0 0.0.0.0 promisc up
    /sbin/route add default gw 192.168.2.1

    I also tried to make a bash script but nothing worked for me. Does anyone has an ides how to make this work after rebbot oder just a script which I can use to make these commands automatically.
    Thanx
    Irvin

  3. #93
    Join Date
    Jan 2008
    Beans
    24

    Re: HOWTO VirtualBox Host networking

    #92 irvin
    The scripts you wanted is already installed with packages bridge-utils and uml-utilities. If you want to read these scripts, you can see them in subdirectories of /etc/network.
    Try these step to make it works after next boot.

    Let the module tun be loaded automatically at startup.
    Take a look at /etc/modules. If 'tun' is not already there, add it to the file.
    Code:
    sudo echo 'tun' >> /etc/modules
    Make your username a member of uml-net group with this command.
    Code:
    sudo gpasswd -a username uml-net
    And modify your network configuration file /etc/network/interfaces like this.
    Code:
    auto lo
    iface lo inet loopback
    
    iface eth0 inet manual
    
    auto tap0 tap1 tap2
    iface tap0 inet manual
      tunctl_user username
    iface tap1 inet manual
      tunctl_user username
    iface tap2 inet manual
      tunctl_user username
    
    auto br0
    iface br0 inet static
      bridge_ports eth0 tap0 tap1 tap2
      bridge_maxwait 0
      address 192.168.2.9
      netmask 255.255.255.0
      gateway 192.168.2.1

  4. #94
    Join Date
    May 2007
    Beans
    46

    Re: HOWTO VirtualBox Host networking

    Hi "karyonix"

    Many thanx for your help, I tried your settings but it didn't work for me. I'm sorry but I don't understand everything you wrote. I'm missing in your code who's makiing the bridge, may that's the problem ?

    I'm just happy to have it run my way, but I need the autostart version

    So many wrote it's working for them, but isn't it possible to make my commands automatically after reboot ?

    Bye

  5. #95
    Join Date
    May 2007
    Beans
    46

    Re: HOWTO VirtualBox Host networking

    Hallo

    Now it works !!! I tried several things, don't know where my mistake really was ?

    I did this now:

    Make your username a member of uml-net group with this command.

    sudo gpasswd -a username uml-net

    and the edit or change the /etc/network/interfaces file like this:
    Mine looks like this now:

    ----
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).

    # The loopback network interface
    auto lo
    iface lo inet loopback

    # The primary network interface
    # auto eth0
    # iface eth0 inet dhcp

    iface eth0 inet manual

    auto tap0 tap1 tap2 tap3
    iface tap0 inet manual
    tunctl_user username
    iface tap1 inet manual
    tunctl_user username
    iface tap2 inet manual
    tunctl_user username
    iface tap3 inet manual
    tunctl_user username

    auto br0
    iface br0 inet static
    address 192.168.2.9
    netmask 255.255.255.0
    gateway 192.168.2.1
    bridge_maxwait 0
    bridge_ports eth0 tap0 tap1 tap2 tap3
    bridge_fd 0
    ----

    Now I have my static ip for the host and taps for 4 guests with static ip's.
    It works great !
    Thanx again !!!

    I only didn't do the "tun" in the modules and made a different order.

  6. #96
    Join Date
    May 2007
    Beans
    27

    Re: HOWTO VirtualBox Host networking

    I've tried MKDon's method (post 56) of setting up host networking by doing the following...

    Code:
    sudo chown root:vboxusers /dev/net/tun
    sudo tunctl -t tap1 -u qopit
    sudo ip link set tap1 up
    sudo ip addr add 192.168.1.201/24 dev tap1
    sudo parprouted -p ra0 tap1
    and it results in the following ifconfig output on my host pc:

    Code:
    eth1      Link encap:Ethernet  HWaddr 00:0E:35:D2:FE:F4  
              inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
              inet6 addr: fe80::20e:35ff:fed2:fef4/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:8713 errors:2 dropped:2 overruns:0 frame:0
              TX packets:9257 errors:0 dropped:0 overruns:0 carrier:1
              collisions:0 txqueuelen:1000 
              RX bytes:2234626805 (2.0 GB)  TX bytes:776806216 (740.8 MB)
              Interrupt:22 Base address:0xc000 Memory:c8400000-c8400fff 
    
    eth2      Link encap:Ethernet  HWaddr 00:14:C2:D5:5F:A4  
              UP BROADCAST MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
              Interrupt:16 
    
    eth2:avah Link encap:Ethernet  HWaddr 00:14:C2:D5:5F:A4  
              inet addr:169.254.8.200  Bcast:169.254.255.255  Mask:255.255.0.0
              UP BROADCAST MULTICAST  MTU:1500  Metric:1
              Interrupt:16 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:30424 errors:0 dropped:0 overruns:0 frame:0
              TX packets:30424 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:11129148 (10.6 MB)  TX bytes:11129148 (10.6 MB)
    
    tap1      Link encap:Ethernet  HWaddr 00:FF:D9:00:23:BF  
              inet addr:192.168.1.201  Bcast:0.0.0.0  Mask:255.255.255.0
              inet6 addr: fe80::2ff:d9ff:fe00:23bf/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:55 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:17 overruns:0 carrier:0
              collisions:0 txqueuelen:500 
              RX bytes:4718 (4.6 KB)  TX bytes:0 (0.0 b)
    Seems reasonable and I can ping the address I created (192.168.1.201) from the host. In addition, VB will start up properly when I connect host networking to tap1 (and it fails if I specify something incorrect like tap2).

    However - when I get into my guest system the guest can't actually connect... is there something I'm missing? It all seemed so promising...

  7. #97
    Join Date
    Jan 2008
    Beans
    6

    Re: HOWTO VirtualBox Host networking

    Hi,

    I've tried everything, I use the /etc/network/interfaces for the setup it looks like this:
    Code:
    auto lo
    iface lo inet loopback
    
    auto eth0
    iface eth0 inet manual
    
    auto tap0
    iface tap0 inet manual
            tunctl_user {user}
    
    auto br0
    iface br0 inet static
            address 192.168.1.58
            network 192.168.1.0
            netmask 255.255.255.0
            gateway 192.168.1.1
            bridge_ports eth0 tap0
            bridge_maxwait 0
            brdige_fd 0
    I use Debian etch 4.0 as guest operating system, I set tap0 for host networking in virtualbox, but after booting the guest, it doesn't have any ethernet cards. typing an ifconfig results in shoing the loop back device and that's it.

    a little off topic, but once I maximized the virtualbox guest window. and I have not found a way to unmaximize it. so I can not run it in a little window. any ideas?
    Last edited by trifftruff; February 15th, 2008 at 08:51 PM. Reason: unmaximizing issue

  8. #98
    Join Date
    Jan 2008
    Beans
    6

    Re: HOWTO VirtualBox Host networking

    I successfully reached that after (and even before) an:
    apt-get purge uml-utilities bridge-utility

    the guest OS doesn't even work with NAT. As I said, it doesn't have any network adapters shown, only the loop device.

  9. #99
    Join Date
    Jan 2008
    Beans
    24

    Re: HOWTO VirtualBox Host networking

    trifftruff
    Make sure you have enabled network adapter in VirtualBox - Virtual Machine Settings - Network.
    If you already do that and it does not work even with NAT settings, try different guest OSes.

  10. #100
    Join Date
    Jan 2008
    Beans
    6

    Re: HOWTO VirtualBox Host networking

    It has worked before with NAT, but I tried so many variations to use host interface and bridging (starting with the one in the virtualbox manual) and neither worked, that somehow I messed it up. I think I'll reinstall virtualbox and try again.

Page 10 of 15 FirstFirst ... 89101112 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •