Port Forwarding with Resin 2.0 on RPi 3



Hi all, I have an RPi3 connected to a wireless network and an ethernet device with a static IP plugged into the RPi’s ethernet port. I need to be able to forward the port so the ethernet device is accessible via WiFi.

I had this configuration working with the same setup using resin 1.24.xx base image and the connman service by updating the config.json file in the resin-boot image:

Type = ethernet\nIPv4 =\nNameservers =,\n\n
[service_home_wifi]\nHidden = true\n
Type = wifi\nName = SSIDHERE\nPassphrase = PSKHERE\nNameservers =,"}

This allowed me to access the page served by the ethernet connected device via the IP of the RPi on the network.

With Resin v2.0 I have attempted modifying/creating a new file in /system-connections (similar to: Useful Comment)

As such:

I have created a new file called resin-ethernet which contains:




I’m still having no luck with getting this to work. I am wondering what I need to change to get this to work as it did on Resin v1.24 with Connman?

Enable Port forwarding for Raspberry Pi OTG network

Hey @Cwright11, according to NetworkManager.conf docs, Your [ipv4] section is not correct.
It should be like


Can you give it a try?


Hi @nghiant2710, thanks for your reply!

Unfortunately, this change didn’t solve the problem. The Pi is still unable to ping the device connected via the ethernet port.
By creating the resin-ethernet file and placing it inside resin-boot/system-connections will it automatically be utilised or is there another step to activate the interface?

The goal of the system is to have the RPi at a static address (e.g. and then have the eth0 interface configured at, The app then takes care of forwarding the ports so when you are on the network and visit you will be served the page of the eth0 connected device.

This was achieved as shown in original post through the config.json file.

Any tips on converting this to a Resin 2.0.0 friendly version?


If you drop a valid Network Manager connection file inside /boot/system-connections directory, Network manager will pick it up.

Oh, I notice there is a resin-wifi configuration file already there. So you need to use the Network Manager DBUS API to disable the connection called resin-wifi and enable the connection called resin-ethernet.


Okay, I believe the file is valid, these are the contents now:





The above is based on the sample in the resin 2.0.0 documentation.

With the resin-wifi file, I still need this active as the wifi is the means for both the pi and the ethernet connected device to connect to the network. They are sharing the connection essentially.

The problem I am having at the moment is that the ethernet connection is constantly trying to be the main connection to the network. Is there a way to set wlan0 as the main connection and only use eth0 as a gateway for the attached device?


This is a bit more concise explanation of what i’m trying to accomplish:

I’m using resin 2.0 on a raspberry pi 3 which has a wifi connection to a network and then shares this connection with a device plugged into the ethernet port. I’ve added the network configuration file for eth0 in the network connections folder but i’m having trouble when running my app. It is trying to use the ethernet connection to set up resin VPN and connect to internet.
How can I set the image up to prioritise wlan0 as the main interface?


I think you may need to set the autoconnect-priority inside the connection files, more info here


Thanks @joe, I gave it a try by setting the wifi connection up with priority 1 and left the ethernet at default 0 and still have the same problem. If anything is plugged into the ethernet port the device will go offline. If i remove the cable however the wifi will pick back up and it will recover.

I’ve read through the connection, wifi and ethernet sections of the manual and can’t seem to see a setting to ensure the wifi interface is the main connection to use.

I feel as though I am missing something simple, In my first post, that JSON snippet was all that was needed to get Resin to cooperative in V1.24, (This part: "network/network.config":"[service_home_ethernet]\n Type = ethernet\nIPv4 =\nNameservers =,8)

Is there another file I need to modify to achieve a result?


It’s definitely possible using Network manager connections only e.g.

Have you tried changing the connection method?
Search https://developer.gnome.org/NetworkManager/stable/ref-settings.html for shared


Thanks @joe!

Got there in the end with setting the ipv4 in ethernet file to ‘shared’. Originally I needed to have a static address as well in the 192.168.0.x range but conceded based on the docs forcing the shared adapter to have a 10.42.x.1 address. This just meant I had to change the addresses on the ethernet connected peripherals.

Thanks again!


Hi @Cwright11. I am understanding from the NetworkManager documentation that the the mode=shared defaults to 10.42.x.1. It sounds like you chose that option over assigning a different static IP as described in the doc? Did you do this because this assignment did not work? I just tried IP mapping option and am not having success.