Gentoo Archives: gentoo-user

From: Daniel da Veiga <danieldaveiga@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Networking bridging
Date: Thu, 21 Feb 2008 19:21:33
Message-Id: 342e1090802211121w184ee5aegf76f20a38c3af1b@mail.gmail.com
In Reply to: [gentoo-user] Networking bridging by Chris Brennan
1 On Wed, Feb 20, 2008 at 11:40 PM, Chris Brennan <xaero@××××××××××.net> wrote:
2 > I am trying to set up a Bridge for Qemu to use. I followed the guide
3 > at
4 > http://gentoo-wiki.com/HOWTO:_Qemu#Using_TUN.2FTAP_interface_as_a_normal_user
5 > but when ever the bridge starts, I loose connectivity outside of my
6 > box :/ ... am I missing something ....
7 >
8 >
9 > I've includes the output of my /etc/conf.d/net file ....
10 >
11 >
12 > # This blank configuration will automatically use DHCP for any net.*
13 > # scripts in /etc/init.d. To create a more complete configuration,
14 > # please review /etc/conf.d/net.example and save your configuration
15 > # in /etc/conf.d/net (this file :]!).
16 > dns_domain=( "unworldly.org" )
17 > nis_domain=( "unworldly.org" )
18 > dns_domain_eth0=( "unworldly.org" )
19 > dns_search_eth0=( "unworldly.org xaerolimit.net" )
20 > dns_servers_eth0=( "192.168.1.1 4.2.2.1 4.2.2.2" )
21 >
22 > ##
23 > # LAN
24 > ##
25 > config_eth0=( "192.168.1.2 netmask 255.255.255.0 brd 192.168.1.255" )
26 > routes_eth0=( "default via 192.168.1.1" )
27 >
28 > ##
29 > # Bridge
30 > ##
31 > bridge_br0="eth0"
32 > config_br0=( "192.168.1.20 netmask 255.255.255.0 brd 192.168.1.255" )
33 > #dhcpcd_br0="-t 10"
34 > RC_NEED_br0="net.eth0"
35 > brctl_br0=( "setfd 0" "sethello 0" "stp off" )
36 > config_tap0=( "10.0.2.1 netmask 255.255.255.0" )
37
38 Following an old tutorial about that, I noticed that you can't have
39 eth0 working and bridging with different IPs. My /etc/conf.d/net:
40
41 depend_br0() {
42 need net.eth0
43 }
44
45 config_eth0=( "0.0.0.0 promisc" ) #resets eth0 so the bridge gets the real IP.
46
47 config_br0=( "<YOUR_MACHINE_IP> netmask <YOUR_MACHINE_NETMASK> brd
48 <YOUR_MACHINE_BROADCAST>" )
49 dhcpd_br0="-N"
50 brctl_br0=( "setfd 0" "sethello 1" "stp off" )
51 bridge_br0="eth0" #ads eth0 to your bridge, all traffic will go to the
52 physical interface
53 routes_br0=(
54 "default gw <YOUR_MACHINE_GATEWAY>"
55 )
56
57 And at /etc/qemu-ifup I add the following:
58
59 #!/bin/sh
60 sudo /sbin/ifconfig $1 0.0.0.0 #resets tap0
61 sudo /sbin/brctl addif br0 tap0 #adds tap0 to the bridge
62
63 Of couse I configured sudo to do all this without asking for a
64 password so I could run qemu as a normal user.
65 With this setup, when I launch qemu, everything works (Novell, etc) as
66 if it really was a different computer connected physically to the
67 network.
68
69
70 Hope that helps.
71 --
72 Daniel da Veiga
73
74 Filosofia de TI: Programadores de verdade consideram o conceito "o que
75 voc礙 v礙 矇 o que voc礙 tem" t瓊o ruim em editores de texto quanto em
76 mulheres. N瓊o, o programador de verdade quer um editor de texto do
77 estilo "voc礙 pediu, voc礙 levou" - complicado, indecifr獺vel, poderoso,
78 impiedoso, perigoso.
79 瞱z鉉羞 z{h��言%