Gentoo Archives: gentoo-user

From: Marc Joliet <marcec@×××.de>
To: Gentoo-User ML <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] virtualbox networking
Date: Wed, 17 Sep 2008 22:46:32
Message-Id: 20080918004617.7f64a791@marcec
In Reply to: Re: [gentoo-user] virtualbox networking by Norberto Bensa
1 Am Tue, 16 Sep 2008 20:49:18 -0300
2 schrieb Norberto Bensa <nbensa@×××××.com>:
3
4 > Quoting Marc Joliet <marcec@×××.de>:
5 >
6 > >> What I need is the bidirectional communication between host and
7 > >> guest.
8 > >
9 > > Sorry, but I can't help you there, though I'm going to sit down and
10 > > set that up myself when I have time (this year, I hope ;) ).
11 >
12 > I know! I know!! :-)
13
14 Well, turns out your email got me going ;-) .
15
16 Right now I got it working without using a bridge. I can ping my
17 Windows XP VM and it can ping everything else on my side, however,
18 nmap won't work. I wonder why? Does the Windows firewall block it off?
19
20 Otherwise, everything works to my liking.
21
22 My /etc/conf.d/net:
23
24 > # My standard configuration
25 >
26 > modules=( "iproute2" "ifplugd" )
27 >
28 > # Only use dhcp with eth0
29 > # (Note that only dhclient allows you to specify additional domain name servers
30 > # (i.e. localhost) apart from the ones provided by the dhcp server.)
31 > modules_eth0=( "dhcpcd" )
32 > modules_eth1=( "!plug" )
33 > modules_vbox0=( "!plug" )
34 >
35 > dhcp_eth0="nodns nonis"
36 > dhcpcd_eth0="-t 10"
37 >
38 > # Configure eth0 with dhcp, configure eth1 with a static ip
39 > # eth0 has a static IPv6 Address so that it can be used as a router.
40 > config_eth0=(
41 > "dhcp"
42 > "2001:470:d138:1:218:f3ff:fe97:1772/64"
43 > )
44 > routes_eth0=( "default via 2001:470:d138:1::1" )
45 > config_eth1=(
46 > "172.16.0.1 broadcast 172.16.0.255 netmask 255.255.255.0"
47 > "fe80::20e:2eff:feb0:8cce/64" # link, needed or it will not be set
48 > "2001:470:d138:d909::1/64" # global
49 > )
50 >
51 > tuntap_vbox0="tap"
52 > tunctl_vbox0=( "-u marcec" )
53 > config_vbox0=( "172.16.1.1 broadcast 172.16.1.255 netmask 255.255.255.0" )
54 >
55 > # Manually set the dns server to first look up on localhost
56 > dns_servers_eth0="127.0.0.1 ::1"
57
58 [...]
59
60 > After all this, create a small bash script in /usr/bin. I called
61 > mine addif.sh:
62 >
63 > #!/bin/bash
64 >
65 > IF="${1}"
66 > ACTION="${2}"
67 > BRIDGE=br0
68 >
69 > case "$ACTION" in
70 > up)
71 > sudo VBoxAddIF "${IF}" "${LOGNAME}" "${BRIDGE}" >/dev/null
72 > 2>&1 ;;
73 > down)
74 > sudo VBoxDeleteIF "${IF}" >/dev/null 2>&1
75 > ;;
76 > esac
77 >
78 > echo $IF
79
80 I would think such a script belongs in /usr/local/bin?
81
82 > Add this to /etc/sudores:
83 >
84 > %vboxusers ALL=(ALL)
85 > NOPASSWD: /usr/bin/VBoxAddIF, /usr/bin/VBoxDeleteIF
86 >
87 >
88 > Now. Open VirtualBox and configure network like this:
89 >
90 > Attached to: Host Interface
91 >
92 > Setup application: addif.sh vbox0 up
93 >
94 > terminate application: addif.sh vbox0 down
95 >
96 >
97 > Note that "vbox0" is any name you like. I named mine "xp" or "nt4"
98 > or "centos" depending on the guest.
99 >
100 > The interface is create and destroyed on demand.
101
102 I would do that (create a bridge without any IFs attached and
103 then have them added dynamically), except the VBoxAddIF script in
104 virtualbox-ose-2.0.2 craps out on a missing file
105 (/var/run/VirtualBox/vboxnet). Google didn't yield anything useful.
106
107 > marcec@marcec ~ % sudo VBoxAddIF vbox0 marcec br0
108 > VirtualBox host networking interface creation utility, version _VERSION_
109 > (C) 2005-2007 Sun Microsystems, Inc.
110 > All rights reserved.
111 >
112 > Creating the permanent host networking interface "vbox0" for user marcec.
113 >
114 > Failed to add the interface "vbox0" to the bridge "br0".
115 > Make sure that the bridge exists and that you currently have sufficient
116 > permissions to do this.
117 > /usr/bin/VBoxAddIF: line 237: /var/run/VirtualBox/vboxnet: Datei oder Verzeichnis nicht gefunden
118
119 When looking at the relevent line (237), apparently it's because the
120 directory doesn't exist so it can't create the file. What does it look
121 like on your system? Shouldn't the ebuild have created that directory?
122
123 > Regards,
124 > Norberto
125
126 Regards,
127 --
128 Marc Joliet
129 --
130 "People who think they know everything really annoy those of us who
131 know we don't" - Bjarne Stroustrup

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] virtualbox networking Norberto Bensa <nbensa@×××××.com>