WiFi to Ethernet bridge

Hey!
I’m wondering if its possible to bridge the wifi connection to output its connection from the ethernet port if that makes sense? Would prefer that this would be done with the balenaOS. :slight_smile:

I connect the RPI to WiFi, and connect the computer to the RPI with a ethernet cable, and the RPI would share its WiFi connection to the computer via ethernet.

1 Like

hi @danielsenorjan ,
I am pretty sure it is possible to do this but you will end up with a fairly complex network setup with a lot of possible points of failure so I would only suggest trying if you have a fairly solid understanding of networking.

For starters you would have to make up your mind how to connect your computer. You could use static ip addresses or if you want to use dhcp either the computer or the RPi would have to provide a dnsmasq server. Typically this would be the RPi as it also knows the network configuration (default router, name server…)
In this case you would have to provide a NetworkManager configuration for the eth0 interface providing a static IP address for the RPI. You would then have to create an container with Host Networking enabled that runs the dnsmasq DNS & DHCP server. The Server would need to be set up to forward DNS queries and DHCP would hand out a compatible address range.
Next thing you would have to configure the IP-tables firewall to provide masquerading of the packets coming from the subnet that you have created.
Otherwise the packets you forward are never going to be routed back to you. Messing with the ip_tables firewall has to be done with special care as there are a set of rules governing the docker network interfaces and you do not want to destroy those. I found some recipes on how to do this in ubuntu but most start by deleting all sorts of firewall rules which would not do you any good.
Last thing is the routing. You would have to make sure that the packets from and to your subnet are being routed to the internet and back to your subnet.
If you are not familiar with the above tasks you are likely to render your rpi offline at some point so you better have a monitor & keyboard ready for that case.

You best bet would probably be to look for a project which delivers this service and allows you to configure it with a GUI or web interface or to hook your computer in to a free port on the Wifi router…
Regards Thomas

1 Like

Maybe following link could help you: Bridging with a wireless NIC

Hey @danielsenorjan welcome to the forums.

In addition to what my colleague Thomas, and what Jan posted above, there are some more resources and sample projects in this thread which may help: Route Wireless to Wired with resinOS 2.x and RPi 3