Gentoo Archives: gentoo-user

From: Norberto Bensa <nbensa@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] virtualbox networking
Date: Tue, 16 Sep 2008 23:49:41
Message-Id: 20080916204918.bqahvu410k0oowgk@mail.bensa.ar
In Reply to: Re: [gentoo-user] virtualbox networking by Marc Joliet
1 Quoting Marc Joliet <marcec@×××.de>:
2
3 >> What I need is the bidirectional communication between host and guest.
4 >
5 > Sorry, but I can't help you there, though I'm going to sit down and set
6 > that up myself when I have time (this year, I hope ;) ).
7
8 I know! I know!! :-)
9
10 The following assumes baselayout-2
11
12 This is my /etc/conf.d/net:
13
14 bridge_br0="eth0"
15 config_eth0="null"
16 config_br0="dhcp"
17 brctl_br0="setfd 0 sethello 0 stp on"
18
19 Then run:
20
21 sudo ln -s net.lo /etc/init.d/net.eth0
22 sudo ln -s net.lo /etc/init.d/net.br0
23
24 And:
25
26 sudo rc-update add net.eth0
27 sudo rc-update add net.br0
28
29
30 Reboot if you want. After reboot you should have br0 and eth0:
31
32 zoolook@venkman ~ $ sudo ifconfig
33 [sudo] password for zoolook:
34 br0 Link encap:Ethernet HWaddr 00:1b:fc:fb:82:08
35 inet addr:192.168.1.200 Bcast:192.168.1.255 Mask:255.255.255.0
36 inet6 addr: fe80::21b:fcff:fefb:8208/64 Scope:Link
37 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
38 RX packets:286825 errors:0 dropped:0 overruns:0 frame:0
39 TX packets:202074 errors:0 dropped:0 overruns:0 carrier:0
40 collisions:0 txqueuelen:0
41 RX bytes:242240512 (231.0 MiB) TX bytes:32231791 (30.7 MiB)
42
43 eth0 Link encap:Ethernet HWaddr 00:1b:fc:fb:82:08
44 inet6 addr: fe80::21b:fcff:fefb:8208/64 Scope:Link
45 UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
46 RX packets:286819 errors:0 dropped:0 overruns:0 frame:0
47 TX packets:203897 errors:0 dropped:0 overruns:0 carrier:2
48 collisions:0 txqueuelen:1000
49 RX bytes:246254404 (234.8 MiB) TX bytes:32369094 (30.8 MiB)
50
51 (note that eth0 does not have ipv4 address)
52
53 After all this, create a small bash script in /usr/bin. I called mine
54 addif.sh:
55
56 #!/bin/bash
57
58 IF="${1}"
59 ACTION="${2}"
60 BRIDGE=br0
61
62 case "$ACTION" in
63 up)
64 sudo VBoxAddIF "${IF}" "${LOGNAME}" "${BRIDGE}" >/dev/null 2>&1
65 ;;
66 down)
67 sudo VBoxDeleteIF "${IF}" >/dev/null 2>&1
68 ;;
69 esac
70
71 echo $IF
72
73
74 Add this to /etc/sudores:
75
76 %vboxusers ALL=(ALL) NOPASSWD: /usr/bin/VBoxAddIF, /usr/bin/VBoxDeleteIF
77
78
79 Now. Open VirtualBox and configure network like this:
80
81 Attached to: Host Interface
82
83 Setup application: addif.sh vbox0 up
84
85 terminate application: addif.sh vbox0 down
86
87
88 Note that "vbox0" is any name you like. I named mine "xp" or "nt4" or
89 "centos" depending on the guest.
90
91 The interface is create and destroyed on demand.
92
93 Regards,
94 Norberto
95
96
97 ----------------------------------------------------------------
98 This message was sent using IMP, the Internet Messaging Program.

Replies

Subject Author
Re: [gentoo-user] virtualbox networking Marc Joliet <marcec@×××.de>