0020 MPU4G(PCIe to USB 4G LTE EN:修订间差异
第5行: | 第5行: | ||
The MPU4G is a 4G expansion board specifically designed for the Raspberry Pi 5. First, expand four USB 2.0 interfaces through the PCIe interface, then connect one of the USB 2.0 signals to the 4G module on the miniPCIe interface. The remaining three USB 2.0 interfaces are brought out in the form of a 1.25mm 4Pin connector. These three interfaces can be used to further expand 1-3 CM4-sized 4G modules. When expanding more than two 4G modules, please pay attention to the power supply. They can also be used to expand our temperature and humidity modules or GPS modules. The 4G modules included with the expansion board are driver-free and do not require dial-up. They are automatically recognized and plug-and-play under the Raspberry Pi official OS/Ubuntu, eliminating the need for additional driver installation. Their target applications include 4G access, multi-4G carrier aggregation, and remote unattended operation. | The MPU4G is a 4G expansion board specifically designed for the Raspberry Pi 5. First, expand four USB 2.0 interfaces through the PCIe interface, then connect one of the USB 2.0 signals to the 4G module on the miniPCIe interface. The remaining three USB 2.0 interfaces are brought out in the form of a 1.25mm 4Pin connector. These three interfaces can be used to further expand 1-3 CM4-sized 4G modules. When expanding more than two 4G modules, please pay attention to the power supply. They can also be used to expand our temperature and humidity modules or GPS modules. The 4G modules included with the expansion board are driver-free and do not require dial-up. They are automatically recognized and plug-and-play under the Raspberry Pi official OS/Ubuntu, eliminating the need for additional driver installation. Their target applications include 4G access, multi-4G carrier aggregation, and remote unattended operation. | ||
The MiniPCIe 4G models are as follows: Domestic solution CAT4 4G and ZTE CAT4 4G, Quectel EC20 Voice | The MiniPCIe 4G models are as follows: Domestic solution CAT4 4G and ZTE CAT4 4G, Quectel EC20-GPS Voice Lite version (with call and SMS functions), Qualcomm 4G, and Qualcomm 4G-GPS version. There are also international versions, such as the Qualcomm 4G European version (NL668-EU), Australian version (NL668-EAU), and North American version (NL668-AM), among others. | ||
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_87.jpg | http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_87.jpg | ||
第48行: | 第48行: | ||
! | ! | ||
!CAT4 | !CAT4 | ||
! | !Qualcomm 4G/GPS | ||
!ZTE CAT4 | !ZTE CAT4 | ||
!EC20- | !EC20-GPS Voice lite version | ||
|- | |- | ||
|BAND | |BAND | ||
第109行: | 第109行: | ||
Under normal conditions, the "4G" LED indicator on the expansion board flashes rapidly." | Under normal conditions, the "4G" LED indicator on the expansion board flashes rapidly." | ||
=== 3.4 Quectel EC20 voice | === 3.4 Quectel EC20-GPS voice lite version === | ||
By executing <code>ifconfig -a</code> in the Raspberry Pi terminal, we can see that the 4G module (usb0) has successfully obtained an IP address. | By executing <code>ifconfig -a</code> in the Raspberry Pi terminal, we can see that the 4G module (usb0) has successfully obtained an IP address. | ||
第172行: | 第172行: | ||
9. Measured data usage: Under remote desktop, the Raspberry Pi consumes about 2MB of data per minute; under The remote shell is as follows: line interface, the Raspberry Pi consumes about 100KB of data per minute. | 9. Measured data usage: Under remote desktop, the Raspberry Pi consumes about 2MB of data per minute; under The remote shell is as follows: line interface, the Raspberry Pi consumes about 100KB of data per minute. | ||
== ''' | == '''IV. Work with Ubuntu OS''' == | ||
Ubuntu OS: | Ubuntu OS: | ||
第387行: | 第387行: | ||
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_70.jpg | http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_70.jpg | ||
==== 5.4.2 EC20- | ==== 5.4.2 Quectel EC20-GPS voice lite version ==== | ||
===== 5.4.2.1 | ===== 5.4.2.1 Operation of GPS ===== | ||
To use the GPS function of EC20, you need to connect a GPS active antenna and ensure that the GPS antenna is extended outdoors. GPS is operated via AT commands. | |||
Open '''ttyUSB3''' serial port by minicom: | |||
<code>sudo minicom -D /dev/ttyUSB3</code> | <code>sudo minicom -D /dev/ttyUSB3</code> | ||
and execute: | |||
<code>AT+QGPS=1</code> | <code>AT+QGPS=1</code> | ||
第402行: | 第402行: | ||
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_63.jpg | http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_63.jpg | ||
Open '''ttyUSB1''' serial port by minicom, and you can obtain GPS information: | |||
<code>sudo minicom -D /dev/ttyUSB1</code> | <code>sudo minicom -D /dev/ttyUSB1</code> | ||
第408行: | 第408行: | ||
http://www.mcuzone.com/wiki/5002_CM5_Basic/5002_CM5_Basic_64.jpg | http://www.mcuzone.com/wiki/5002_CM5_Basic/5002_CM5_Basic_64.jpg | ||
If you find the raw GPS data in minicom not very intuitive, we can install gpsd to extract the GPS information: | |||
<code>sudo apt-get install gpsd gpsd-clients</code> | <code>sudo apt-get install gpsd gpsd-clients</code> | ||
第414行: | 第414行: | ||
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_65.jpg | http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_65.jpg | ||
Then configure the gpsd software: | |||
<code>sudo gpsd /dev/ttyUSB1 -N -D 9 -F /var/run/gpsd.sock -S 3333</code> | <code>sudo gpsd /dev/ttyUSB1 -N -D 9 -F /var/run/gpsd.sock -S 3333</code> | ||
第420行: | 第420行: | ||
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_66.jpg | http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_66.jpg | ||
''''' | '''''Note: 3333 is the listening port, which can be customized as needed.''''' | ||
Do not close the configuration terminal window, instead, open a new terminal window and execute: | |||
<code>cgps -s localhost:3333</code> | <code>cgps -s localhost:3333</code> | ||
第428行: | 第428行: | ||
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_67.jpg | http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_67.jpg | ||
From the output interface, information such as time, latitude and longitude, speed, and altitude can be seen. | |||
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_68.jpg | http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_68.jpg | ||
===== 5.4.2.2 | ===== 5.4.2.2 Send SMS ===== | ||
Sending text messages involves using AT commands. Here, we will introduce the process of sending SMS using English characters. | |||
Follow the steps in section 5.1 to enable the ttyUSB serial port. Then execute <code>sudo minicom -s</code>, select "Serial port setup": | |||
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_100.jpg | http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_100.jpg | ||
Press A and F to modify the serial port number and flow control as shown in the figure below: | |||
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_101.jpg | http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_101.jpg | ||
After making the modifications, press Enter to return to the previous menu, and select "Exit" to quit: | |||
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_102.jpg | http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_102.jpg | ||
Execute the following AT commands in sequence: | |||
<code>AT+CMGF=1</code> // | <code>AT+CMGF=1</code> //Set the SMS characters to English | ||
<code>AT+CMGS="13xxxxxxxxx"</code> // | <code>AT+CMGS="13xxxxxxxxx"</code> //Set the number to receive SMS messages | ||
After pressing Enter, input the SMS content after the ">", then press Ctrl+Z to send. A successful send will display "+CMGS 14": | |||
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_103.jpg | http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_103.jpg | ||
第486行: | 第486行: | ||
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_106.jpg--> | http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_106.jpg--> | ||
=== 5.5 | === 5.5 Some knowledge about network policies === | ||
If you need to learn about some network strategy knowledge, you can refer to the following link: | |||
[[1001 RPi0 4G | [[1001 RPi0 4G CAT1-ETH(RS485 OPT#3.2.2 Set network adapter priority|How to set network adapter priority]] | ||
[[1001 RPi0 4G | [[1001 RPi0 4G CAT1-ETH(RS485 OPT#3.2.3 Using udhcpc to specify DNS servers|Using udhcpc to specify DNS servers]] | ||
== ''' | == '''VI. Work with OpenWrt''' == | ||
我们测试用的OpenWrt系统版本为:openwrt-bcm27xx-bcm2712-rpi-5-squashfs-sysupgrade-linux-6.1.100-20240805.img.gz | 我们测试用的OpenWrt系统版本为:openwrt-bcm27xx-bcm2712-rpi-5-squashfs-sysupgrade-linux-6.1.100-20240805.img.gz | ||
2025年2月24日 (一) 11:48的版本
Keywords
Raspberry Pi 5, Raspberry Pi, 4G LTE, PCIe, mini PCIe, AT Commands
I. Introduction
The MPU4G is a 4G expansion board specifically designed for the Raspberry Pi 5. First, expand four USB 2.0 interfaces through the PCIe interface, then connect one of the USB 2.0 signals to the 4G module on the miniPCIe interface. The remaining three USB 2.0 interfaces are brought out in the form of a 1.25mm 4Pin connector. These three interfaces can be used to further expand 1-3 CM4-sized 4G modules. When expanding more than two 4G modules, please pay attention to the power supply. They can also be used to expand our temperature and humidity modules or GPS modules. The 4G modules included with the expansion board are driver-free and do not require dial-up. They are automatically recognized and plug-and-play under the Raspberry Pi official OS/Ubuntu, eliminating the need for additional driver installation. Their target applications include 4G access, multi-4G carrier aggregation, and remote unattended operation.
The MiniPCIe 4G models are as follows: Domestic solution CAT4 4G and ZTE CAT4 4G, Quectel EC20-GPS Voice Lite version (with call and SMS functions), Qualcomm 4G, and Qualcomm 4G-GPS version. There are also international versions, such as the Qualcomm 4G European version (NL668-EU), Australian version (NL668-EAU), and North American version (NL668-AM), among others.
II. Hardware Spec
1. One PCIe interface, 0.5mm 16P, used to connect to the Raspberry Pi 5's own PCIe interface, and PCIe expands to 4 USB ports.
2. One Mini PCIe 4G LTE interface.
3. One Nano SIM card slot, single SIM single standby.
4. Triple-channel USB 2.0 interface, 1.25mm-4P, can be used to expand 1-3 channels of 4G.
5. Two LED lights, one serving as the power indicator and the other as the 4G status light.
6. Reserve two 4G SMA antenna interfaces.
7. Reserve two 4G SMA antenna interfaces.
8. Size: 85*56mm. Fully compatible with the Raspberry Pi 5 in terms of size and mounting holes. The board features a grooved design that does not interfere with the GPIO of the Raspberry Pi 5.
9. Aluminum alloy casing(OPT.)
CAT4 | Qualcomm 4G/GPS | ZTE CAT4 | EC20-GPS Voice lite version | |
---|---|---|---|---|
BAND | LTE FDD:B1/3/5/8
LTE TDD:B34/38/39/40/41 |
LTE FDD:B1/3/5/8
LTE TDD:B34/38/39/40/41 WCDMA:B1/8 TDSCDMA:B34/39 EVDO/CDMA1X:BC0 GSM/GPRS/EDGE:900/1800MHz(OPT) |
LTE FDD:B1/3/5/8
LTE TDD:B34/38/39/40/41 |
LTE FDD:B1/3/5/8
LTE TDD:B34/38/39/40/41 WCDMA:B1/8 TDSCDMA:B34/39 CDMA:BC0 GSM:900/1800MHz |
III. Work with Raspberry Pi OS
Raspberry Pi OS: 2024-07-04-raspios-bookworm-arm64.img.xz
You can download it in:
https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit
Different 4G models recognize different device models, usually as eth1 or usb0 devices.
3.1 Qualcomm 4G module
By executing ifconfig -a
in the Raspberry Pi terminal, we can see that the 4G module (usb0) has successfully obtained an IP address.
Under normal conditions, the "4G" LED indicator on the expansion board will blink slowly, with occasional brief fast flashes in between.
3.2 CAT4 4G module
By executing ifconfig -a
in the Raspberry Pi terminal, we can see that the 4G module (eth1) has successfully obtained an IP address.
Under normal conditions, the "4G" LED indicator on the expansion board will blink slowly (the duration of the light being on is longer than the duration of it being off).
3.3 ZTE CAT4 4G module
By executing ifconfig -a
in the Raspberry Pi terminal, we can see that the 4G module (eth1) has successfully obtained an IP address.
Under normal conditions, the "4G" LED indicator on the expansion board flashes rapidly."
3.4 Quectel EC20-GPS voice lite version
By executing ifconfig -a
in the Raspberry Pi terminal, we can see that the 4G module (usb0) has successfully obtained an IP address.
Under normal conditions, the "4G" LED indicator on the expansion board will blink slowly.
3.5 Internet test
After the 4G module successfully obtains an IP address, we can ping external network addresses, such as:
ping www.mcuzone.com
It is also possible to connect to the external network via a 4G module and access a speed test website to measure the speed, with the results as follows:
Note: Network speed tests are affected by the network environment and testing methods. Please refer to the actual speed, as this test is for reference only.
3.6 Remote Connection to Raspberry Pi(4G application)
If you want to use 4G for remote access to a Raspberry Pi 5, the official Raspberry Pi OS (Bookworm version) comes with an example application called Raspberry Pi Connect that you can refer to and use. With the Raspberry Pi paired with 4G, and through the official remote control software Raspberry Pi Connect, you can securely access your Raspberry Pi from anywhere in the world. Here, we will demonstrate how to configure the remote connection service.
The configuration and usage instructions are as follows:
1. Apply for a Raspberry Pi ID at https://id.raspberrypi.com/.
2. Install the Raspberry Pi Connect software in the Raspberry Pi OS (no need to install if it is already installed):
sudo apt install rpi-connect
3. Restart the system, and in the GUI, sequentially select the items as shown in the following image to ensure that Raspberry Pi Connect is turned on:
4. In the upper right corner, there will be a Raspberry Pi Connect icon.
5. Click on this icon, select "Sign in" and use your previously registered Raspberry Pi ID to log in on the pop-up webpage. Then set the device name.
6. After successfully logging in, access https://connect.raspberrypi.com/
in a browser on Windows and log in.
7. Click "Connect via" to choose between using Screen sharing or the Remote shell Interface.
8. Screen sharing is as follows:
The remote command line interface is as follows:
9. Measured data usage: Under remote desktop, the Raspberry Pi consumes about 2MB of data per minute; under The remote shell is as follows: line interface, the Raspberry Pi consumes about 100KB of data per minute.
IV. Work with Ubuntu OS
Ubuntu OS:
ubuntu-24.04-preinstalled-desktop-arm64+raspi.img.xz(Desktop, GUI version)
ubuntu-24.04-preinstalled-server-arm64+raspi.img.xz(Server, command line version)
You can download it in:
https://ubuntu.com/download/raspberry-pi
4.1 Ubuntu Desktop OS
Ubuntu Desktop OS(GUI version). When executing ifconfig -a
in the terminal, all 4G modules are recognized as network interfaces starting with enx
, and they can be used directly without the need for drivers or additional configuration.
4.2 Ubuntu Server OS
When the Ubuntu Server OS (command line version) is used on a Raspberry Pi 5, only one network interface is enabled by default, and the Wi-Fi functionality is disabled. So if you want to use 4G or WiFi, you need to enable the second and third network interfaces, and manually add a network card to use them. We will demonstrate the steps to enable Wi-Fi and use 4G on Ubuntu Server.
4.2.1 System flashing and setting up SSH
When flashing the system, it is recommended to pre-configure the WiFi and SSH settings in the Raspberry Pi imager.
Insert the TF card into the Raspberry Pi and boot up the system. The login username and password are the ones pre-configure; if not pre-configure, both are ubuntu
, and you will be prompted to change the password after successful login.
After the modifications are completed, it will automatically enter the system.
4.2.2 Configure system network
The operation here is demonstrated using CAT 4G as an example.
Note: The system does not come with the ifconfig tool by default, only the ip command is available.
Execute ip addr
to view and record the network interface name.
Among them, eth0 is the built-in Gigabit Ethernet port of the Raspberry Pi 5, enx000c29a39b6d is the 4G module, and wlan0 is the Raspberry Pi's own wireless network card (the system has been pre-configured with wireless hotspot information during the initial setup, so the wireless network card can be used immediately after booting).
Then run the following command to open the network card configuration file:
sudo nano /etc/netplan/50-cloud-init.yaml
Please edit the network card configuration file according to the image below:
Save and exit, then reboot.
After rebooting, you can connect to the internet. Install the net-tools package for ease of use:
sudo apt install net-tools
Once the net-tools package is installed, you can use the command ifconfig -a
to check the network status.
It is evident that both the wired network card and the 4G module have obtained IP addresses at this point.
"By ping
an external server through a specific network card, we can verify whether the network card is functioning properly. For example, if we ping
an external IP address and website using a 4G module, the results are as follows:"
ping 220.189.255.38 -I enx000c29a39b6d
ping www.mcuzone.com -I enx000c29a39b6d
V. AT command operation
5.1 AT command operation
Taking Qualcomm 4G as an example, execute lsusb
in terminal:
Record the ID value of the 4G module: 05c6 90b6 (The ID number for each type of module varies; please refer to the actual details for accurate information.)
Use the following command to open the ttyUSB serial port, where the value after echo is the ID recorded above:
sudo modprobe option
sudo sh -c 'echo 05c6 90b6 > /sys/bus/usb-serial/drivers/option1/new_id'
After executing the above two commands, proceed with:
ls /dev
At this point, you should be able to see three devices under the dev directory: ttyUSB0, ttyUSB1, and ttyUSB2:
Install the serial port software minicom:
sudo apt install minicom
Then open the AT command serial port using minicom:
sudo minicom -D /dev/ttyUSB0
(Note: The choice of which serial port to use should be based on the ability to input and run AT commands after entering this port, ensuring that the display is not garbled and the results do not jump erratically.)
The first time you enter an AT command, there may be no echo. If you then input the command at
and press Enter, and it returns "OK," it indicates that everything is working properly. If you need to check the echo, please type the command: ate1
, then press Enter. After that, you can continue to type other commands and press Enter to see the results.
5.2 Common AT commands
1. Check if the SIM card is detected:
at+cpin?
Return ready to indicate the card has been recognized, if return error, you need to check the hardware.
2. Check antenna signal quality:
at+csq
eturn values between 26 and 31 indicate a good signal, with 31 representing a full signal strength; return values between 20 and 25 indicate a barely acceptable signal; return values below 20 indicate a poor signal or that the antenna might not be connected.
3. Check network registration status:
at+cops?
Normally, it should return the network supporter's code: 7, where 7 represents 4G.
Note: The above command at+csq
should not include a question mark, while the other two commands require a question mark.
4. View the SIM card's IMEI code:
at+cgsn
5. Reset 4G module (Sometimes, if you reinsert the SIM card, hot swapping may not work; in such cases, you can use this reset command to reset the module.):
at+reset
6. Disable radio frequency:
at+cfun=0
Enable radio frequency:
at+cfun=1
The two commands mentioned above can be used in pairs to allow the module to re-register with the network without restarting the 4G module.
7. APN settings:
The SIM card of a regular mobile phone can be used directly without any configuration. However, some IoT cards require APN settings to function properly, and the APN parameters are usually provided by the carrier.
If you need the operation methods for other AT commands, please refer to the AT command manual provided with the 4G module (the operation commands may vary depending on the manufacturer).
5.3 Modify the IP address of the 4G module
如果出厂的4G IP地址和用户使用的IP地址有冲突,或有修改IP地址的需求,可按照下列步骤进行修改:
If the default 4G IP address assigned at the factory conflicts with the IP address being used by the user, or if there is a need to modify the IP address, you can change the 4G module's IP.
1. CAT4 4G:
Execute the AT command:
AT+ROUTEIP=<newip>
Note: only addresses in the format of 192.168.x.1 are supported. If you set AT+ROUTEIP=192.168.3.1
, the final IP address obtained will be 192.168.3.100. After making the changes, you need to power off and restart the OS.
Query current IP: AT+ROUTEIP?
, it returns two values, the first one is the old IP, and the second one is the new IP.
Test command: AT+ROUTEIP=?
2. Qualcomm 4G, ZTE CAT4 4G:
Set the 4G module's IP to directly obtain a public IP. Please execute the AT command:
Set the IP to public: AT+GTIPPASS=1
Set the IP to private: AT+GTIPPASS=0
Check whether the current IP is a public or private IP: AT+GTIPPASS?
After modifying the IP, a power cycle reboot is required for the changes to take effect.
3. We are not know how to modify the IP address of EC20, If needed, users are required to research it themselves.
5.4 GPS test
5.4.1 Qualcomm 4G-GPS
To use the GPS function of Qualcomm 4G, you need to connect a GPS passive antenna and ensure that the GPS antenna is extended outdoors. GPS is operated via AT commands.
Follow the steps in section 5.1 to enable the ttyUSB serial port.
Run minicom and open the ttyUSB0 serial port.
sudo minicom -D /dev/ttyUSB0
And execute:
at+gtgpsepo=1
//Enable AGPS
at+gtgpspower=1
//Enable GPS
Please wait a moment for the positioning to succeed, then execute:
at+gtgps?
//View NMEA messages
Then you can see the GPS information output:
5.4.2 Quectel EC20-GPS voice lite version
5.4.2.1 Operation of GPS
To use the GPS function of EC20, you need to connect a GPS active antenna and ensure that the GPS antenna is extended outdoors. GPS is operated via AT commands.
Open ttyUSB3 serial port by minicom:
sudo minicom -D /dev/ttyUSB3
and execute:
AT+QGPS=1
Open ttyUSB1 serial port by minicom, and you can obtain GPS information:
sudo minicom -D /dev/ttyUSB1
If you find the raw GPS data in minicom not very intuitive, we can install gpsd to extract the GPS information:
sudo apt-get install gpsd gpsd-clients
Then configure the gpsd software:
sudo gpsd /dev/ttyUSB1 -N -D 9 -F /var/run/gpsd.sock -S 3333
Note: 3333 is the listening port, which can be customized as needed.
Do not close the configuration terminal window, instead, open a new terminal window and execute:
cgps -s localhost:3333
From the output interface, information such as time, latitude and longitude, speed, and altitude can be seen.
5.4.2.2 Send SMS
Sending text messages involves using AT commands. Here, we will introduce the process of sending SMS using English characters.
Follow the steps in section 5.1 to enable the ttyUSB serial port. Then execute sudo minicom -s
, select "Serial port setup":
Press A and F to modify the serial port number and flow control as shown in the figure below:
After making the modifications, press Enter to return to the previous menu, and select "Exit" to quit:
Execute the following AT commands in sequence:
AT+CMGF=1
//Set the SMS characters to English
AT+CMGS="13xxxxxxxxx"
//Set the number to receive SMS messages
After pressing Enter, input the SMS content after the ">", then press Ctrl+Z to send. A successful send will display "+CMGS 14":
5.5 Some knowledge about network policies
If you need to learn about some network strategy knowledge, you can refer to the following link:
How to set network adapter priority
Using udhcpc to specify DNS servers
VI. Work with OpenWrt
我们测试用的OpenWrt系统版本为:openwrt-bcm27xx-bcm2712-rpi-5-squashfs-sysupgrade-linux-6.1.100-20240805.img.gz
以高通4G模组为例,OpenWrt系统下可配置为一进一出的交换机模式,即4G可作为WAN口,树莓派5自身的网口配置为LAN口,用于连接PC。
6.1 登录操作界面
将树莓派5连接至PC网口,启动系统,在Windows设置中找到网络和Internet,在以太网中打开连接的网络查看默认网关的IP地址,这个地址就是OpenWrt系统的后台配置页面地址,如图所示,本文测试的地址为192.168.198.1:
然后打开网页浏览器输入192.168.198.1进入OpenWrt系统。默认用户名为root
,默认密码为password
。
登录后进入“系统 - TTYD终端”,使用用户名为root
、密码为password
进行登录:
输入ifconfig -a
,可以看到有标识为usb0的网卡,即为高通4G模组:
若是国产CAT4或ZTE CAT4,系统识别成eth1,若是EC20也是识别成USB0,到时设置接口时,把usb0改成eth1即可。
6.2 设置4G为WAN口
进入OpenWrt系统后,然后进入“网络 - 接口”,点击“添加新接口”:
新接口的设置如下图,其中”usb0“即为4G模块:
然后点击”提交“。
在”防火墙设置“中,区域选择”wan“,然后点击”保存&应用“:
稍等片刻,我们在”网络 - 接口“中就能看到WAN口已经通过4G模块获得了IP:
此时我们在“系统 - TTYD终端”中,执行ifconfig -a
,就能看到usb0已成功获取IP地址,ping公网地址也能成功,说明此时可以通过4G模块上网:
同时我们可以在与树莓派相连的PC的网卡连接中,看到以太网的连接状态是Internet,表示此时PC也可以通过这个4G模组上网:
在PC端打开https://www.speedtest.cn/进行测速,此时流量走的是4G模块,测试结果如下:
注意:4G网络测速受网络信号和测试方法影响,速度请以实际为准。
联系我们
电话:13957118045
如本页面有任何疏漏、错误或者侵权,请通过上述途径联系我们,谢谢!
Copyright 2004-2025 野芯科技