🛠 Monter un point d'accès 4G avec le module Quectel EC20 du port mini-PCIe

Banana Pi BPI-CM4 (Amlogic A311D, Raspberry Pi CM4 form factor) · avance · Schéma : IMG-bananapi-cm4-avance-2-routeur-lte-4g-ec20-cm4.svg — module Quectel EC20 au format mini-PCIe avec deux antennes u.FL et une micro-SIM insérée, monté dans le port du carrier BPI-CM4IO ; flèches WAN (antenne 4G) vers LAN (câble RJ45).

Objectives

The BPI-CM4IO carrier exposes PCIe, USB 2.0, and a micro-SIM slot on its mini-PCIe port: the vendor wiki explicitly documents a Quectel EC20 LTE module as a WAN gateway (qmi_wwan driver, quectel-CM tool, pppd fallback, AT port on /dev/ttyUSB2). You will install the module, create the wwan0 interface, connect to the carrier, and then enable NAT sharing to turn the BPI-CM4 into a backup 4G router.

Hardware

Complete Code

# 1) Carrier éteint : insérer l'EC20, la micro-SIM, visser les 2 antennes u.FL.
sudo apt update && sudo apt install -y usbutils ppp curl minicom
lsusb | grep -i quectel            # ID vendeur 2c7c attendu
ls /dev/ttyUSB*                    # port AT = /dev/ttyUSB2

# 2) Diagnostic AT
sudo minicom -D /dev/ttyUSB2 -b 115200
#   AT+CPIN?   -> READY (sinon : AT+CPIN="1234")
#   AT+CSQ     -> qualité du signal (ex. 22,99)
#   AT+COPS?   -> opérateur enregistré

# 3) Mode QMI : charger le pilote et monter wwan0
sudo modprobe qmi_wwan
ip -br link | grep wwan
# quectel-CM : outil officiel Quectel (miroirs GitHub), compilé sur la carte
cd quectel-CM && make && sudo ./quectel-CM &
sudo dhclient wwan0
curl -s --interface wwan0 https://ifconfig.me

# 4) NAT WAN(wwan0) vers LAN(eth0)
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
sudo iptables -t nat -A POSTROUTING -o wwan0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o wwan0 -j ACCEPT
sudo iptables -A FORWARD -i wwan0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT

Expected Verification

AT+CSQ returns a usable signal quality (above approximately 15); wwan0 obtains an address from the carrier; curl --interface wwan0 displays the public 4G IP; a machine connected to the BPI's eth0 accesses the Internet via 4G. Throughput remains limited by the EC20 and signal strength, not by the local GbE connection.

Common Errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials