Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Virtual Box -- automatically get ip
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
strubbldesign
Guru
Guru


Joined: 16 Jan 2005
Posts: 354
Location: still somewhere in the matrix but once i was able to look out of it

PostPosted: Fri Nov 07, 2008 9:15 am    Post subject: Virtual Box -- automatically get ip Reply with quote

hello everyone...

Id like to have a initscript of my eth0 device that gets the IP automatically and forwards the settings for my VirtualBox (Bridge connection) cause I'm learing as a networkegineer but have no knoledge about programming.

Who can help me??

and here's my /etc/conf.d/net.eth0

Quote:
# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d. To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
#config_eth0=( "192.168.1.56 netmask 255.255.255.0 brd 192.168.1.255" )
#routes_eth0=( "default via 192.168.1.1" )
config_eth0=( "dhcp" )
# dhcp_eth0="nodns nontp nonis"
#######################################
### virtual machine####################

# For every VM create an interface,
# set user to the one who going to use the
# interface.
tuntap_vbox0="tap"
tunctl_vbox0="-u fysi"
config_vbox0="192.168.1.56"
# config_eth0="null"

# Add here all interfaces that you want to bridge
# eg eth0, but make sure to add config_eth0="null"
rc_need_br0="net.vbox0"
bridge_br0="vbox0 eth0"

# The following will be the host IP, it can be the default router
# for the VM in routing mode.
# You can use dhcp here if you like, it makes sense if you want
# to bridge your VM into the real network.
config_br0="dhcp"
#config_br0="192.168.151.1/24"

brctl_br0="setfd 0
sethello 0
stp off"


what do i have to do???
_________________
Always look on the bright side of live. badu badubadubado
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Fri Nov 07, 2008 8:05 pm    Post subject: Reply with quote

Rename /etc/conf.d/net.eth0 into /etc/conf.d/net and create a symlink /etc/init.d/net.vbox0 that points to /etc/init.d/net.lo:
Code:
mv -i /etc/conf.d/net.eth0 /etc/conf.d/net
ln -s net.lo /etc/init.d/net.vbox0

Also make sure you added support for bridging in your kernel configuration:
zgrep '^CONFIG_BRIDGE=' /proc/config.gz:
CONFIG_BRIDGE=m
or
grep '^CONFIG_BRIDGE=' /usr/src/linux/.config:
CONFIG_BRIDGE=m

:)

EDIT: Also uncomment
Code:
# config_eth0="null"

_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
strubbldesign
Guru
Guru


Joined: 16 Jan 2005
Posts: 354
Location: still somewhere in the matrix but once i was able to look out of it

PostPosted: Mon Nov 10, 2008 6:15 pm    Post subject: Reply with quote

thanks for your prompt help...

well while i've been configuring the vbox interface maually so i already have the kernel moduel loaded...

so I'll try...
_________________
Always look on the bright side of live. badu badubadubado
Back to top
View user's profile Send private message
strubbldesign
Guru
Guru


Joined: 16 Jan 2005
Posts: 354
Location: still somewhere in the matrix but once i was able to look out of it

PostPosted: Mon Nov 10, 2008 6:45 pm    Post subject: Reply with quote

well the symlink was alredy created...
the module was already loaded[quote]grep '^CONFIG_BRIDGE=' /usr/src/linux/.config
CONFIG_BRIDGE=y

heres my new /etc/conf.d/net
Quote:


config_eth0=( "dhcp" )
# dhcp_eth0="nodns nontp nonis"


#######################################
########### virtual machine ###########

# For every VM create an interface,
# set user to the one who going to use the
# interface.
tuntap_vbox0="tap"
tunctl_vbox0="-u fysi"
config_vbox0="dhcp"
# config_eth0="null"

# Add here all interfaces that you want to bridge
# eg eth0, but make sure to add config_eth0="null"
rc_need_br0="net.vbox0"
bridge_br0="vbox0 eth0"

# The following will be the host IP, it can be the default router
# for the VM in routing mode.
# You can use dhcp here if you like, it makes sense if you want
# to bridge your VM into the real network.
config_br0="dhcp"
#config_br0="192.168.151.1/24"

brctl_br0="setfd 0
sethello 0
stp off"


I think the problem is caused by the following line of startup
Quote:

...
creating bridge br0.... [OK]
adding ports to br0
network interface vbox0 does not exitst
please verify hardware or kernelmodule (driver) [!!!]
starting eth0
....


so internet works on my gentoo but not on virtual box...


thanks for your help
_________________
Always look on the bright side of live. badu badubadubado
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Mon Nov 10, 2008 7:20 pm    Post subject: Reply with quote

First your bridge is still badly configured: your eth0 is configured to receive an address from DHCP. All interfaces that are part of a bridge *must* have their config_iface variable set to "null":
Code:
config_vbox0="null"
config_eth0="null"

Next you should have these symlinks in /etc/init.d/:
ls -l /etc/init.d/net.*:
lrwxrwxrwx 1 root root     6 aoû 31 00:33 /etc/init.d/net.br0 -> net.lo
lrwxrwxrwx 1 root root     6 aoû 27 00:00 /etc/init.d/net.eth0 -> net.lo
-rwxr-xr-x 1 root root 14682 oct 15 13:30 /etc/init.d/net.lo
-rwxr-xr-x 1 root root  2074 oct 15 13:30 /etc/init.d/netmount
lrwxrwxrwx 1 root root     6 aoû 27 14:15 /etc/init.d/net.vbox0 -> net.lo

You should also make sure that module tun gets loaded at boot -- udev doesn't load it automatically, you have to add it to /etc/conf.d/modules if you have baselayout-2* (it looks like that's what you have):
/etc/conf.d/modules:
modules_2_6="${modules_2_6} tun"

Add net.br0 to any runlevel (default for instance) and add this to your /etc/conf.d/net:
/etc/conf.d/net:
depend_br0()
{
   need net.eth0
   need net.vbox0
}

Hope I forgot nothing :-) .
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
strubbldesign
Guru
Guru


Joined: 16 Jan 2005
Posts: 354
Location: still somewhere in the matrix but once i was able to look out of it

PostPosted: Tue Nov 18, 2008 7:46 am    Post subject: Reply with quote

still not working...

what do you need as info?
_________________
Always look on the bright side of live. badu badubadubado
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Tue Nov 18, 2008 8:18 am    Post subject: Reply with quote

Probably easier to configure a Proxy ARP daemon instead of a bridge.
I wrote one just for this (mainly for NetBSD as Linux as a Proxy ARP daemon in the kernel) as it's easier to configure this than is for bridging lots of virtual machines.

http://roy.marples.name/projects/parpd
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Tue Nov 18, 2008 8:48 am    Post subject: Reply with quote

strubbldesign wrote:
still not working...

what do you need as info?

What exactly doesn't work? If you have an error message, please post it here.

EDIT: Also post the results of ls -l /dev/net/tun. You should get:
ls -l /dev/net/tun:
crw-rw-rw- 1 root root 10, 200 nov 18 08:49 /dev/net/tun

If this is not what you have, check /etc/udev/rules.d/50-udev-default.rules:
grep tun /etc/udev/rules.d/*:
/etc/udev/rules.d/50-udev-default.rules:KERNEL=="tun",         NAME="net/%k", MODE="0666", OPTIONS+="ignore_remove"

_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security 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