Difference between revisions of "VirtualBox"

From Blue-IT.org Wiki

(Assumptions)
(Important to know:)
Line 37: Line 37:
 
[[Image:Eth0_br0.png|The bridge takes over a physical NIC]]
 
[[Image:Eth0_br0.png|The bridge takes over a physical NIC]]
  
* You should understand, that the bridged network (e.g. br0) will completely superseding  the original network card (e.g. eth0).
+
You should understand, that the bridged network (e.g. br0) will completely superseding  the original network card (e.g. eth0).
* '''All settings''' of the connected physical network card, including ipaddress, routes, gateway setting etc. '''must''' be transferred to this bridge. This assures, that the system is reachable from the outside like before.
+
 
 +
'''All settings''' of the connected physical network card, including ipaddress, routes, gateway setting etc. '''must''' be transferred to this bridge. This assures, that the system is reachable from the outside like before.
  
 
===Virtual network configuration on the ubuntu/debian host===
 
===Virtual network configuration on the ubuntu/debian host===

Revision as of 18:07, 11 September 2007

Changelog

--Apos 18:11, 10 September 2007 (CEST) All tested with ubuntu feisty host machine and VirtualBox version 1.5. The machine is a 2 GHZ AMD Athlon with two network cards.

General

I am not explaining the installation of a guest virtual machine here. This guide's only purpose is to point to the major pitfalls configuring the network.

Ubuntu Feisty

Installation

Most important informations you will find on the excellent download pages at the wiki of Innotec.

Edit the source.list

vim /etc/apt/sources.list

# Virtual Box
deb http://www.virtualbox.org/debian feisty non-free

Get the gpg key from innotec

wget http://www.virtualbox.org/debian/innotek.asc \
&& apt-key add innotek.asc \
&& apt-get update \
&& apt-get install virtualbox

Prepare the user

Each user has to be part of the vboxusers group

gpasswd -a your_username vboxusers

Configuring the network - Prerequisites

Assumptions

Two network cards.

Our machine has two network cards: eth0 and eth1.

  • eth0 will be used for the bridged network. It connects internal to the brigde.
  • eth1 will be left alone. It is e.g. a gigabit network card for the heavier internal network traffic.

Important to know:

The bridge takes over a physical NIC

You should understand, that the bridged network (e.g. br0) will completely superseding the original network card (e.g. eth0).

All settings of the connected physical network card, including ipaddress, routes, gateway setting etc. must be transferred to this bridge. This assures, that the system is reachable from the outside like before.

Virtual network configuration on the ubuntu/debian host

  • br0 is the name of the bridge. It gets the IP of eth0, but this is just for convenience.
  • tap0 is the name of the virtual network card, that connects to br0

Configure the virtual machines settings for the network adapter:

  1. Use host interface networking.
  2. The device for the first virtual guest is called tap0.
  3. If you use more than one guest (in parellel) you have to install more tap devices, tap1, tap2 and so on. They all can connect to br0

Configuring the network - Concrete

Links: the best ..., interesting ..., be careful ....

Install the uml and bridge utilities:

apt-get install uml-utilities bridge-utils

Alter the default way, ubuntu assigns the rights for

vim /etc/network/if-pre-up.d/uml-utilities
#chown root:uml-net /dev/net/tun
chown root:vboxusers /dev/net/tun

Configuration files

The tap and bridge devices will be configured using the default ubuntu network scripts:

vim /etc/network/interfaces
# this_gigabit_server
auto eth0
 iface eth0 inet static
 address 192.168.0.4
 netmask 255.255.255.0
 up route add another_gigabit_server gw this_gigabit_server eth0
 up route add another_server gw this_gigabit_server eth0

# this_server
auto eth1
iface eth1 inet manual

# tap devices
# - install more if necessary
auto tap0
iface tap0 inet manual
 tunctl_user apos
 uml_proxy_arp this_server
 uml_proxy_ether eth1
  
# bridge
auto br0
iface br0 inet static
 address 192.168.0.3
 netmask 255.255.255.0
 up route add notebook gw this_server br0
 up route add notebook_wlan gw this_server br0
 up route add server_two gw this_gigabit_server br0
 gateway 192.168.0.254
 # bridge_ports eth1 tap0 tap1 tap2 ...
 bridge_ports eth1 tap0
 bridge_maxwait 0

/etc/init.d/networking restart

Filesharing with samba

According to the Ubuntu Starter Guide install samba and feel free to eather connect via network disks or the connection wizard.

For using network disks inside of Windows NT/XP do

net use x: /ip_samba_server/name_of_share /PERSISTENT:yes

inside of a command terminal.