virtualbox bridged networking

User created HOW-TOs, guides and workarounds.

Moderators: aysabzevar, mandog, alan, bkashaf, xet7, cmost, blix

virtualbox bridged networking

Postby lawmanuk » Thu Aug 14, 2008 11:04 am

i understand parsix won't install the non-ose virtualbox by default, due to policy.

would be great if there was an option later to install it, as i always have problems when installing and running it manually later.

that aside, i've seen a few guides on making virtualbox have bridged networking. too complicated for me.

i need this so the guest os has a different lan ip, so it's a proper lan network.

does anyone here have an easy howto on giving virtualbox bridged networking?

thanks
lawmanuk
Parsix Lover
 
Posts: 148
Joined: Fri Aug 08, 2008 7:34 pm

RE: virtualbox bridged networking

Postby cmost » Thu Aug 14, 2008 11:46 am

I'm using the non-OSE version of virtual box in Parsix without issues; it was easy to install. There is a bit of a trick to enable USB support and I'll post the details later. Further, I'm using the NAT option, yet all of my virtual machines behave as though they are distinct machines on my home LAN (I can share files between them and ping them individually..) I've read up on this issue in the past but I don't remember the details of how I managed to set this up. I'll review the issue and get back to you shortly.

Have you also tried VMware Server (which is free) or QEMU (also free?) I used to be an avid VMware user myself (purchasing copies since 2.0,) however, I've since switched to VirtualBox and find it to be more than feature complete (and free!)
cmost
Forum Moderator
Forum Moderator
 
Posts: 212
Joined: Tue Feb 19, 2008 4:16 am
Location: Cincinnati, Ohio

RE: virtualbox bridged networking

Postby xet7 » Thu Aug 14, 2008 12:35 pm

cmost:
I have used VirtualBox-OSE version for a long time, I haven't had time to try non-OSE version, so it's great that you can post more details about how to get it working. But about the others:

VMware Server:
- I tried it some time ago
- Installed easily, they did not need kernel module patches as previous versions did
- I didn't have time to figure out how to get USB etc working

VMware Server older version:
- Installed and I could run some previous VMware images.

VMware Server newer beta version:
- Wow this thing is huge, how this takes so much disk space, huh is that some megasystem for supercomputers?


Qemu: Pro:
- Emulates full PC with processor, so WinXP harddrive image can be transferred to other PC where host with other processor or operating system (Linux Windows etc) and it "runs" there (see below).

Qemu: Con:
- well, even with KQemu kernel module, it's like VirtualBox runs, Qemu walks slowly.
xet7
Forum Moderator
Forum Moderator
 
Posts: 205
Joined: Wed Feb 20, 2008 12:22 pm
Location: Finland

RE: virtualbox bridged networking

Postby lawmanuk » Thu Aug 14, 2008 4:23 pm

vmware server just works in every way, but it is too big and slower than virtualbox. another bonus is that u can vmware access a physical windows host that is stored in a dual boot partition on the same disk as the linux host. virtualbox doesn't give let you mount physical disks as far as i know.

cmost - does your guest and host have different lan ip's? can your guest access network shared directories of your host, via the lan? i thought the point of bridged networking was to enable the above, as nat didn't solve this issue.

a small howto on installation with usb/sound/separate ip would be excellent.

thanks
lawmanuk
Parsix Lover
 
Posts: 148
Joined: Fri Aug 08, 2008 7:34 pm

RE: virtualbox bridged networking

Postby xet7 » Thu Aug 14, 2008 6:53 pm

lawmanuk:
Yes VirtualBox has aw raw hard disk access. At webpage:
http://www.virtualbox.org/wiki/Downloads
there is UserManual.pdf
and on PDF reader's calculated pagenumber 121 starts a chapter with the following text:

"9.9 Using a raw host hard disk from a guest
Starting with version 1.4, as an alternative to using virtual disk images (as described in
detail in chapter 5, Virtual storage, page 62), VirtualBox can also present either entire
physical hard disks or selected partitions thereof as virtual disks to virtual machines.
With VirtualBox, this type of access is called “raw hard disk access”; it allows a
guest operating system to access its virtual hard disk much more quickly than with
disk images, since data does not have to pass through two file systems (the one in the
guest and the one on the host)."

So when I think about it:
- VirtualBox is already very fast, WinXP installs to it much faster than on real hardware, and it's also fast in daily use
- with raw hard disk access it's even faster

I'm very busy for about 3 weeks but after that I want to test cmost tips and make new partition for raw hard disk access, that will be great fun :)
xet7
Forum Moderator
Forum Moderator
 
Posts: 205
Joined: Wed Feb 20, 2008 12:22 pm
Location: Finland

Postby cmost » Thu Aug 14, 2008 11:55 pm

Ok kids, here's how to get VirtualBox (the non-OSE) variant up and running with full USB support and access to local files. I'm utilizing my own setup for inspiration here so if others have a better way to accomplish something, please feel free to post.

A. Install VirtualBox from Sun Microsystems
1. Download the correct binary for Parsix. In this case, choose the binary for Debian 4.0 i386. Get it from this page: The latest version is 1.6.4
https://cds.sun.com/is-bin/INTERSHOP.en ... DS-CDS_SMI

