# Networking Setup: Raspberry Pi as a Router

**URL:** <https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441>\
**Category:** Product support\
**Tags:** network, raspberrypi4\
**Created:** [December 26, 2020, 12:10am UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441 "2020-12-26T00:10:54Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![byteminer](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@byteminer](https://forums.balena.io/u/byteminer)\
**Post date:** [December 26, 2020, 12:10am UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441/1 "2020-12-26T00:10:54Z")

</div>

Hey there,

first off, merry belated christmas to you all, I hope you had a nice christmas week.

I’m currently trying out Balena for an IoT-ish project and at this point I’ve happened across some networking issues that I seem incapable of resolving on my own. I’ve never worked with NetworkManager before, so I’m struggling a bit to wrap my head around getting it to do what I want it to, so I figured I’d ask for help here.

My setup is as follows:

- I have multiple Balena-imaged devices with network connectivity (Ethernet)
- I have one “main” device (also Balena-imaged) which has multiple network interfaces

The main device is a Raspberry Pi 4B. It has two ethernet ports (one via a USB adapter for the time being) and WiFi. The other devices have one ethernet port each.

I would like to set the Pi up such that it can intake an existing internet connection through some means (either one of the Ethernet ports or possibly a GSM modem later down the line) and subsequently act as a router for all “downstream” devices. A switch is hooked up to one of the ethernet ports, and several more devices are connected to that switch.

The end goal I have in mind would be for the Pi to work as a “router” in the sense that all downstream devices _and_ the WiFi would be in one network, with internet connectivity supplied to the Pi through a secondary interface. Let us assume this is another ethernet port to make this more concrete.

I’ve attached an image showing what I have in mind below.

 ![Balena Network](https://global.discourse-cdn.com/balena/original/2X/4/460f2f83095e1325b29991f2444fa121b470c49e.png)

I already have some progress towards this goal, but it’s not quite there yet.

I first created a WiFi hotspot according to Balena’s networking documentation:

```ini
[connection]
id=balena-hotspot
type=wifi
autoconnect=true
interface-name=wlan0
permissions=
secondaries=

[wifi]
band=bg
mac-address-blacklist=
mac-address-randomization=0
mode=ap
seen-bssids=
ssid=WiFi

[wifi-security]
group=
key-mgmt=wpa-psk
pairwise=
proto=rsn
psk=123456789

[ipv4]
dns-search=
method=shared

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=ignore

```

Then I found a setup that somewhat worked for the ethernet ports:

```auto
[connection]
id=eth-bridge
type=ethernet
interface-name=eth0
permissions=

[ethernet]
mac-address-blacklist=

[ipv4]
dns-search=
method=shared

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=ignore

[proxy]

```

Truth be told, I don’t exactly understand what this does, but it ended up with me being able to see some of the downstream devices when connected to the hotspot. However, the devices themselves did not connect to the outside world. I did have internet access through the hotspot though. It was quite strange (to me at least). It was like I was looking at the network through the eyes of my main device, not as a client connected to it.

I also noticed that in Balena Dashboard, the Raspberry Pi showed up with multiple IP addresses, presumably because of the hotspot. One IP was for the incoming internet connection, one for the Hotspot. There was also a third one in yet another subnet which I couldn’t pinpoint.

The closest I got for a similar setup was this: [https://raspberrypi.stackexchange.com/a/99598](https://raspberrypi.stackexchange.com/a/99598)  
Alas, it uses systemd networking, which is different from NetworkManager, I think, so does not translate properly to Balena’s environment.

As you can probably tell, this is a mess, so I’m hoping that somebody who knows more about working with NetworkManager than me can give me some pointers on:

- How to set this up
- Whether this setup is feasible
- Whether this setup is a good idea at all or whether something else may work better
- Whether my current approach is anywhere close to going into the right direction

Have a good one, hopefully someone can help me out with this 🙂

---

<div class="post-metadata">

**Author:** ![majorz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/majorz/32/639_2.png) [@majorz](https://forums.balena.io/u/majorz)\
**Post date:** [December 28, 2020, 1:35pm UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441/5 "2020-12-28T13:35:51Z")

</div>

I’ve never tried that myself, but it sounds theoretically possible. What you need first is to combine the wireless and wired interfaces in one additional interface and set method=shared on top of it. You can try with bond or bridge interfaces and see which one will work for you. The wireless and wired interfaces will be slave interfaces, where the new additional one will be a master interface.

---

<div class="post-metadata">

**Author:** ![byteminer](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@byteminer](https://forums.balena.io/u/byteminer)\
**Post date:** [December 28, 2020, 3:42pm UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441/7 "2020-12-28T15:42:15Z")

</div>

Okay, I’ve made some progress on this. That comment about bonding eventually led me to a somewhat working configuration thanks to some documentation I found.

My current setup looks as follows.

Bridge:

```auto
[connection]
id=bridge
type=bridge
interface-name=mybridge

[ipv4]
addresses=192.167.0.1/24
method=shared

[ipv6]
method=ignore

```

Ethernet:

```auto
[connection]
id=bridge-eth
type=ethernet
interface-name=eth0
master=mybridge
slave-type=bridge

```

Access Point:

```auto
[connection]
id=bridge-wlan
type=wifi
interface-name=wlan0
autoconnect=true
master=mybridge
slave-type=bridge

[wifi]
mode=ap
ssid=MySSID

```

With this setup, I can connect devices to both `wlan0` as well as a switch behind `eth0` and I can see them from either end.

Two conundrums that remain:

1. I couldn’t figure out how to get WiFi authentication to work properly yet
2. I do not have internet connectivity. While I can roam around inside the bridge network, I can not call out to anywhere

Any pointers regarding internet sharing with such a bridged setup?

According to the RedHat documentation on NetworkManager, this setup should automatically hook up the bridge to the default network interface. Mine is (I assume) correctly labeling the USB ethernet with the internet connection as `ipv4 default`, so that should be fine, I hope. Still, no actual connection. I’m wondering what is interfering with the NAT here.

---

<div class="post-metadata">

**Author:** ![alexgg](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@alexgg](https://forums.balena.io/u/alexgg)\
**Post date:** [December 28, 2020, 4:44pm UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441/8 "2020-12-28T16:44:11Z")

</div>

Hi, regarding WiFi security, you probably need a `wifi-security` section in your configuration file too, something like:

```auto
[wifi-security]
key-mgmt=wpa-psk
psk=<password>

```

Depending on the type of authentication you want to use the above might need tweaking.

Regarding internet connectivity, do you have a default gateway appear in your routing table? Check the output of the `route` command.

If not, try setting a `gateway` address in your `ipv4` configuration. Check the NetworkManager documentation for details [https://developer.gnome.org/NetworkManager/stable/settings-ipv4.html](https://developer.gnome.org/NetworkManager/stable/settings-ipv4.html).

---

<div class="post-metadata">

**Author:** ![byteminer](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@byteminer](https://forums.balena.io/u/byteminer)\
**Post date:** [December 28, 2020, 5:38pm UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441/10 "2020-12-28T17:38:32Z")

</div>

Thank you! The gateway was what did it. Adding it gave me full internet connectivity for downstream devices. `nmcli` rendered it into this configuration format:

```auto
[ipv4]
address1=192.167.0.1/24,192.167.0.1
method=shared

```

Regarding the security, unfortunately I’m having some trouble with that. If I set the security up like this:

```auto
[wifi-security]
group=
key-mgmt=wpa-psk
pairwise=
proto=rsn
psk=123456789

```

I lose the ability to connect to the AP. All connection attempts just boot me back to the “Enter Password” prompt, as if I had entered a wrong password. This happens on macOS as well as on my Android phone, which I tested with as a sanity check. It behaves as if the password is not `123456789`. This is quite puzzling, because I could’ve sworn this exact config worked standalone, as it’s effectively the same as the Hotspot example from the Balena Networking docs.  
`journalctl` doesn’t really output any useful information when these connection attempts happen, so I’m kind of at a loss here.

We’re getting closer though, thank you for the help!

---

<div class="post-metadata">

**Author:** ![alexgg](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@alexgg](https://forums.balena.io/u/alexgg)\
**Post date:** [December 28, 2020, 6:03pm UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441/11 "2020-12-28T18:03:41Z")

</div>

Hi, glad it helped. About the WiFi security, it’s better to configure the minimum and let NM flexibility to negotiate the rest, otherwise you might be forcing something that is non-negotiable. Try just with:

```auto
[wifi-security]
key-mgmt=wpa-psk
psk=<password>

```

Also, you can try to increase NetworkManager’s verbosity as explained in [https://www.balena.io/docs/learn/more/masterclasses/host-os-masterclass/#52-making-networkmanager-logs-more-verbose-in-four-ways](https://www.balena.io/docs/learn/more/masterclasses/host-os-masterclass/#52-making-networkmanager-logs-more-verbose-in-four-ways)

---

<div class="post-metadata">

**Author:** ![byteminer](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@byteminer](https://forums.balena.io/u/byteminer)\
**Post date:** [December 28, 2020, 6:27pm UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441/13 "2020-12-28T18:27:27Z")

</div>

Alas, even the elevated debug level outputs nothing that seems directly related to the connection issue (in combination with the config you proposed). The only thing I can see happening when attempting to connect to the AP is the line `wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0` being output by `wpa_supplicant`, which should be correct. Strangely though I also get this exact message if I submit an incorrect password, whereas this entry [here](https://raspberrypi.stackexchange.com/questions/107188) has led me to believe that it should be different.

There’s quiet a few somewhat similar topics to be found via a cursory google search, a lot of which pointed the finger at wpa\_supplicant, either by downgrading/upgrading it or it having a strange config, but I’m not sure whether that applies here.

I’m also seeing this somewhat puzzling output:

```auto
root@<device-id>:~# nmcli device wifi list
IN-USE SSID MODE CHAN RATE SIGNAL BARS SECURITY  
* MySSID Infra 1 0 Mbit/s 0 WPA1 WPA2 

```

Maybe the rate of 0 has something to do with this?

Is it possible that my config is not taking entirely? That shouldn’t be Infra, as far as I can tell.

# Edit

Okay, did a quick sanity check with the non-bridge AP, and that works flawlessly:

```auto
wpa_supplicant[1587]: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wpa_supplicant[1587]: wlan0: AP-STA-CONNECTED MAC-ADDRESS
dnsmasq-dhcp[1882]: DHCPDISCOVER(wlan0) MAC-ADDRESS
dnsmasq-dhcp[1882]: DHCPOFFER(wlan0) 10.42.0.162 MAC-ADDRESS
dnsmasq-dhcp[1882]: DHCPDISCOVER(wlan0) MAC-ADDRESS
dnsmasq-dhcp[1882]: DHCPOFFER(wlan0) 10.42.0.162 MAC-ADDRESS
dnsmasq-dhcp[1882]: DHCPREQUEST(wlan0) 10.42.0.162 MAC-ADDRESS
dnsmasq-dhcp[1882]: DHCPACK(wlan0) 10.42.0.162 MAC-ADDRESS
dnsmasq-dhcp[1882]: DHCPREQUEST(wlan0) 10.42.0.162 MAC-ADDRESS
dnsmasq-dhcp[1882]: DHCPACK(wlan0) 10.42.0.162 MAC-ADDRESS
dnsmasq-dhcp[1882]: DHCPREQUEST(wlan0) 10.42.0.162 MAC-ADDRESS
dnsmasq-dhcp[1882]: DHCPACK(wlan0) 10.42.0.162 MAC-ADDRESS

```

I can connect and everything works just fine. The config used was taken from the Balena docs [here](https://www.balena.io/docs/reference/OS/network/2.x/#creating-a-hotspot) and looks like this:

```auto
[connection]
id=balena-hotspot
type=wifi
autoconnect=true
interface-name=wlan0

[wifi]
mode=ap
ssid=MySSID

[wifi-security]
key-mgmt=wpa-psk
psk=123456789

[ipv4]
method=shared

[ipv6]
method=ignore

```

So how can it be that when I add

```auto
master=mybridge
slave-type=bridge

```

to this config, that the connection suddenly breaks? Is this a documented incompatibility that is not supposed to work, or is this an issue that might span a bit more than just my particular usecase?

# Edit

Doing a bit more digging today and I came across [this](https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/638) PR to NetworkManager, which seems to indicate that in a configuration where a WiFi AP is slaved to a bridge interface, NM may not properly pass through the interface name of the bridge, which could potentially cause this issue. This is also corroborated [here](https://unix.stackexchange.com/questions/620169).

I see that the NM on the Balena image is version `1.20.2`:

```auto
root@<device-id>:~# nmcli -v    
nmcli tool, version 1.20.2

```

This version was released in September 2019, so I assume updating to a newer version might work. Thoughts on this?

---

<div class="post-metadata">

**Author:** ![byteminer](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@byteminer](https://forums.balena.io/u/byteminer)\
**Post date:** [December 31, 2020, 12:28pm UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441/15 "2020-12-31T12:28:18Z")

</div>

Not sure if double posting/bumping is allowed (please let me know if it isn’t). I added some information to my previous post and I’m not sure whether that generates a notification or not, so this post is meant to trigger that if it didn’t.

---

<div class="post-metadata">

**Author:** ![chrisys](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/chrisys/32/1731_2.png) [@chrisys](https://forums.balena.io/u/chrisys)\
**Post date:** [December 31, 2020, 4:11pm UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441/16 "2020-12-31T16:11:53Z")

</div>

I don’t have any further ideas to share regarding your debug quest, but have you taken a look at the methods used in our AP/Repeater project here? I’m wondering if it may generate some ideas: [https://github.com/balenalabs-incubator/wifi-repeater](https://github.com/balenalabs-incubator/wifi-repeater)

---

<div class="post-metadata">

**Author:** ![byteminer](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@byteminer](https://forums.balena.io/u/byteminer)\
**Post date:** [December 31, 2020, 11:58pm UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441/17 "2020-12-31T23:58:28Z")

</div>

Thanks for the input, I appreciate it!  
Unfortunately this project only makes somewhat rudimentary use of NetworkManager in such capacity as that multiple WiFi interfaces are activated or shared to an Ethernet connection. That part also works here.

The main problem as I currently see it lies within the specific behavior of NetworkManager in the case where a WiFi AP is slaved to a network bridge. In that particular case, `wpa_supplicant` can fail to initialize properly, causing non-connectivity for the WiFi AP.

As far as I was able to determine up until now, this may actually be a bug/strange behavior in NetworkManager itself, so I might be bitten here unless there’s some way I can get a more up-to-date version going. Is there some way I can upgrade it on the image myself? Can I download the sources and compile? Run a docker container with a newer version of NM?

If none of these are options, I think I will remove Balena from my Raspberry Pi and test on regular Ubuntu (with NM enabled). Hopefully I’ll be able to get a newer version there so that I can compare the behavior.

---

<div class="post-metadata">

**Author:** ![byteminer](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@byteminer](https://forums.balena.io/u/byteminer)\
**Post date:** [January 4, 2021, 1:21pm UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441/20 "2021-01-04T13:21:42Z")

</div>

Since I can’t edit my post anymore I’ll post an update like this.  
I tried compiling the latest master version of NM from source and using that to try and replicate my issue (in the hopes that the PR/issue I linked actually fixed this problem), but unfortunately I did not manage it. NM has an absolute boatload of dependencies and compilation takes ages on my Raspberry Pi, so after a few failed compilation attempts I gave up due to time constraints. The one time I did actually manage to get it to build it failed because some libraries weren’t properly linking at runtime. I did not have the strength of mind to debug go further down this rabbit hole at that point.

As such I’m posting my current progress in the faint hope that maybe someday, this will be resolved properly. As far as I can tell right now, this is in fact an issue with the old version of NM shipping on Balena images, and there’s very little a user can do about it save for building their own custom image (which I think is possible but likely troublesome, given my experience with compiling NM just now).

Anyway, the NM configuration files to get this router-AP business going are as follows:

Create a bridge:

```auto
[connection]
id=bridge
type=bridge
interface-name=mybridge

[ipv4]
address1=192.167.0.1/24,192.167.0.1
method=shared

[ipv6]
method=ignore

```

This needs to set the IP subnet and range as well as the gateway in the form shown above for internet connectivity to work properly.

Next, we can slave a free ethernet interface to the bridge:

```auto
[connection]
id=bridge-eth
type=ethernet
interface-name=eth0
master=mybridge
slave-type=bridge

```

Here I use the default one integrated into the Raspberry Pi as I have a USB ethernet dongle connected providing the actual internet connection.

Lastly, the AP can be configured thusly:

```auto
[connection]
id=bridge-wlan-no-sec
type=wifi
interface-name=wlan0
autoconnect=true
master=mybridge
slave-type=bridge

[wifi]
mode=ap
ssid=MySSID

```

In a perfect world, one would be able to add security to the AP like this:

```auto
[wifi-security]
key-mgmt=wpa-psk
psk=123456789

```

However, with the current situation, it is **absolutely essential** that the AP is unprotected as otherwise it will not allow any connections to it.

With this setup, if a secondary ethernet connection is established with an existing internet connection, everything downstream from the Raspberry Pi will see the same it would if it were an actual router serving this network. Downstream devices have their own subnet plus a route to the internet and can see each other between WiFi and Ethernet.

If anybody else comes across this thread and has any insight to share whatsoever, please by all means go ahead, I’m still looking for a fully working solution enabling security, so feel free to share anything that might help. I’ll update this thread with a solution should I ever find one.

---

<div class="post-metadata">

**Author:** ![majorz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/majorz/32/639_2.png) [@majorz](https://forums.balena.io/u/majorz)\
**Post date:** [January 5, 2021, 12:49pm UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441/22 "2021-01-05T12:49:04Z")

</div>

Thanks for the detailed upgrade. We are going to release an updated version of NetworkManager in upcoming balenaOS release. It is scheduled already and usually it takes a few weeks to reach production. Before that it reaches staging though: [https://dashboard.balena-staging.com/](https://dashboard.balena-staging.com/). You may check in a couple of weeks to see whether it is available.

---

<div class="post-metadata">

**Author:** ![byteminer](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@byteminer](https://forums.balena.io/u/byteminer)\
**Post date:** [January 5, 2021, 1:00pm UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441/24 "2021-01-05T13:00:34Z")

</div>

Sweet, thanks a ton for being this responsive on the issue!  
I’ll certainly check this out in a few weeks time and let you know of the outcome.  
Thanks again!

---

<div class="post-metadata">

**Author:** ![zvin](https://avatars.discourse-cdn.com/v4/letter/z/a5b964/32.png) [@zvin](https://forums.balena.io/u/zvin)\
**Post date:** [January 29, 2021, 1:02pm UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441/26 "2021-01-29T13:02:43Z")

</div>

Hello @byteminer, NetwokManager will be updated to 1.28.0 in balenaOS 2.68.0: [networkmanager: Update to 1.28.0 by majorz · Pull Request #2091 · balena-os/meta-balena · GitHub](https://github.com/balena-os/meta-balena/pull/2091/commits/20e9c276f8d79b6051066e24b159c8bd9ffe3bc2)  
A 2.68.0 raspberry pi image has not been released yet.

---

<div class="post-metadata">

**Author:** ![byteminer](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@byteminer](https://forums.balena.io/u/byteminer)\
**Post date:** [January 29, 2021, 2:06pm UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441/28 "2021-01-29T14:06:14Z")

</div>

Thanks for the update!  
I’ll investigate once an image is available and post my findings here.

---

<div class="post-metadata">

**Author:** ![spacetesla](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@spacetesla](https://forums.balena.io/u/spacetesla)\
**Post date:** [December 13, 2023, 12:48pm UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441/30 "2023-12-13T12:48:25Z")

</div>

hi!  
I have been struggling with getting something very similar to work.  
I’m using an iotgate.imx8Plus as my IoT Balena device.  
I want it to behave like a simple LTE wifi router, so that it will make a cellular connection and connect to the internet and act as DHCP server on the wlan0, eth0 and eth1 infterfaces which are ideally just a single local network.  
I can get the mobile connection working, I can make a wifi hotspot and connect to it and have it provide internet access, but as soon as I start trying to bridge eth0/1 to wlan0, everything stops working.  
I’m now at a point where only the mobile connection still works, but I can’t use eth0/1 anymore.

I created the following files in ‘/mnt/state/root-overlay/etc/NetworkManager/system-connections’:  
cellular

```auto
[connection]
id=cellular
type=gsm
autoconnect=true

[gsm]
apn=terminal
number=*99#

[serial]
baud=115200

[ipv4]
method=auto

[ipv6]
addr-gen-mode=stable-privacy
method=auto

```

bridge

```auto
[connection]
id=bridge
type=bridge
interface-name=mybridge

[ipv4]
address1=192.167.0.1/24,192.167.0.1
method=shared

[ipv6]
method=ignore

```

bridge-eth0

```auto
[connection]
id=bridge-eth0
type=ethernet
interface-name=eth0
master=mybridge
slave-type=bridge

```

bridge-eth1

```auto
[connection]
id=bridge-eth1
type=ethernet
interface-name=eth1
master=mybridge
slave-type=bridge

```

wifi

```auto
[connection]
id=bridge-wlan-no-sec
type=wifi
interface-name=wlan0
autoconnect=true
master=mybridge
slave-type=bridge

[wifi]
mode=ap
ssid=MySSID

```

I can get wireless security to work, but it’s just easier to do testing with it unsecured.  
My issue right now is that these settings don’t seem to do (anymore?) what I would expect (bridge eth0, eth1 and wlan0, set the IP range of the bridge and make it act as a DHCP server and provide internet access to the bridge from the mobile connection).  
Any help or pointers are appreciated!

---

<div class="post-metadata">

**Author:** ![spacetesla](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@spacetesla](https://forums.balena.io/u/spacetesla)\
**Post date:** [December 13, 2023, 1:21pm UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441/31 "2023-12-13T13:21:43Z")

</div>

Now that I have done every step again, just to be sure, I notice that everything works, except for internet access.  
‘nmcli dev’

```auto
DEVICE TYPE STATE CONNECTION         
mybridge bridge connected bridge             
supervisor0 bridge connected (externally) supervisor0        
cdc-wdm0 gsm connected cellular           
eth0 ethernet connected bridge-eth0        
eth1 ethernet connected bridge-eth1        
wlan0 wifi connected bridge-wlan-no-sec 
p2p-dev-wlan0 wifi-p2p disconnected --                 
balena0 bridge unmanaged --                 
resin-dns bridge unmanaged --                 
canC can unmanaged --                 
canE can unmanaged --                 
lo loopback unmanaged --   

```

‘nmcli con’

```auto
NAME UUID TYPE DEVICE      
bridge 745fca2c-50a2-3422-a257-ab476dd20fd3 bridge mybridge    
cellular d811a35a-70fc-3716-84e1-a3578d10cc1e gsm cdc-wdm0    
supervisor0 a38b01fb-3a16-4a0c-96ee-46be0aaf8c1b bridge supervisor0 
bridge-eth0 09960249-b4fe-3afb-9b54-871cc3efbbd1 ethernet eth0        
bridge-eth1 bb1a9589-2de1-3625-b682-07b46551dd56 ethernet eth1        
bridge-wlan-no-sec e4d0d4a4-ef48-3ca6-822f-880f58a151eb wifi wlan0   

```

What should I change about my bridge config so that it will route traffic from inside the bridge to the internet over the mobile connection.

```auto
7: wwan0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/[65534] 
    inet 10.48.224.217/30 brd 10.48.224.219 scope global noprefixroute wwan0
       valid_lft forever preferred_lft forever

```

Look forward to finding a solution for this!

---

<div class="post-metadata">

**Author:** ![spacetesla](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@spacetesla](https://forums.balena.io/u/spacetesla)\
**Post date:** [December 14, 2023, 8:55am UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441/32 "2023-12-14T08:55:16Z")

</div>

Just wanted to update here to say I found the problem and solution.  
When I ran ‘ip route’ I noticed there were 2 default routes and the one going to the bridge had the lowest metric, so blocked internet access.  
Removing the route fixed the issue.  
To prevent the route from being created in the first place, I simply removed the ‘,192.167.0.1’ from the end of the ‘address’ line in the file ‘bridge’.  
Hope this can help others in the future too!

---

<div class="post-metadata">

**Author:** ![mpous](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mpous/32/4742_2.png) [@mpous](https://forums.balena.io/u/mpous)\
**Post date:** [December 14, 2023, 9:07am UTC](https://forums.balena.io/t/networking-setup-raspberry-pi-as-a-router/229441/33 "2023-12-14T09:07:06Z")

</div>

Thanks @spacetesla for sharing your solution here!
