LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 06-14-2008, 12:00 PM   #1
bps7j
LQ Newbie
 
Registered: Mar 2003
Location: Virginia
Distribution: RedHat 8, RedHat 7.3, Gentoo
Posts: 2

Rep: Reputation: 0
VirtualBox networking does not work with Host Interface


I've installed Ubuntu Hardy Heron 8.04 on my laptop, which uses a wireless network, and then installed VirtualBox. I want to set up a virtual machine for development, etc etc. So I set up CentOS 5.1. Installation went fine, but upon booting, it gives the error when trying to start the network:

Bringing up interface eth0: Error, some other host already uses address 192.168.1.99

Let me tell you how I created the networking for this machine. I followed the instructions given at https://help.ubuntu.com/community/VirtualBox to set up parprouted as per the "Wireless Networking" instructions:

Code:
apt-get install parprouted
cat > /etc/network/if-up.d/vbox_network << EOF
#!/bin/bash
sysctl net.ipv4.ip_forward=1
VBoxTunctl -b -u bps7j
ip link set tap0 up
ip addr add 192.168.1.99/24 dev tap0
parprouted wlan0 tap0
EOF
chmod 700 /etc/network/if-up.d/vbox_network
/etc/network/if-up.d/vbox_network
(The user I'm running the virtual machine as is 'bps7j').

This creates a network device called tap0, which I can ping from my laptop, etc etc. Then in the VirtualBox network settings, I selected Host Interface and typed in tap0.

I read around on some of the forums and in Google, and found http://www.linuxquestions.org/questi...xxxxxx-554768/ and http://www.linuxquestions.org/questi...xx.xxx-187162/ which seem to be addressing similar-but-different issues, and didn't give me any hints.

Anyway, I thought OK, what might be happening. I'm pretty much a networking novice. But I did an arping from within the virtual machine, to check whether the IP address was already in use:

Code:
arping -c 2 -w 3 -D -I eth0 192.168.1.99
ARPING 192.168.1.99 from 0.0.0.0 eth0
Unicast reply from 192.168.1.99 [00:FF:C8:8A:04:DB] 1.162ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)
There is no other physical machine on my network with that IP address, by the way; my router's DHCP starts at 192.168.1.100. (This is a home network.)

Hmmm. OK, so what if I try to set the device up manually? My wireless router is 192.168.1.1.

Code:
ifconfig eth0 192.168.1.99 netmask 255.255.255.0 up
route add default gw 192.168.1.1
ping 192.168.1.1
It never gets a reply. I can't ping the outside world either (like a Google IP address.) I can't wget or otherwise communicate with the outside world. ifconfig shows what appears to be a correctly set up device -- it just never gets any reply from the outside.

I read a little more about all this, and added the following line to my network start script as suggested here http://home.nyc.rr.com/computertaiju...oxbridge.html:

Code:
route add -net 192.168.1.0 netmask 255.255.255.0 tap0
Still no dice. I tried rebooting my host machine. No luck.

Looks like for whatever reason, the little parprouted sleight-of-hand isn't working for this virtual machine the way it ought to be. Any ideas? Remember I don't know much about networking, so if you have any suggestions for me I would appreciate if you can help me understand all the steps I'll have to take.
 
Old 06-15-2008, 05:29 AM   #2
aus9
Guru
 
Registered: Oct 2003
Posts: 5,060

Rep: Reputation: Disabled
I would suggest you download the pdf documentation off www.virtualbox.org

it goes into a number of scenarios including bridge

2) but why not think virtual?

pretend your vm is called centos
click on settings click on network

add a network card....its virtual intelpro is the easy one

what you get on boot up of the vm...is a virtual ethernet card that your host thinks is a real card so you can talk between the 2 machines host to vm

3) I have done something very similar on a diffent distro vm to get net access....it saves mucking about adding bridge tools etc
 
Old 06-15-2008, 05:50 AM   #3
Clemente
Member
 
Registered: Aug 2003
Distribution: Debian, Ubuntu
Posts: 188

Rep: Reputation: 30
Hi bps7j,

don't know, how to get your attempt finally working, but here is the way, I painlessly got my vbox working fine. But first: If you did not find until now, there is a nice manual for VirtualBox: get it here.

I'm writing out of my memory, so please excuse, if I miss a command parameter. Everything should be verifyable with the manual.

What I did was:

1) setting up a virtual bridge,
2) plugging my physical network adapter into this bridge
3) creating a virtual adapter for my vmachine and plug it into the bridge
4) making everything persistent

You need to have installed (synaptic or apt-get): bridge-utils

1) as root, run on console: brctl addbr br0
2) as root, run on console: brctl addif eth0
3) as root, run on console: VBoxAddIF vbox0 <user_name> br0
4) edit /etc/network/interfaces as follows:

leave your physical adapter (e.g. eth0) as it is! For your bridge, add:
Code:
auto br0  
iface br0 inet static
address <unused_ip> # e.g. 192.168.1.5 
netmask 255.255.255.0 
gateway <your_gateway> # e.g. 192.168.1.1 
bridge_ports <your_physical_device> # e.g. eth0
Or, if you prefer DHCP:
Code:
auto br0  
iface br0 inet dhcp
bridge_ports <your_physical_device> # e.g. eth0
If I remember correctly, everything should be fine, now. You can use vbox0 as hostinterface for your virtual machine.

Some caveats:
- It is said, that you don't have to set an owning usr in step 3), but a group - as vboxusers. This did not work here. I did not spent much time to discover why.
- I am not 100% sure, but I strongly believe, that it is enough to do steps 3) and 4). If I am right, steps 1) and 2) are needed to get virtual networking up and running on a running systen. If booting up your host machint, step 4) makes your system to set up a new bridge and to plug the physical device into the bridge. As said, I am not 100% sure.

Last edited by Clemente; 06-15-2008 at 05:53 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VirtualBox Networking (NAT) not working on XP host with Mandriva guest FreeRadical2600 Linux - Newbie 9 10-29-2008 09:12 AM
HOW TO : Host Interface Networking setup in VirtualBox simjii Suse/Novell 1 08-01-2008 10:35 PM
VirtualBox and networking AQG Linux - Software 2 06-02-2008 01:50 PM
Ubuntu Host Virtualbox guest Networking weirdness ddales Linux - Networking 0 01-20-2008 03:24 PM
Virtualbox Networking problem 00yahoo Ubuntu 1 07-13-2007 08:54 AM


All times are GMT -5. The time now is 07:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration