virtualbox, taps and bridges
Karl Auer
kauer at biplane.com.au
Mon Oct 6 10:37:27 UTC 2008
On Mon, 2008-10-06 at 10:08 +0000, Cameron Hutchison wrote:
> Without any details of how you've set up your "bridges and taps", its a
> little difficult to get any insight to what your problem may be. I
> cannot answer your original question regarding a link to another posting
> that may have your answer, but I have fiddled with virtualbox, bridges
> and taps before and would happy to help if I can.
It all started with me asking which of the many HowTos I should follow.
There was no real answer to that one :-)
Anyway, the situation I got to was that the guest could access the host,
the host could access the guest, the guest could access the Internet,
the Internet could access the guest - but the host couldn't access
anything outside it's own subnet!
The script below got me to that point (virtualbox was set to use tap1
and "Host Interface"). It was cobbled together over several hours from
hints and ideas from various sources. It is to be run as root (i.e.,
with sudo).
I think the line "ifconfig $IFACE 0.0.0.0" is suspect, but I gave up
before I got around the testing variations on that. One of the irritants
in all the HowTos was that they gave no indication at all about *why*
they took various steps. If one doesn't know the why of a thing, it's
very hard to adapt or correct it.
It would be nice to solve the problem and be able to use virtualbox, as
VMWare is a bit heavy duty, and I loath their slow, clumsy new Web
interface.
Any clues you could give me would be most appreciated. Thanks!
Regards, K.
#!/bin/sh
OPT=$1
if [ -z $OPT ] ; then
echo "please specify one of \"start\" or \"stop\""
exit 1 ;
fi
if [ -z $2 ] ; then
echo "defaulting to use eth0"
IFACE=eth0
else
$IFACE=$2
fi
PATH=/sbin:/usr/bin:/bin:/usr/sbin
if [ $OPT = "start" ] ; then
# create the bridge
brctl addbr br0
# add the real ethernet interface to the bridge
ifconfig $IFACE 0.0.0.0
brctl addif br0 $IFACE
# give the bridge an IP address
ip link set up dev br0
dhclient br0
# create a tap
tunctl -t tap1 -u kauer > /dev/nul
ip link set up dev tap1
# add the tap interface to the bridge too
brctl addif br0 tap1
fi
if [ $OPT = "stop" ] ; then
brctl delif br0 $IFACE
brctl delif br0 tap1
ifconfig tap1 down
tunctl -d tap1 > /dev/nul
ifconfig br0 down
brctl delbr br0
fi
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au) +61-2-64957160 (h)
http://www.biplane.com.au/~kauer/ +61-428-957160 (mob)
GPG fingerprint: DD23 0DF3 2260 3060 7FEC 5CA8 1AF6 D9E3 CFEE 6B28
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20081006/09d1dcdf/attachment.sig>
More information about the ubuntu-users
mailing list