Allo la gang !
Comme l’indique le titre, j’essaye de faire marcher Virtualbox en mode bridge pour le réseau afin de pouvoir faire tourner mon OS virtuel comme un serveur web. Mon OS hôte est une Debian Sid à jour (avec le source.list au carré) et l’OS invité est une Debian etch toute simple. Attention, c’est un peu long…
Alors si je met le réseau en mode NAT au niveau de Virtualbox je peux accéder au web depuis mon OS invité mais impossible d’accéder au serveur apache depuis mon OS hôte.
Après avoir lu la doc officielle et quelques tutos sur le net, j’ai fait tous les réglages nécessaires (du moins il me semble…) au mode bridge permettant logiquement de faire passer l’OS invité comme un autre ordi sur le réseau et ainsi depuis le-dit réseau accéder au serveur web installé sur ce dernier (si vous suivez encore, c’est que vous êtes forts ).
Alors voila, si quelqu’un ici a déjà fait ce genre de manipulation avec succès (ou même sans mais ayant une piste), je suis preneur. Ah oui et pour info, comme je suis toujours dans les cas tordus, je fait un bridge entre mon interface wifi et donc une carte virtuelle pour Virtualbox et cette manipulation est clairement marquée comme ne marchant que très rarement, mais comme vous le verrez si vous lisez la suite, le résultat que j’obtiens me pousse à penser que cela marche chez moi, tout du moins, presque…
Donc voila, j’ai modifié mon fichier /etc/network/interfaces de la sorte sur ma Sid :
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
#address 127.0.0.1
#netmask 255.0.0.0
# The primary network interface
#allow-hotplug eth0
auto eth0
iface eth0 inet dhcp
auto wlan0
iface wlan0 inet dhcp
# L'interface qui sera utilisée par VirtualBox
auto tap0
iface tap0 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down
tunctl_user nicolas
# Le bridge, permettant au réseau d'être accessible aux deux interfaces réseaux.
auto br0
iface br0 inet dhcp
#post-up chmod ugo+rw /dev/net/tun
bridge-ports wlan0 tap0
#bridge-ageing 7200
#bridge-fd 0
J’ai bien installé les paquets bridge-utils et uml-utilities ainsi qu’ajouté mon utilisateur au bon groupe pis toute. Je redémarre donc mon réseau :
Portable-Nous:~# /etc/init.d/networking restart
Reconfiguring network interfaces...There is already a pid file /var/run/dhclient.eth0.pid with pid 11671
removed stale PID file
Internet Systems Consortium DHCP Client V3.1.1
Copyright 2004-2008 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Listening on LPF/eth0/00:16:d4:cc:19:cf
Sending on LPF/eth0/00:16:d4:cc:19:cf
Sending on Socket/fallback
DHCPRELEASE on eth0 to 192.168.2.1 port 67
There is already a pid file /var/run/dhclient.wlan0.pid with pid 11755
removed stale PID file
Internet Systems Consortium DHCP Client V3.1.1
Copyright 2004-2008 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Listening on LPF/wlan0/00:19:7e:0f:ec:c3
Sending on LPF/wlan0/00:19:7e:0f:ec:c3
Sending on Socket/fallback
DHCPRELEASE on wlan0 to 192.168.1.1 port 67
There is already a pid file /var/run/dhclient.br0.pid with pid 12037
killed old client process, removed PID file
Internet Systems Consortium DHCP Client V3.1.1
Copyright 2004-2008 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Listening on LPF/br0/00:19:7e:0f:ec:c3
Sending on LPF/br0/00:19:7e:0f:ec:c3
Sending on Socket/fallback
DHCPRELEASE on br0 to 192.168.1.1 port 67
Internet Systems Consortium DHCP Client V3.1.1
Copyright 2004-2008 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Listening on LPF/eth0/00:16:d4:cc:19:cf
Sending on LPF/eth0/00:16:d4:cc:19:cf
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
Failed to bring up eth0.
Internet Systems Consortium DHCP Client V3.1.1
Copyright 2004-2008 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Listening on LPF/wlan0/00:19:7e:0f:ec:c3
Sending on LPF/wlan0/00:19:7e:0f:ec:c3
Sending on Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPOFFER from 192.168.1.1
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPACK from 192.168.1.1
bound to 192.168.1.105 -- renewal in 38595 seconds.
if-up.d/mountnfs[wlan0]: waiting for interface eth0 before doing NFS mounts
if-up.d/mountnfs[wlan0]: waiting for interface tap0 before doing NFS mounts
if-up.d/mountnfs[wlan0]: waiting for interface br0 before doing NFS mounts
TUNSETIFF: Device or resource busy
if-up.d/mountnfs[tap0]: waiting for interface eth0 before doing NFS mounts
if-up.d/mountnfs[tap0]: waiting for interface br0 before doing NFS mounts
Waiting for br0 to get ready (MAXWAIT is 32 seconds).
Internet Systems Consortium DHCP Client V3.1.1
Copyright 2004-2008 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Listening on LPF/br0/00:19:7e:0f:ec:c3
Sending on LPF/br0/00:19:7e:0f:ec:c3
Sending on Socket/fallback
DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 3
DHCPOFFER from 192.168.1.1
DHCPREQUEST on br0 to 255.255.255.255 port 67
DHCPREQUEST on br0 to 255.255.255.255 port 67
DHCPACK from 192.168.1.1
bound to 192.168.1.115 -- renewal in 32936 seconds.
if-up.d/mountnfs[br0]: waiting for interface eth0 before doing NFS mounts
done.
Comme d’habitude il galère comme un âne avec eth0 (encore que là il a pas bloqué alors que d’habitude il essaye pendant 3 minutes de lui trouve une IP alors que y’a pas de cable branché… j’ai jamais réussi à lui faire comprendre ça non plus d’ailleurs) puis trouve une IP pour wlan0 (192.168.1.105 à la base) puis passe au bridge (br0) pour lequel la même passerelle que pour wlan0 attribue l’adresse 192.168.1.115.
Et une fois tout ceci passé, j’obtiens la configuration qui suit pour mon résal à moi :
Portable-Nous:~# ifconfig
br0 Link encap:Ethernet HWaddr 00:19:7e:0f:ec:c3
inet adr:192.168.1.115 Bcast:192.168.1.255 Masque:255.255.255.0
adr inet6: fe80::219:7eff:fe0f:ecc3/64 Scope:Lien
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:20 errors:0 dropped:0 overruns:0 frame:0
TX packets:42 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:0
RX bytes:2196 (2.1 KiB) TX bytes:7960 (7.7 KiB)
eth0 Link encap:Ethernet HWaddr 00:16:d4:cc:19:cf
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interruption:21
lo Link encap:Boucle locale
inet adr:127.0.0.1 Masque:255.0.0.0
adr inet6: ::1/128 Scope:Hôte
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:779 errors:0 dropped:0 overruns:0 frame:0
TX packets:779 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:0
RX bytes:60258 (58.8 KiB) TX bytes:60258 (58.8 KiB)
tap0 Link encap:Ethernet HWaddr 00:ff:e4:30:2b:26
adr inet6: fe80::2ff:e4ff:fe30:2b26/64 Scope:Lien
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:122 errors:0 dropped:0 overruns:0 frame:0
TX packets:3541 errors:0 dropped:1065 overruns:0 carrier:0
collisions:0 lg file transmission:500
RX bytes:23006 (22.4 KiB) TX bytes:307070 (299.8 KiB)
wlan0 Link encap:Ethernet HWaddr 00:19:7e:0f:ec:c3
inet adr:192.168.1.115 Bcast:192.168.1.255 Masque:255.255.255.0
adr inet6: fe80::219:7eff:fe0f:ecc3/64 Scope:Lien
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:658141 errors:0 dropped:0 overruns:0 frame:0
TX packets:559285 errors:0 dropped:20 overruns:0 carrier:0
collisions:0 lg file transmission:1000
RX bytes:656048344 (625.6 MiB) TX bytes:79515613 (75.8 MiB)
Interruption:19 Mémoire:d0000000-d0010000
wlan0 se retrouve avec la même IP que mon bridge et tap0 sans rien. Jusque là rien de bien bizarre à mon goût, tout à l’air de s’être bien passé. Mais quand je lance Virtualbox en lui indicant de se connecter sur tap0 qui est donc censée être son interface pour accéder au bridge et donc au réseau local, internet et tout le tremblement, ben il dit rien mais je me retrouve sur mon OS invité avec une IP qui n’a absolument rien à voir, aucun accès au net et cet OS est toujours inaccessible depuis ma Sid. Un ifconfig sur la Etch me donne :
eth1 Link encap:Ethernet HWaddr 08:00:27:CD:AC:CD
inet adr:169.254.184.243 Bcast:169.254.255.255 Masque:255.255.0.0
adr inet6: fe80::a00:27ff:fecd:accd/64 Scope:Lien
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:315 errors:0 dropped:0 overruns:0 frame:0
TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
RX bytes:26625 (26.0 KiB) TX bytes:4597 (4.4 KiB)
Interruption:11 Adresse de base 0xc020
lo Link encap:Boucle locale
inet adr:127.0.0.1 Masque:255.0.0.0
adr inet6: ::1/128 Scope:Hôte
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:78 errors:0 dropped:0 overruns:0 frame:0
TX packets:78 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:0
RX bytes:5484 (5.3 KiB) TX bytes:5484 (5.3 KiB)
Et bien sûr depuis Etch je n’ai point accès à aucun réseau, que ce soit en local ou au net… Et comme vous pouvez le constater l’adresse réseau attribuée n’a pas grand chose à voir avec les autres.
Je suis tombé sur le forum d’Ubuntu-fr sur une seconde solution ( forum.ubuntu-fr.org/viewtopic.php?id=217680 ) que j’ai tenté aussi mais là j’ai plus rien qui marche et ça en configuration :
sur la Sid hôte :
nicolas@Portable-Nous:~/Desktop$ /sbin/ifconfig
br0 Link encap:Ethernet HWaddr 00:19:7e:0f:ec:c3
adr inet6: fe80::219:7eff:fe0f:ecc3/64 Scope:Lien
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:126 errors:0 dropped:0 overruns:0 frame:0
TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:0
RX bytes:6806 (6.6 KiB) TX bytes:3359 (3.2 KiB)
eth0 Link encap:Ethernet HWaddr 00:16:d4:cc:19:cf
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interruption:21
lo Link encap:Boucle locale
inet adr:127.0.0.1 Masque:255.0.0.0
adr inet6: ::1/128 Scope:Hôte
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:206 errors:0 dropped:0 overruns:0 frame:0
TX packets:206 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:0
RX bytes:14820 (14.4 KiB) TX bytes:14820 (14.4 KiB)
vbox0 Link encap:Ethernet HWaddr 00:ff:8c:8f:26:13
adr inet6: fe80::2ff:8cff:fe8f:2613/64 Scope:Lien
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:88 overruns:0 carrier:0
collisions:0 lg file transmission:500
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
vbox1 Link encap:Ethernet HWaddr 00:ff:2b:61:e1:1f
adr inet6: fe80::2ff:2bff:fe61:e11f/64 Scope:Lien
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:88 overruns:0 carrier:0
collisions:0 lg file transmission:500
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
vbox2 Link encap:Ethernet HWaddr 00:ff:c6:a9:44:ea
adr inet6: fe80::2ff:c6ff:fea9:44ea/64 Scope:Lien
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:88 overruns:0 carrier:0
collisions:0 lg file transmission:500
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 00:19:7e:0f:ec:c3
inet adr:192.168.1.115 Bcast:192.168.1.255 Masque:255.255.255.0
adr inet6: fe80::219:7eff:fe0f:ecc3/64 Scope:Lien
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:139 errors:0 dropped:0 overruns:0 frame:0
TX packets:91 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
RX bytes:9866 (9.6 KiB) TX bytes:9198 (8.9 KiB)
Interruption:19 Mémoire:d0000000-d0010000
L’IP de wlan0 semble correct mais aucun j’ai plus accès internet ou réseau…
Le fichier interfaces correspondant :
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
#address 127.0.0.1
#netmask 255.0.0.0
# The primary network interface
#allow-hotplug eth0
auto eth0
iface eth0 inet dhcp
auto wlan0
iface wlan0 inet dhcp
# L'interface qui sera utilisée par VirtualBox
#auto tap0
#iface tap0 inet manual
# up ifconfig $IFACE 192.168.1.120 up
# down ifconfig $IFACE down
# tunctl_user nicolas
# Le bridge, permettant au réseau d'être accessible aux deux interfaces réseaux.
auto br0
iface br0 inet manual
bridge-ports wlan0
address 192.168.1.120
netmask 255.255.255.0
gateway 192.168.1.1
#post-up chmod ugo+rw /dev/net/tun
#bridge-ports wlan0 tap0
#bridge-ageing 7200
#bridge-fd 0
Alors voila, si par un quelconque hasard il y a des personnes qui lisent ces dernières lignes (promis) et a une idée qu’il n’hésite pas…
Merci d’avoir au moins lu