2. Navigate to wherever you saved the above DEB file and right-click, chose 'open in terminal' to get to a command prompt

3. Type the following (as root; or use sudo if you have it setup) to install the package. Note: to gain root without sudo, type "su" and then your root password to get to a '#' prompt:
$sudo dpkg -i *.deb

4. After installing the software, go to System --> Administration --> Users & Groups and be sure to add yourself (username) to the vboxusers group. I also like to add the root user as well.

5. Restart the computer

6. Startup VirtualBox (note, you'll need to accept the license agreement. When you arrive at the main dialog, close the program.

B. Next we're going to setup USB support (before we install any virtual machines.)

1. Open up gnome-terminal and type:
su
<enter the root password>
#gedit /etc/udev/rules.d/20-permissions.rules

2. scroll down to this line and change it like the following:
# usbfs-like devices
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="vboxusers", \
MODE="0664"

Notice how I added , GROUP="vboxusers"? Save, close, exit.

3. Then, back in the gnome-terminal, type:

gedit /etc/fstab

Add this line as the last line:

none /proc/bus/usb usbfs devgid nnnn,devmode=664 0 0

But change that "nnnn" to whatever your vboxusers group ID number is. You can get the GID when you open the 'Users & Groups' dialog in the previous steps.

4. Reboot the computer. The USB system should be detected and working in your Guest operating systems. Note: A Kernel message at bootup might inform you that something or other doesn't start (since it's already started (failed),) but it doesn't adversely effect the Parsix system.

C. Finally, we're going to gain access to local files. The way we're going to do this is setup your Parsix host box as a SAMBA server. This way, your guests (including Linux guests) can access shared folders on the host with ease. Ready, set, let's go...

1. Open up Synaptic and search key word SAMBA... You'll want to ensure you get (at the minimum) and all dependencies:
Samba
samba common
smbclient
smbfs

2. Once you've installed SAMBA, simply type the following in a gnome-terminal (as root..gain root access however you need to, using 'su' followed by root password, or sudo...)

sudo gedit /etc/samba/smb.conf

3. Erase whatever is in your existing smb.conf and replace it with a version of the following... Note: you can modify however you wish. I like to simply share my home folder but you can opt to share any folder you like as long as you specify the path. Also, I like to share my local printer so that my virtual machines can print too! The way this is done, you'll have to download a local printer driver for any virtual machine in which you insall the printer. For example, if you have a Windows XP virtual machine, then you will need to download the printer driver for Windows XP within that virtual machine, and install it properly, in order to print to the Parsix local printer. It shouldn't be a problem.

------ start contents of /etc/samba/smb.conf ------------------
# Use Parsix GNU/Linux as a Workgroup Server via SAMBA

[global]
# System's host name, which appears in Network Places on Windows
netbios name = parsix-server

# server string is the equivalent of the NT Description field
server string = Parsix Linux Server

# Workgroup name
workgroup = workgroup

security = user
encrypt passwords = true

# Enable WINS server support
wins support = yes

# Ensure the SAMBA server maintains the role of master browser
local master = yes
preferred master = yes
os level = 65

# Enable Printing support on CUPS printers
printcap name = cups

# printcap cache time, so samba will automatically load new cups printers
printcap cache time = 60

printing = cups
load printers = yes

# Announce the availability of the SAMBA server
lm announce = yes
lm interval = 60

#========Share Definitions ==========
inherit permissions = yes
create mask = 0744
directory mask = 0744
case sensitive = no
hide dot files = yes
read only = no
force user = username ;enter your username here!

# Make Home directories on the server available to users
[homes]
comment = %u's Home Directory
browsable = no
read only = no
map archive = yes

[printers]
comment = All Printers
path = /var/tmp
browseable = no
# to allow user 'guest account' to print.
public = yes
guest ok = yes
writable = no
printable = yes

[print$]
comment = Printer drivers
path = /etc/samba/drivers
browseable = yes
guest ok = no
read only = yes
write list = @adm root

[PUBLIC]
path = /path/to/public/
comment = Public folder for access by anyone

------ end contents of /etc/samba/smb.conf ------------------

4. Save the smb.conf file

5. Restart the SAMBA server by typing the following into a root prompt in the gnome-terminal:

#/etc/init.d/samba restart

