QMI How to share wwan0 with eth0

Hello every body.

I just reinstall my Raspberry Pi with the 3G/4G & LTE Base HAT and it works well.

I need to connect a second Raspberry to the ethernet port and both must have access to internet throught the wwan0. Specially the second Raspberry must have access to internet through the first which has the 4G HAT.

Addtionnaly, on the first PI, I configured it as a hotspot following that procedure but it look not the best because it show how to share wlan0 with eth0.

I also read this very useful tuto from sixfab

and I can see something very interresting comparing the first tuto from Raspebrry fundation

sudo iptables -t nat -A POSTROUTING -o wwan0 -j MASQUERADE

But my first important question, the SIXFAB tutorial configure the IP address in /etc/network/interfaces. On my Raspberry id do
less /etc/network/interfaces, I can read

#Please note that this file is written to be used with dhcpcd
#For static IP, consult /etc/dhcpcd.conf and ‘man dhcpcd.conf’

Secondely, I also can read

sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"

while the Raspberry tutorial they use

sudo netfilter-persistent save

Additonally SIXFAB privide a important script /etc/wwan2lan.sh

I would prefer to use /etc/dhcpcd.conf instead of /etc/network/interfaces

As the SIXFAB tuto has no date, I wonder which is the best practice.

Someone can tell me the best way to do it versu this article https://www.raspberrypi.org/documentation/configuration/wireless/access-point-routed.md ?

My goal is to provide an internet access from eth0 to wwan0. I also need to use wlan0 to access my raspberry, and if wlan0 (as a hotspot) can access internet vis wwan0 would be perfect

many thanks for your help

I solved my problem here https://eco-sensors.ch/router-wifi-4g-hotspot/#eth0

1 Like

When I try the solution you linked with a BG96 Pi HAT here, I can happily get cellular internet to transfer through the ethernet port.

However, i lose the use of the wifi in this process. Perhaps this wwlan-eth0 connection interrupts with wifi? Is there a way to toggle back and forth?