Saturday 16 February 2013

Bridging ETH0 and WLAN0 for Raspberry Pi Meshing

Following on from my post yesterday, I decided to (quickly) give bridge the ports a go before popping out for the day (it's the weekend after all!)

Everything is pretty much the same as before, except if you are using Raspbian you'll need the brctl tool:

sudo apt-get install bridge-utils

Again, if the above fails its worth doing a sudo apt-get update

Once installed, we use the bridge command thusly if we're following on from my last post:

1: sudo brctl addrbr mesh-bridge 

2: sudo brctl addif mesh-bridge eth0

3: sudo brctl addif mesh-bridge bat0

4: if config eth0 up

5: ifconfig bat0 up

6: ifconfig mesh-bridge up

What you should find is that you now have a working bridge, but like me you probably won't be able to ping your other node anymore.

Not to worry - we've now taken bat0 out of the equation, so we need to remove the IP we set last post

7: sudo ifconfig bat0 0.0.0.0

and then add our ip to mesh-bridge instead. Assuming we are currently on Node 2, then we'll assign it 192.168.2.2

8: sudo ifconfig mesh-bridge 192.168.2.2

and then it all started working again for me. I'm going to start messing around with getting DHCP working next so we'll see what happens.


4 comments:

  1. Hi Des
    I followed your instructions on 2/15 for BATMAN. worked great. FYI, BATMAN is now part of Debian. Then I cam here. There is type in step one. addr should be addbr. Everything else worked until I got to step 4. I got the following. I tried various things, even going to the device with keyboard. I was SSH'd in through this. Same problem.

    dave@dinderpi2 ~ $ sudo brctl addbr mesh-bridge
    dave@dinderpi2 ~ $ sudo brctl addif mesh-bridge eth0
    dave@dinderpi2 ~ $ sudo brctl addif mesh-bridge bat0
    dave@dinderpi2 ~ $ ifconfig eth0 up
    SIOCSIFFLAGS: Operation not permitted
    dave@dinderpi2 ~ $ sudo ifconfig eth0 up
    ^Z
    sudo: unable to resolve host dinderpi2
    dave@dinderpi2 ~ $
    dave@dinderpi2 ~ $ ifconfig eth0 down
    SIOCSIFFLAGS: Operation not permitted
    dave@dinderpi2 ~ $ sudo ifconfig eth0 down
    sudo: unable to resolve host dinderpi2
    Write failed: Host is down

    ReplyDelete
    Replies
    1. hi dave, one of my later posts updates the fact that it's included in debian. so much easier now! thanks for pointing out the typo.

      Take a look at http://askubuntu.com/questions/370371/sudo-dhclient-eth0-sudo-unable-to-resolve-host-ubuntu-maybe-dns-issue

      Sounds like a very similar problem which I once saw in the past.

      Delete
  2. Hi Des

    Thanks for the link. Part of my problem was sitting at remote terminal and SSH'ing in not seeing errors on startup since I put config in startup.sh. That and both Pi's were wired in and my home network was fooling me. After resolving all that I could get ping to both Pi's from eachother with wires unplugged. Moving on to bridge aspect still has me stymied. I can go through all commands but then lose ability to ping. I believe this is covered later by you but fix didnt work. Will try again tomorrow. thanks

    ReplyDelete
  3. Hi Des
    Still having trouble. so when you select an IP is meant to be a subnet so its not on main wifi or router network? How is your wlan0 set up in /etc/network/interfaces? dhcp?

    ReplyDelete