# Bridge and Bonding [SOLVED]

## rickvernam

I'd like to have two interfaces (wired + wireless of laptop) bonded ...

AND

added to a bridge ...

As it stands, I can get wired+wireless in a bond and switching between the two works fantastically.

Also, and not while using bonding at all, I can create a bridge and add a device to the bridge - I use this specifically in conjunction with tun/tap & virtual machines.

So, I think it's possible to bond the wired+wireless together, and add to a bridge and everything work great.

Here is where I get stuck (this is off memory, and I think this is how I did it):

```
ifconfig bond0 ##.##.##.## up       (maybe I did this after ifenslave?)

ifconfig eth0 up

ifconfig eth1 up

ifenslave bond0 eth0 eth1

route add default gw ##.##.##.##
```

at this point network is great - can plug & unplug wired, turn wireless on/off & it just always works.

```
brctl addbr br0

ifconfig bro -apr -allmulti up
```

at this point, network is still just fine.

However...after this...

```
brctl addif br bond0
```

no network, no error messages, nada.

ping, for example, says (probably not exact wording) 'destination host unreachable'

route still has correct routes, but table takes very long to print out

ifconfig still has expected info

brctl show is as expected...

any ideas?Last edited by rickvernam on Fri Jan 25, 2008 4:44 am; edited 1 time in total

----------

## Anarcho

If I understand you correctly you have added the IP to the bonding interface. But I think you would need to set the IP to the bridge instead.

----------

## rickvernam

 *Anarcho wrote:*   

> If I understand you correctly you have added the IP to the bonding interface. But I think you would need to set the IP to the bridge instead.

 

Hmmm...no go yet.

Should it work even when one interface is wireless?  ipw2200, using new mac80211 stuff, 2.6.23-gentoo-r3.

Wired nic is e1000.

Is there some sort of documentation regarding this sort of configuration?

----------

## manaka

AFAIK, bonding and bridging seem to be incompatible. Have a look at http://lkml.org/lkml/2005/6/23/158.

At least the problem occurs with bonding mode 1 (the default one).

----------

## rickvernam

FINALLY!!

Well, I'm posting this from a bridged/bonded setup right now.  the trick will be to see if I can get it up again!  :Smile: 

eth0 is e1000

eth1 is ipw2200

with this laptop, I primarily use wireless, which is why I put eth1 before eth0 in ifenslave,  below.

```
modprobe bonding mode=0

modprobe e1000

modprobe ipw2200

modprobe bridge

ifconfig eth1 up

ifconfig eth0 up

ifconfig bond0 up

ifenslave bond0 eth1 eth0

brctl addbr br0

brctl addif br0 bond0

ifconfig br0 192.168.2.7 up

route add default gw 192.168.2.1 br0
```

whew.  that was fun...it looks so easy now.   :Smile: 

----------

## richard.scott

I thought that a bridge was joining two separate networks i.e. two interfaces?

What are the benefits of this setup with only bond0 (a single interface) being bridge with nothing else?

----------

## rickvernam

 *richard.scott wrote:*   

> I thought that a bridge was joining two separate networks i.e. two interfaces?
> 
> What are the benefits of this setup with only bond0 (a single interface) being bridge with nothing else?

 

The benefit is the ability to add a virtual machine (using tun/tap networking, not nat) to the bridge, allowing the guest OS to use bond0 and appear on the local internet - ie, join a domain, run servers...etc.  Things that are not available when VM employs a NAT.

----------

## mimosinnet

I am trying to bond two interfaces (wired and wireless) and I am unable to connect to the internet. These are my interfaces:

```
# ifconfig

ath0      Link encap:Ethernet  HWaddr 00:16:44:1B:0C:4A

          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1

          RX packets:162 errors:0 dropped:0 overruns:0 frame:0

          TX packets:74 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:53010 (51.7 Kb)  TX bytes:6947 (6.7 Kb)

bond0     Link encap:Ethernet  HWaddr 00:16:44:1B:0C:4A

          inet addr:192.168.1.105  Bcast:192.168.1.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1

          RX packets:162 errors:0 dropped:0 overruns:0 frame:0

          TX packets:74 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:53010 (51.7 Kb)  TX bytes:6947 (6.7 Kb)

eth0      Link encap:Ethernet  HWaddr 00:A0:D1:CB:2F:38

          inet addr:192.168.1.102  Bcast:192.168.1.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:16 errors:0 dropped:0 overruns:0 frame:0

          TX packets:155 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:3545 (3.4 Kb)  TX bytes:11073 (10.8 Kb)

          Interrupt:19 Base address:0xdead

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:1557 errors:0 dropped:0 overruns:0 frame:0

          TX packets:1557 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:130096 (127.0 Kb)  TX bytes:130096 (127.0 Kb)

wifi0     Link encap:UNSPEC  HWaddr 00-16-44-1B-0C-4A-A0-85-00-00-00-00-00-00-00-00

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:9741 errors:0 dropped:0 overruns:0 frame:369

          TX packets:97 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:280

          RX bytes:876802 (856.2 Kb)  TX bytes:9642 (9.4 Kb)

          Interrupt:16
```

This is my /etc/conf.d/net:

```
# cat /etc/conf.d/net

config_bond0="arping"

#arping_sleep=2

#arping_sleep_lan=5

#arping_wait=5

#arping_wait_lan=5

# En cas de que el gateway sigui 192.168.1.1 (casa) li donem 192.168.1.105

gateways_bond0="192.168.1.1 158.109.128.1"

config_192168001001="192.168.1.105/24"

routes_192168001001="default via 192.168.1.1"

config_158109128001="158.109.132.39/24"

routes_158109128001="default via 158.109.128.1"

fallback_bond0="dhcp"

# ath0

modules_ath0="wpa_supplicant"

wpa_supplicant_ath0="-Dmadwifi -c /etc/wpa_supplicant/wpa_supplicant.conf"

wpa_timeout_ath0=60

config_ath0="null"

#config_ath0="dhcp"

config_eth0="null"

slaves_bond0="ath0 eth0"
```

I have stopped iptables to discard firewall issues. If I unbond the interfaces, I am able to get to the internet (the file /etc/resolv.conf is the same in both cases):

```
# ifenslave -d bond0 eth0

# ifconfig eth0 up

# dhcpcd eth0

# ifconfig

ath0      Link encap:Ethernet  HWaddr 00:16:44:1B:0C:4A

          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1

          RX packets:162 errors:0 dropped:0 overruns:0 frame:0

          TX packets:74 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:53010 (51.7 Kb)  TX bytes:6947 (6.7 Kb)

bond0     Link encap:Ethernet  HWaddr 00:16:44:1B:0C:4A

          inet addr:192.168.1.105  Bcast:192.168.1.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1

          RX packets:162 errors:0 dropped:0 overruns:0 frame:0

          TX packets:74 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:53010 (51.7 Kb)  TX bytes:6947 (6.7 Kb)

eth0      Link encap:Ethernet  HWaddr 00:A0:D1:CB:2F:38

          inet addr:192.168.1.102  Bcast:192.168.1.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:16 errors:0 dropped:0 overruns:0 frame:0

          TX packets:155 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:3545 (3.4 Kb)  TX bytes:11073 (10.8 Kb)

          Interrupt:19 Base address:0xdead
```

Any hints appreciated. Thanks for the attention!

Update: I am able to get the bond interface working if I manually give an ip address to eth0 and ath0 and I bond the interfaces. It is an issue with my /etc/conf.d/net. Cheers!

----------

