# Why does bridging take that long to start (1 minute)?

## VinzC

Hi.

I've bridged my wireless and ethernet cards on my Gentoo laptop. I notice the bridge always takes a very long time to startup, approximately 1 minute! The bridge enters listening, learning and forwarding states, then finally gets its IP address through DHCP. The whole process takes a little bit more than one minute:

```
Apr  5 21:41:28 solo br0: port 2(eth1) entering listening state

Apr  5 21:41:43 solo br0: port 2(eth1) entering learning state

Apr  5 21:41:58 solo br0: topology change detected, propagating

Apr  5 21:41:58 solo br0: port 2(eth1) entering forwarding state

Apr  5 21:42:29 solo dhcpcd[9773]: verified 192.168.x.y address is not in use

Apr  5 21:42:29 solo dhcpcd[9773]: your IP address = 192.168.x.y
```

Does anybody know why it takes that long? And possibly how to decrease that delay?

Thanks in advance.

----------

## think4urs11

most probably Spanning Tree

----------

## VinzC

Ah, thanks. I'll try reducing the take over time with the hints mentioned in the article.

----------

## VinzC

Thanks a lot:

```
Apr  5 23:13:54 solo br0: port 2(eth1) entering listening state

Apr  5 23:13:58 solo br0: port 2(eth1) entering learning state

Apr  5 23:14:02 solo br0: topology change detected, propagating

Apr  5 23:14:02 solo br0: port 2(eth1) entering forwarding state

Apr  5 23:14:06 solo dhcpcd[18832]: verified 192.168.45.163 address is not in use

Apr  5 23:14:06 solo dhcpcd[18832]: your IP address = 192.168.45.163
```

Here's how I now setup the bridge:

```
BRIDGE=br0

...

brctl addbr ${BRIDGE}

brctl stp ${BRIDGE} on

brctl sethello ${BRIDGE} 1

brctl setmaxage ${BRIDGE} 4

brctl setfd ${BRIDGE} 4

ip link set ${BRIDGE} up

...
```

Now only 12 seconds to setup the bridge; the article doesn't lie  :Smile:  :

 *http://tldp.org/HOWTO/BRIDGE-STP-HOWTO/advanced-bridge.html#STP wrote:*   

> If you set the hello time (the STP packet interval) from 2 to 1 second, you can safely set the message age parameter to 4 seconds. Then you can set the forward delay to 4 seconds, and this will in total give you a takeover time of ~12 seconds.

 

----------

## soroh6

When I enable a device in windows, it takes forever for it to assign the IP.. I've tried googling but it's really hard to search for, at least in my experience.. has anyone else ever had this problem?  My former linux server used to bring dhcp clients online virtually instantly, now it will take anywhere from 30 seconds to 2 minutes just to get online.. it's terrible!

I'm using the same dnsmasq config as my last server, albeit the only change is from the LAN IP's from 192.168. to 10.1., but this shouldn't be causing the horrendous delay in bringing a dhcp client online.. oh, well, and that the 2 ethernet devices are bridged now, I did not have a bridged setup on my former server.

 *Quote:*   

> Apr 21 20:05:46 fnd01 eth1: link up, 100Mbps, full-duplex, lpa 0xC5E1
> 
> Apr 21 20:05:46 fnd01 br0: port 2(eth1) entering listening state
> 
> Apr 21 20:06:01 fnd01 br0: port 2(eth1) entering learning state
> ...

 

As you can see, this attempt took 1 minute and 10 seconds.. from the point it 'reactivates' the ethernet port and goes into listening state.  I can't figure this out, why it shouldn't be basically instant like it was before.  Any insight is appreciated, I'm thinking of switching over to dhcpd instead, but I've no experience with it (of course I'll reference the wiki  :Smile: )

----------

## think4urs11

merged the above as it is the same issue - the delay seen is clearly due to Spanning Tree

----------

## soroh6

Oh my God, thank you so much, this has been killing me!

----------

