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

#/etc/network/intercaes
#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

Pierrot10
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?

MASQUERADE is your NAT on the way to the internet. What do you want to do with wlan0, have it connect to the local internet or be an wireless access point? I put my modem in ECM, turned off modem manager and managed my interfaces myself. I have a pi zero 2w that uses modem manager/network manager but it’s the only device it’s been stable on. Anyway here is a good tutorial for the hotspot https://peakup.org/blog/how-to-setup-raspberry-pi-as-access-point-router-ap-hotspot/. I would think you could bridge the usb0 and eth0 interfaces as well as use the AP to ssh/web-gui or whatever you want to do.