6. Add SAMBA enabled users - these are users authorized to access your newly created SAMBA server (e.g., your own username and the usernames of any user accounts logged into any Windows virtual machines you have (or will create.) In my case, I use the same username for my Parsix workstation and my Windows / Linux virtual machines. To add SAMBA enabled users, type the following at a root prompt in the gnome-terminal

#smbpasswd –a username
New SMB password: ********
Retype new SMB password:********

(note: you'll be prompted to enter a SMB password (see above) you should enter whatever password you want for that username.)

Fire up VirtualBox and install a guest operating system. Let's pretend you're installing Windows XP

7. Configure networking for guest machines...
For the 'Network' option, tick the box for 'Enable network adaptor' for adaptor 0

For Adapter type...leave as whatever it's defaulted to...

Select Attached to.. as NAT

Click the button for 'Generate a MAC address'

Tick the box for 'Cable connected'

When you log into your virtual machine, you should be able to access local files via the 'Network Neighborhood' in Windows!

Enoy!!
Last edited by cmost on Fri Aug 15, 2008 3:16 am, edited 3 times in total.
cmost
Forum Moderator
Forum Moderator
 
Posts: 212
Joined: Tue Feb 19, 2008 4:16 am
Location: Cincinnati, Ohio

Postby lawmanuk » Fri Aug 15, 2008 1:13 am

wow, excellent stuff.

didn't know it could do raw hard disks. that means i can virtual boot all physical partitioned os's aswell.

if it's got bridged networking that will just be perfect.

need to give all of this a try.
lawmanuk
Parsix Lover
 
Posts: 148
Joined: Fri Aug 08, 2008 7:34 pm

Postby cmost » Fri Aug 15, 2008 2:32 am

My instructions have been updated...see my original post above! :-)
AMD Phenom II 64 X6 1090T Black Edition Hexa-Core
8192 MB DDR2 RAM
nVidia GeForce GTX 660 w 2048 MB DDR5
Linux Mint Debian Edition 64 Bit
Parsix (Debian Testing) GNU/Linux 64 Bit
Liquorix Kernel 3.12.x
cmost
Forum Moderator
Forum Moderator
 
Posts: 212
Joined: Tue Feb 19, 2008 4:16 am
Location: Cincinnati, Ohio

Postby xet7 » Fri Aug 15, 2008 7:19 pm

I have added link to this thread to wiki:

English Howtos => Topic: Install more software and change settings / Howto install VirtualBox non-OSE with full USB support and access to local files
http://www.parsix.org/html/index.php?mo ... g=HowTosEn
xet7
Forum Moderator
Forum Moderator
 
Posts: 205
Joined: Wed Feb 20, 2008 12:22 pm
Location: Finland

Postby lawmanuk » Tue Aug 19, 2008 7:29 pm

at stage b1. i get the following error:

root@parsix1:/home/user# gedit /etc/udev/rules.d/20-permissions.rules

(gedit:4712): libgnomevfs-WARNING **: Unable to create ~/.gnome2 directory: No such file or directory
Could not create per-user gnome configuration directory `/home/root/.gnome2/': No such file or directory
root@parsix1:/home/user#
lawmanuk
Parsix Lover
 
Posts: 148
Joined: Fri Aug 08, 2008 7:34 pm

Postby cmost » Tue Aug 19, 2008 9:10 pm

I don't know what user directory you're in, but gedit cannot create its scratch file. I would recommend you launch gedit from within the root environment, or by using sudo.
cmost
Forum Moderator
Forum Moderator
 
Posts: 212
Joined: Tue Feb 19, 2008 4:16 am
Location: Cincinnati, Ohio

Postby lawmanuk » Wed Aug 20, 2008 12:55 am

on adding usb... the file that is opened, is completely blank! nothing for me to edit...

on accessing raw disk....

i've tried adding a physical disk to vbox... the problems are:

1. to add partitions only - this feature has a bug so can't be used properly.

2. to add whole disk, we are supposed to use:

VBoxManage internalcommands createrawvmdk -filename /path/t/file.vmdk -rawdisk /dev/sda -register

u can't do this in user, as no rights.
when u do this as root, u can't run as user, so have to start vbox as root again
tried chmod 777 on file.vmdk, but that doesn't help.

other than running vbox as root, any other solution?
lawmanuk
Parsix Lover
 
Posts: 148
Joined: Fri Aug 08, 2008 7:34 pm

Postby xet7 » Wed Aug 20, 2008 11:57 am

lawmanuk:
Have you added your user account to vboxusers group? There's no need to run VirtualBox as root.

1) Click System / Administration / Users and Groups

2) Click Manage Groups

3) Scroll down and click vboxusers

4) Click Properties

5) Checmark your username and Click OK, Close, Close

6) Logout and Login

7) Applications / System Tools / VirtualBox
xet7
Forum Moderator
Forum Moderator
 
Posts: 205
Joined: Wed Feb 20, 2008 12:22 pm
Location: Finland

Postby lawmanuk » Wed Aug 20, 2008 6:35 pm

user is added to vboxusers, but to use rawdisk feature, u need admin access rights, so have to use sudo or su.

was just wondering if there was a way to use rawdisk without admin rights.
lawmanuk
Parsix Lover
 
Posts: 148
Joined: Fri Aug 08, 2008 7:34 pm

Postby xet7 » Wed Aug 20, 2008 10:16 pm

lawmanuk:
Do you mean the same as in Truecrypt howto, so that VirtualBox needs to be added to sudoers list with visudo, so root password does not need to be entered?

http://lauri.ojansivu.googlepages.com/p ... #TrueCrypt
xet7
Forum Moderator
Forum Moderator
 
Posts: 205
Joined: Wed Feb 20, 2008 12:22 pm
Location: Finland

Next

Return to HOW-TOs - English

Who is online

Users browsing this forum: Google [Bot] and 1 guest