Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Network bridge without any interfaces. How? [solved]
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
thesnowman
Guru
Guru


Joined: 08 May 2003
Posts: 365
Location: Sydney, Australia

PostPosted: Mon Jul 04, 2005 6:04 am    Post subject: Network bridge without any interfaces. How? [solved] Reply with quote

I'm trying to create a bridge without any interfaces using baselayout-1.11.12-r4. I've checked out the documentation here and it has an example that shows how to get it working with two interfaces (eth0 and eth1). I simply want the bridge interface created without any network interfaces as these are added dynamically. This is what the relevant part of /etc/conf.d/net looks like:
Code:
brctl_pan0=( "setfd 0" "stp off" )
config_pan0=( "10.0.0.1/24" )

I've symlinked /etc/init.d/net.pan0 to /etc/init.d/net.lo and set RC_VERBOSE="yes" in /etc/conf.d/rc. I tried setting NET_DEBUG=1 in /etc/conf.d/net but this generated too much info that I couldn't really understand. When I try and start my bridge I get this:
Code:
 * Starting pan0
 *   Loading networking modules for pan0
 *     modules: iptunnel ifconfig bridge dhcpcd apipa
 *       ifconfig provides interface
 *       dhcpcd provides dhcp
 *   Bringing up pan0
 *     10.0.0.1/24
 *     pan0 does not exist                                                                    [ !! ]

brctl and ifconfig confirm that the pan0 device was not created.

I know that it is possible to create the bridge without any interfaces because I can do it like so:
Code:
# /sbin/brctl addbr pan0
# /sbin/brctl setfd pan0 0
# /sbin/brctl stp pan0 off
# /sbin/ifconfig pan0 10.0.0.1 up
and I then have a pan0 network interface with the correct IP address.

I've tried adding a preup function to /etc/conf.d/net to manually create the bridge. I commented out the brctl_pan0 line so only the config line remains and I create the bridge in preup like so:
Code:

preup() {
    if [ "${IFACE}" == "pan0" ]; then
        /sbin/brctl addbr pan0
        /sbin/brctl setfd pan0 0
        /sbin/brctl stp pan0 off
    fi

    return 0
}
This works fine until I want to stop the bridge and I then get an "xargs: unmatched single quote" error:
Code:
supergroove ~ # /etc/init.d/net.pan0 stop
 * Stopping pan0
 *   Loading networking modules for pan0
 *     modules: iptunnel ifconfig iproute2 bridge dhcpcd apipa
 *   Bringing down pan0
 *     Destroying bridge pan0 ...
xargs: unmatched single quote                                                                 [ ok ]
The bridge is destroyed successfully however. It looks like there are some smarts in the net.lo script because it knows it's a bridge device that it's dealing with. I think the xargs "error" is probably because it's expecting some interface names that it needs to delete from the bridge before it can be stopped.

So, does anyone know if this is possible using the current baselayout? I'd appreciate any help. It doesn't matter if I can't get it working perfectly, but I am a perfectionist and would prefer to do everything the Gentoo way :wink: .

A bit of background if you're interested... I've setup a Bluetooth Network Access Point to share my Internet connection with my PDA. I used the information from here and here to get it working. A bridge device called pan0 is created and given an address of 10.0.0.1 (my address ranges are the opposite of those in the article). I'm using shorewall to forward all pan0 packets to eth0 using SNAT. Whenever a bluetooth device connects to the NAP a bnepX interface is created and the /etc/bluetooth/pan/dev-up script adds this interface to the bridge. I've been using my own scripts to get this working so far.


Last edited by thesnowman on Mon Jul 04, 2005 9:51 am; edited 1 time in total
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Mon Jul 04, 2005 8:06 am    Post subject: Re: Network bridge without any interfaces. How? Reply with quote

thesnowman wrote:
So, does anyone know if this is possible using the current baselayout?


No, it's not possible.

However, it is possible when baselayout-1.12.0-alpha3 hits portage - hopefully soon :)
You'll also be able to dynamically add interfaces to your bridge as well :)
Back to top
View user's profile Send private message
thesnowman
Guru
Guru


Joined: 08 May 2003
Posts: 365
Location: Sydney, Australia

PostPosted: Mon Jul 04, 2005 9:52 am    Post subject: Reply with quote

Thanks UberLord, I thought that was the case.

Need someone to help test baselayout-1.12.0-alpha3? :wink: Is your overlay publicly available?
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Mon Jul 04, 2005 10:36 am    Post subject: Reply with quote

thesnowman wrote:
Is your overlay publicly available?


Not as such. I'd have todo a svn snapshot for it to work in an overlay - something I don't really like doing.

However, as I'm in a nice mood, I've posted the new bridging module for testing - http://dev.gentoo.org/~uberlord

I've added a compat function to it so it should work with stable baselayout - but I've not actually tested it there.
Provided you have brctl_<bridgename>=( ... ) options then the bridge gets created regardless of if you have defined any ports

This will add eth0 to bridge br0 when eth0 starts
bridge_add_eth0="br0"
Back to top
View user's profile Send private message
mheyse
n00b
n00b


Joined: 05 Aug 2004
Posts: 6

PostPosted: Sat Dec 31, 2005 2:40 pm    Post subject: Reply with quote

Quote:
This will add eth0 to bridge br0 when eth0 starts
bridge_add_eth0="br0"


Does this actually work now? I'm using baselayout-1.12.0_pre12 and my /etc/conf.d/net looks like

Code:
brctl_br0=("setfd 0" "stp off")
bridge_add_eth0="br0"
bridge_add_bnep0="br0"
config_br0=("192.168.2.100/24")

config_eth0=("null")
config_bnep0=("null")


Now I start eth0:

Code:
linux conf.d # brctl show
bridge name     bridge id               STP enabled     interfaces

linux conf.d # /etc/init.d/net.eth0 start
 * Starting eth0
 *   Creating bridge br0 ...                                              [ ok ]
 *   Bringing up eth0                                                     [ ok ]

linux conf.d # brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.000000000000       no


As you can see the bridge gets created but no interface is added to it. Am I missing something?

Also, is /etc/conf.d/bridge and /etc/init.d/bridge now obsolete?

Thanks,
Michael
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Mon Jan 02, 2006 12:20 pm    Post subject: Reply with quote

https://bugs.gentoo.org/show_bug.cgi?id=117406

I've posted a patch that fixes the issue.
_________________
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
mheyse
n00b
n00b


Joined: 05 Aug 2004
Posts: 6

PostPosted: Mon Jan 02, 2006 12:33 pm    Post subject: Reply with quote

Quote:
I've posted a patch that fixes the issue.

Works great, thanks! I guess it will be in the next baselayout?
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Mon Jan 02, 2006 1:16 pm    Post subject: Reply with quote

Yes it will
_________________
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
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