# Bridge network interfaces Rpi 3

**URL:** <https://forums.balena.io/t/bridge-network-interfaces-rpi-3/490>\
**Category:** Product support\
**Created:** [January 6, 2017, 8:19am UTC](https://forums.balena.io/t/bridge-network-interfaces-rpi-3/490 "2017-01-06T08:19:19Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![zuma](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/zuma/32/238_2.png) [@zuma](https://forums.balena.io/u/zuma)\
**Post date:** [January 6, 2017, 8:19am UTC](https://forums.balena.io/t/bridge-network-interfaces-rpi-3/490/1 "2017-01-06T08:19:19Z")

</div>

I’d like to create a wireless bridge between the RPi’s Ethernet and wireless interfaces. The purpose of the bridge is to share the wifi Internet connection with a connected Ethernet device. I’ve previously set it up on a RPi 3 using the instructions shown in this [link](http://raspberrypi.stackexchange.com/questions/33894/i-am-attempting-to-create-a-wifi-gateway). However, in the docker container it doesn’t seam to work. I can ping ping the Ethernet device from inside the contain but not from other devices on the wifi network.

What is the best way to setup a wireless bridge between the RPi’s Ethernet and wireless interfaces?

Thanks

---

<div class="post-metadata">

**Author:** ![michal](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@michal](https://forums.balena.io/u/michal)\
**Post date:** [January 6, 2017, 11:01am UTC](https://forums.balena.io/t/bridge-network-interfaces-rpi-3/490/2 "2017-01-06T11:01:46Z")

</div>

Hey,

I tried to recreate the problem, but this works fine for me. Can you share more information? Also, did you configure the routing tables on the devices on your wifi network you’re pinging from?

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [January 6, 2017, 5:02pm UTC](https://forums.balena.io/t/bridge-network-interfaces-rpi-3/490/3 "2017-01-06T17:02:24Z")

</div>

Can you share the code you were using to try setting up the bridging? That might help debugging the issues.

---

<div class="post-metadata">

**Author:** ![zuma](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/zuma/32/238_2.png) [@zuma](https://forums.balena.io/u/zuma)\
**Post date:** [January 9, 2017, 10:43pm UTC](https://forums.balena.io/t/bridge-network-interfaces-rpi-3/490/4 "2017-01-09T22:43:21Z")

</div>

I attempted to create a wireless bridge between the RPi’s Ethernet and wireless interfaces using Proxy ARP. Proxy ARP is a routed (Layer 3) solution, but works for all IP traffic: see [https://wiki.debian.org/BridgeNetworkConnectionsProxyArp](https://wiki.debian.org/BridgeNetworkConnectionsProxyArp) for details.

The steps I followed are as follows:

`sudo apt-get install parprouted dhcp-helper avahi-daemon`

Edit /etc/network/interfaces to configure the interfaces:

```
auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet manual

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
  wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
  post-up /usr/sbin/parprouted eth0 wlan0
  post-down /usr/bin/killall /usr/sbin/parprouted
  # clone the dhcp-allocated IP to eth0 so dhcp-relay will relay for the correct subnet
  post-up /sbin/ip addr add $(/sbin/ip addr show wlan0 | perl -wne 'm|^\s+inet (.*)/| && print $1')/32 dev eth0
  post-down /sbin/ifdown eth0

```

Edit /etc/sysctl.d/local.conf to enable IP forwarding:

`net.ipv4.ip_forward=1`

Enable DHCP relay: /etc/default/dhcp-helper

```
# relay dhcp requests as broadcast to wlan0
DHCPHELPER_OPTS="-b wlan0"

```

Edit /etc/avahi/avahi-daemon.conf to enable mDNS relaying:

```
[reflector]
enable-reflector=yes

```

Reboot

The avahi messages send from the device connected to the RPi’s ethernet port are visible to devices on the WiFi network, however when I try to ping the IP address of the ethenet connected device from a device connected to the WiFI network I get a ‘Destination Host Unreachable’

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [January 9, 2017, 11:56pm UTC](https://forums.balena.io/t/bridge-network-interfaces-rpi-3/490/5 "2017-01-09T23:56:41Z")

</div>

I’m not sure I get it, sorry, where did you take these steps? What `Dockerfile` have you tried to use exactly? Is it deployed on [resin.io](http://resin.io)?

---

<div class="post-metadata">

**Author:** ![zuma](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/zuma/32/238_2.png) [@zuma](https://forums.balena.io/u/zuma)\
**Post date:** [January 10, 2017, 12:13am UTC](https://forums.balena.io/t/bridge-network-interfaces-rpi-3/490/6 "2017-01-10T00:13:47Z")

</div>

I used the resin/%%RESIN\_MACHINE\_NAME%%-python using a Raspberry Pi. It is deployed on [resin.io](http://resin.io)

---

<div class="post-metadata">

**Author:** ![zuma](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/zuma/32/238_2.png) [@zuma](https://forums.balena.io/u/zuma)\
**Post date:** [January 10, 2017, 12:14am UTC](https://forums.balena.io/t/bridge-network-interfaces-rpi-3/490/7 "2017-01-10T00:14:48Z")

</div>

These steps were taken inside the Docker container.

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [January 10, 2017, 6:41pm UTC](https://forums.balena.io/t/bridge-network-interfaces-rpi-3/490/8 "2017-01-10T18:41:12Z")

</div>

Hey @zuma, one important note in the beginning. If you modify things in a running container, and you restart from that, all your changes will be lost as the container itself is immutable (always starts from the same initial setup). So that way you tried to set things up wouldn’t have worked anyways.

I’ve looked into the links you mentioned, and made a “resinified” version of the bridge, you can get it from there (clone it, and then push the code to your own application):

> **[balena-io-playground/balena-bridge](https://github.com/balena-io-playground/balena-bridge)**
>
> Resin.io device to bridging the wifi network to ethernet - balena-io-playground/balena-bridge

The code implements the same steps as the Debian Wiki describes, but in a container:

- installs the required packages
- creates the relevant config files for `dhcp-helper` and `avahi-daemon` and copy them in the container to the right location
- creates a start script which:
  - enables IP forwarding and ARP proxying
  - clones the IP address from `wlan0` to `eth0`
  - starts the `parprouted` proxy

I’ve tried it out, and this works okay in general, I could connect another device over Ethernet and get network. I’m sure it could be more fine-tuned and adjusted to particular use cases, but this is the basic setup, IMHO.

Let us know what do you think if you try it!

---

<div class="post-metadata">

**Author:** ![zuma](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/zuma/32/238_2.png) [@zuma](https://forums.balena.io/u/zuma)\
**Post date:** [January 12, 2017, 6:22am UTC](https://forums.balena.io/t/bridge-network-interfaces-rpi-3/490/9 "2017-01-12T06:22:13Z")

</div>

Hey @imrehg, it works perfectly!  
Thanks for going to the effort of setting up a repo with the solution, I really appreciate it.

---

<div class="post-metadata">

**Author:** ![nacho7592](https://avatars.discourse-cdn.com/v4/letter/n/e56c9b/32.png) [@nacho7592](https://forums.balena.io/u/nacho7592)\
**Post date:** [May 18, 2018, 7:20am UTC](https://forums.balena.io/t/bridge-network-interfaces-rpi-3/490/10 "2018-05-18T07:20:18Z")

</div>

Hey @imrehg, sorry for posting here in this old thread, but i have a question,  
i’m trying to get this work on the actual version of resinOS… “Resin OS 2.12.6+rev1” but it doesn’t works… is that because of the version? what could i do to make it work?

Thank you very much

---

<div class="post-metadata">

**Author:** ![jsmedley](https://avatars.discourse-cdn.com/v4/letter/j/a9a28c/32.png) [@jsmedley](https://forums.balena.io/u/jsmedley)\
**Post date:** [May 18, 2018, 6:36pm UTC](https://forums.balena.io/t/bridge-network-interfaces-rpi-3/490/11 "2018-05-18T18:36:57Z")

</div>

Hey @imrehg

I’m currently testing [resin.io](http://resin.io) on an industrial board and one of my needs is for the wireless hotspot to only have access to the docker containers and not through the LTE connection to the internet. It looks like this could be easily modified to perform that action for me.

---

<div class="post-metadata">

**Author:** ![balibebas](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/balibebas/32/981_2.png) [@balibebas](https://forums.balena.io/u/balibebas)\
**Post date:** [May 27, 2018, 7:28am UTC](https://forums.balena.io/t/bridge-network-interfaces-rpi-3/490/15 "2018-05-27T07:28:10Z")

</div>

> [@nacho7592](#):
>
> i’m trying to get this work on the actual version of resinOS… “Resin OS 2.12.6+rev1” but it doesn’t works… is that because of the version? what could i do to make it work?

I’ve started a new thread to cover this scenario here:

> [@Route Wireless to Wired with resinOS 2.x and RPi 3](https://forums.balena.io/t/bridge-wireless-to-wired-with-resinos-2-x-and-rpi-3/3219):
>
> I’d like to use resinOS 2.x to route traffic between a WiFi network and an Ethernet device, such as an actual router, plugged into the Ethernet port on my Raspberry Pi 3. With resinOS 1.x a solution was created here: Since newer versions of resinOS are using Network Manager the above approach may no longer work. The [BridgeNetworkConnectionsProxyARP](https://wiki.debian.org/BridgeNetworkConnectionsProxyArp) doc on the Debian Wiki seems to have a solution. But it’s not clear how it would be applied under resinOS 2.x. How can I route WiFi traffic to E…

If you figure it out please let me know.
