Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
VirtualBox - Host Interface
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
numeritos
Apprentice
Apprentice


Joined: 24 Nov 2006
Posts: 154

PostPosted: Thu Mar 08, 2007 1:40 am    Post subject: VirtualBox - Host Interface Reply with quote

I'm back with Virtualbox issues. Now I've read the user's manual and some howtos I've found on the Net. I can't get the host interface to work. I wanna bridge the connection.

My objective is to have my usual IP address on the host's network interface and an independent IP address for the guest OS (I believe it's called promiscuous).

Any ideas?
Back to top
View user's profile Send private message
numeritos
Apprentice
Apprentice


Joined: 24 Nov 2006
Posts: 154

PostPosted: Thu Mar 08, 2007 3:13 pm    Post subject: Reply with quote

Anyone? I really need to make this work!
Back to top
View user's profile Send private message
IQgryn
l33t
l33t


Joined: 05 Sep 2005
Posts: 756
Location: WI, USA

PostPosted: Thu Mar 08, 2007 5:31 pm    Post subject: Reply with quote

You'll need to give more information about what you've tried before anyone will be able to help you. Start with your VirtualBox setup and your host kernel's network configuration.
Back to top
View user's profile Send private message
numeritos
Apprentice
Apprentice


Joined: 24 Nov 2006
Posts: 154

PostPosted: Thu Mar 08, 2007 6:39 pm    Post subject: Reply with quote

Ok! I've got bridge support enabled on my kernel. My host network configuration is not really complex: dhcp. I know it has to change in order to make my virtualbox host interface work. This is what I tried:

I tried this howto http://stpaul.0xbadc0ffe.org/?p=9 but it didn't work for me. It doesn't explain very well the IP stuff.

I wanted to try this one http://www.ubuntuforums.org/showthread.php?t=346185 but one application (tunctl) is not in my Gentoo (not on Portage either).

I searched for other howto's but didn't find anything! :(
Back to top
View user's profile Send private message
claudio
Tux's lil' helper
Tux's lil' helper


Joined: 11 Sep 2005
Posts: 84
Location: Bern, Switzerland

PostPosted: Fri Mar 09, 2007 8:20 pm    Post subject: Reply with quote

After a long research I found the following solution for this on my Gentoo host:

Code:
emerge net-misc/bridge-utils
emerge sys-apps/usermode-utilities


My conditions to for host and guest:
Code:
# host interface:
# IP:   192.168.0.11
# user: cl

# guest interface (static - no DHCP):
# IP:   192.168.5.10
# Mask: 255.255.255.0
# GW:   192.168.5.1
# DNS:  192.168.0.2


Note: you have to enable iptables and bridging support in the kernel - I'm using 2.6.20.

Make a script you always run before you start VirtualBox:
Code:
modprobe vboxdrv
echo 1 > /proc/sys/net/ipv4/ip_forward
tunctl -t tap0 -u cl
ifconfig tap0 192.168.5.1 netmask 255.255.255.0
iptables -t nat -A POSTROUTING -s 192.168.5.0/24 -o eth0 -j SNAT --to 192.168.0.11
chmod 666 /dev/net/tun


After this, you should be able to start VirtualBox as user:
Code:
vboxsvc --daemonize && virtualbox

Use 'tap0' as you host interface adapter.

Good luck! Claudio
Back to top
View user's profile Send private message
claudio
Tux's lil' helper
Tux's lil' helper


Joined: 11 Sep 2005
Posts: 84
Location: Bern, Switzerland

PostPosted: Fri Mar 09, 2007 8:22 pm    Post subject: Reply with quote

After a long research I found the following solution for this on my Gentoo host:

Code:
emerge net-misc/bridge-utils
emerge sys-apps/usermode-utilities


My conditions to for host and guest:
Code:
# host interface:
# IP:   192.168.0.11
# user: cl

# guest interface (static - no DHCP):
# IP:   192.168.5.10
# Mask: 255.255.255.0
# GW:   192.168.5.1
# DNS:  192.168.0.2


Note: you have to enable iptables and bridging support in the kernel - I'm using 2.6.20.

Make a script you always run before you start VirtualBox:
Code:
modprobe vboxdrv
echo 1 > /proc/sys/net/ipv4/ip_forward
tunctl -t tap0 -u cl
ifconfig tap0 192.168.5.1 netmask 255.255.255.0
iptables -t nat -A POSTROUTING -s 192.168.5.0/24 -o eth0 -j SNAT --to 192.168.0.11
chmod 666 /dev/net/tun


After this, you should be able to start VirtualBox as user:
Code:
vboxsvc --daemonize && virtualbox

Use 'tap0' as you host interface adapter.

Good luck! Claudio
Back to top
View user's profile Send private message
numeritos
Apprentice
Apprentice


Joined: 24 Nov 2006
Posts: 154

PostPosted: Sun Mar 11, 2007 5:28 am    Post subject: Reply with quote

When I run this command
Code:
tunctl -t tap0 -u myusername
I get this error:
Code:
Failed to open '/dev/net/tun' : No such file or directory

What shoud I do?
Back to top
View user's profile Send private message
claudio
Tux's lil' helper
Tux's lil' helper


Joined: 11 Sep 2005
Posts: 84
Location: Bern, Switzerland

PostPosted: Sun Mar 11, 2007 3:45 pm    Post subject: Reply with quote

numeritos wrote:
What shoud I do?


Your kernel is not configured well. You have to reconfigure it - here are some important options:
Code:
Device Drivers  --->
  Network device support  --->
    <*>   Universal TUN/TAP device driver support
Networking  --->
  Networking options  --->
    <*>   IP: tunneling
    <*> 802.1d Ethernet Bridging
    [*] Network packet filtering framework (Netfilter)  --->
      [*]   Bridged IP/ARP packets filtering
      ...


Hope this helps...
Back to top
View user's profile Send private message
numeritos
Apprentice
Apprentice


Joined: 24 Nov 2006
Posts: 154

PostPosted: Mon Mar 12, 2007 12:17 am    Post subject: Reply with quote

There are some things I don't understand. My host IP is 192.168.0.100. My router IP is 192.168.0.1 (the router asigns a static dhcp address to my host). I want my guest IP to be 192.168.0.199. I do not use iptables (isn't it possible to use route command instead?).

What should I exactly do? Thanks for your help!
Back to top
View user's profile Send private message
claudio
Tux's lil' helper
Tux's lil' helper


Joined: 11 Sep 2005
Posts: 84
Location: Bern, Switzerland

PostPosted: Mon Mar 12, 2007 7:50 pm    Post subject: Reply with quote

numeritos wrote:
There are some things I don't understand. My host IP is 192.168.0.100. My router IP is 192.168.0.1 (the router asigns a static dhcp address to my host). I want my guest IP to be 192.168.0.199. I do not use iptables (isn't it possible to use route command instead?).

What should I exactly do? Thanks for your help!


I'm not very good with this bridging and routing stuff. But I propose you to do it the same way as I did - and it will work...

You should use iptables for routing - this is one function of iptables. You can also use it for filtering packets if you want to. So you have to configure your kernel for using iptables.

I also recomend to configure your guest IP in the 192.168.5.* range, so you don't have any routing conflicts. I have also tried your way, but it didn't work. My network is also complete static; I don't have have any DHCP IPs neither. So you have to configure your guest OS's IP statically like described above.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum