5G智能网关功能测试-4G/5G上网测试

FCU2303(5智能网关3.0)支持两种4G模块,分别为华为ME909s模块和移远EC20模块;支持两种5G模块,分别为华为MH5000-31模块和移远RM500Q-GL模块,默认支持移远RM500Q-GL模块,请根据自己选配的4G/5G模块型号进行测试。

4G、5G模块对应设备节点如下:

设备型号 节点名称

ME909s模块

wwan0

EC20模块

wwan0

华为MH5000-31模块

enx001e101f0000

移远RM500Q-GL模块

eth0

注意:因为不同通信模块对供电电平和USB协议的需求有区别,所以注意在使用的时候需要通过跳线帽在PCB板子上接不同的插针来选择电平,还需要将拨码开关拨到对应的位置选择使用的4G/5G模块,跳线和拨码开关的形状如下图所示:


4G/5G模块配备4支天线,如下图:

4G/5G模块SIM卡使用标准抽屉式 SIM卡槽,按压抽屉右边的黄色按钮可弹出抽屉,如下图:

一、 4G/5G识别判断


1、华为ME909s模块

可以在FCU2303(5G智能网关3.0)的控制台输入一下命令看华为ME909s 4G模块是否识别成功。
root@localhost:~# lsusb
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 12d1:15c1 Huawei Technologies Co., Ltd.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
使用ifconfig命令可以看到华为ME909s 4G模块产生的节点名称为wwan0

2、移远EC20模块

可以在FCU2303(5G智能网关3.0)的控制台输入一下命令看移远EC20 4G模块是否识别成功。

root@localhost:~# lsusb
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 2c7c:0125
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
使用ifconfig命令可以看到移远EC20 4G模块模块产生的节点名称为wwan0

3、华为MH5000-31模块

可以在FCU2303(5G智能网关3.0)的控制台输入一下命令看华为MH5000-31 5G模块是否识别成功。
root@localhost:~# lsusb
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 12d1:15c3 Huawei Technologies Co., Ltd.
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
使用ifconfig命令可以看到华为MH5000-31 5G模块产生的节点名称为enx001e101f0000

4、移远RM500Q-GL模块

可以在FCU2303(5G智能网关3.0)的控制台输入一下命令看移远RM500Q-GL 5G模块是否识别成功。
root@localhost:~# lsusb
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 2c7c:0800
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
使用ifconfig命令可以看到移远RM500Q-GL 5G模块模块产生的节点名称为eth0。

二、4G/5G上网测试

1、华为ME909s模块

FCU2303(5G智能网关3.0)以插入联通SIM卡测试4G上网为例,测试是否连接外网:


root@localhost:~# /root/Net_Tools/ok104x_me909s.sh
[   68.200415] cdc_ether 1-1:2.0 wwan0: kevent 12 may have been dropped
[   68.203672] cdc_ether 1-1:2.0 wwan0: kevent 11 may have been dropped
[   68.207654] cdc_ether 1-1:2.0 wwan0: kevent 11 may have been dropped
ME909s module dhcp Complite !!!
root@localhost:~# ping www.forlinx.com -I wwan0 -c 5
PING www.a.shifen.com (61.135.169.121) from 10.148.39.252 wwan0: 56(84) bytes of data.
64 bytes from 61.135.169.121: icmp_seq=1 ttl=55 time=48.1 ms
64 bytes from 61.135.169.121: icmp_seq=2 ttl=55 time=27.6 ms
64 bytes from 61.135.169.121: icmp_seq=3 ttl=55 time=46.0 ms
64 bytes from 61.135.169.121: icmp_seq=4 ttl=55 time=52.9 ms
64 bytes from 61.135.169.121: icmp_seq=5 ttl=55 time=43.9 ms
--- www.a.shifen.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4003ms
rtt min/avg/max/mdev = 27.611/43.730/52.931/8.596 ms
测试ping 飞凌,发送接收5包数据,丢包率为0,4G可上外网。如果4G模块不能连接外网,请检查4G拨号设置或SIM卡是否欠费。
查看4G拨号脚本为:
root@localhost:~# cat /root/Net_Tools/ok104x_me909s.sh
#!/bin/sh
while true
do
        if [ -c /dev/ttyUSB2 ]
        then
                sleep 4
                echo "ATE0" > /dev/ttyUSB2
                echo "AT^NDISDUP=1,1,\"cmnet\""> /dev/ttyUSB2
                ifconfig wwan0 up
                dhclient wwan0
                echo "ME909s module dhcp Complite !!!"
                exit 0
        fi
        sleep 1
        echo "waiting ttyUSB2 device ..."
done
如需测试其他网络环境,可以修改此脚本进行4G模块的拨号上网设置。

注:echo "AT^NDISDUP=1,1,\"cmnet\""> /dev/ttyUSB2 为移动APN;
echo "AT^NDISDUP=1,1,\"3gnet\""> /dev/ttyUSB2 为联通;
echo "AT^NDISDUP=1,1,\"ctnet\""> /dev/ttyUSB2 为电信。

2、移远EC20模块

FCU2303(5G智能网关3.0)以插入联通SIM卡测试4G上网为例,测试是否连接外网:
root@localhost:~# /root/Net_Tools/quectel-CM & 
[01-29_00:06:00:745] WCDMA&LTE_QConnectManager_Linux&Android_V1.1.34
[01-29_00:06:00:746] ./quectel-CM profile[1] = (null)/(null)/(null)/0, pincode = (null)
[01-29_00:06:00:747] Find /sys/bus/usb/devices/1-1 idVendor=2c7c idProduct=0125
[01-29_00:06:00:747] Find /sys/bus/usb/devices/1-1:1.4/net/wwan0
[01-29_00:06:00:747] Find usbnet_adapter = wwan0
[01-29_00:06:00:747] Find /sys/bus/usb/devices/1-1:1.4/usbmisc/cdc-wdm0
[01-29_00:06:00:747] Find qmichannel = /dev/cdc-wdm0
[01-29_00:06:00:757] cdc_wdm_fd = 7
[01-29_00:06:00:851] Get clientWDS = 2
[01-29_00:06:00:884] Get clientDMS = 1
[01-29_00:06:00:916] Get clientNAS = 3
[01-29_00:06:00:947] Get clientUIM = 1
[01-29_00:06:00:981] Get clientWDA = 1
[01-29_00:06:01:012] requestBaseBandVersion EC20CEHCR06A02M1G
[01-29_00:06:01:107] requestGetSIMStatus SIMStatus: SIM_READY
[01-29_00:06:01:140] requestGetProfile[1] 3gnet///0
[01-29_00:06:01:172] requestRegistrationState2 MCC: 460, MNC: 1, PS: Attached, DataCap: LTE
[01-29_00:06:01:204] requestQueryDataCall IPv4ConnectionStatus: DISCONNECTED
[01-29_00:06:01:267] requestRegistrationState2 MCC: 460, MNC: 1, PS: Attached, DataCap: LTE
[01-29_00:06:01:299] requestSetupDataCall WdsConnectionIPv4Handle: 0x86b43070
[01-29_00:06:01:363] requestQueryDataCall IPv4ConnectionStatus: CONNECTED
[01-29_00:06:01:395] ifconfig wwan0 up
[01-29_00:06:01:399] Fail to access /usr/share/udhcpc/default.script, errno: 2 (No such file or directory)
[01-29_00:06:01:407] busybox udhcpc -f -n -q -t 5 -i wwan0
udhcpc: started, v1.27.2
udhcpc: sending discover
udhcpc: sending select for 10.91.159.241
udhcpc: lease of 10.91.159.241 obtained, lease time 7200
拨号完成之后需要运行dhclient命令
root@localhost:~# dhclient wwan0
root@localhost:~# ping www.forlinx.com -I wwan0 -c 5
PING www.a.shifen.com (61.135.169.121) from 10.54.74.74 wwan0: 56(84) bytes of data.
64 bytes from 61.135.169.121: icmp_seq=1 ttl=55 time=25.8 ms
64 bytes from 61.135.169.121: icmp_seq=2 ttl=55 time=44.6 ms
64 bytes from 61.135.169.121: icmp_seq=3 ttl=55 time=44.1 ms
64 bytes from 61.135.169.121: icmp_seq=4 ttl=55 time=41.6 ms
64 bytes from 61.135.169.121: icmp_seq=5 ttl=55 time=40.0 ms
--- www.a.shifen.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4004ms
rtt min/avg/max/mdev = 25.814/39.267/44.605/6.931 ms

3、华为MH5000-31模块

FCU2303(5G智能网关3.0)以插入移动SIM卡测试5G上网为例,测试是否连接外网:
root@localhost:~# /root/Net_Tools/ok104x_MH5000.sh
MH5000 module dhcp Complite !!!
root@localhost:~# ping www.baidu.com -I enx001e101f0000 -c 5
PING www.a.shifen.com (39.156.66.14) from 10.109.32.164 enx001e101f0000: 56(84) bytes of data.
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=1 ttl=51 time=242 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=2 ttl=51 time=60.4 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=3 ttl=51 time=49.9 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=4 ttl=51 time=57.9 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=5 ttl=51 time=47.9 ms
--- www.a.shifen.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4004ms
rtt min/avg/max/mdev = 47.926/91.744/242.484/75.516 ms
测试ping 百度,发送接收5包数据,丢包率为0,5G可上外网。如果5G模块不能连接外网,请检查5G拨号设置或SIM卡是否欠费。

查看5G拨号脚本为:

#!/bin/sh
while true
do
        if [ -c /dev/ttyUSB1 ]
        then
                sleep 4
                echo "ATE0" > /dev/ttyUSB1
                echo "AT^NDISDUP=1,1,\"cmnet\""> /dev/ttyUSB1
                ifconfig enx001e101f0000 up
                dhclient enx001e101f0000
                echo "MH5000 module dhcp Complite !!!"
                exit 0
        fi
        sleep 1
        echo "waiting ttyUSB1 device ..."
done
如需测试其他网络环境,可以修改此脚本进行5G模块的拨号上网设置。

注:echo "AT^NDISDUP=1,1,\"cmnet\""> /dev/ttyUSB1 为移动APN;
echo "AT^NDISDUP=1,1,\"3gnet\""> /dev/ttyUSB1为联通;
echo "AT^NDISDUP=1,1,\"ctnet\""> /dev/ttyUSB1为电信。

4、移远RM500Q-GL模块

FCU2303(5G智能网关3.0)以插入移动SIM卡测试5G上网为例,测试是否连接外网:
root@localhost:~# /root/Net_Tools/quectel-CM-5G &
[1] 5117
[01-28_23:59:05:777] Quectel_QConnectManager_Linux_V1.6.0.15
[01-28_23:59:05:779] Find /sys/bus/usb/devices/2-1 idVendor=0x2c7c idProduct=0x800, bus=0x002, dev=0x002
[01-28_23:59:05:779] Auto find qmichannel = /dev/qcqmi0
[01-28_23:59:05:779] Auto find usbnet_adapter = eth0
[01-28_23:59:05:779] netcard driver = GobiNet, driver version = 22-Aug-2005
[01-28_23:59:05:779] ioctl(0x89f3, qmap_settings) failed: Operation not supported, rc=-1
[01-28_23:59:05:779] qmap_mode = 1, qmap_version = 5, qmap_size = 16384, muxid = 0x81, qmap_netcard = eth0
[01-28_23:59:05:780] Modem works in QMI mode
[01-28_23:59:05:813] Get clientWDS = 7
[01-28_23:59:05:845] Get clientDMS = 8
[01-28_23:59:05:877] Get clientNAS = 9
[01-28_23:59:05:909] Get clientUIM = 10
[01-28_23:59:05:941] requestBaseBandVersion RM500QGLAAR01A01M4G_BETA_20200330F  1  [Mar 15 2020 04:00:00]
[01-28_23:59:06:069] requestGetSIMStatus SIMStatus: SIM_READY
[01-28_23:59:06:101] requestGetProfile[1] 3GNET///0
[01-28_23:59:06:133] requestRegistrationState2 MCC: 460, MNC: 1, PS: Attached, DataCap: LTE
[01-28_23:59:06:165] requestQueryDataCall IPv4ConnectionStatus: DISCONNECTED
[01-28_23:59:06:166] ifconfig eth0 0.0.0.0
[01-28_23:59:06:171] ifconfig eth0 down
[01-28_23:59:06:229] requestSetupDataCall WdsConnectionIPv4Handle: 0x7de78490
[01-28_23:59:06:357] ifconfig eth0 up
[01-28_23:59:06:362] Fail to access /usr/share/udhcpc/default.script, errno: 2 (No such file or directory)
[01-28_23:59:06:362] busybox udhcpc -f -n -q -t 5 -i eth0
udhcpc: started, v1.27.2
udhcpc: sending discover
udhcpc: sending select for 10.154.98.28
udhcpc: lease of 10.154.98.28 obtained, lease time 7200
拨号完成之后需要运行dhclient命令
root@localhost:~# dhclient
root@localhost:~# ping www.baidu.com -I eth0 -c 5
PING www.a.shifen.com (39.156.66.14) from 10.134.255.146 eth0: 56(84) bytes of data.
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=1 ttl=51 time=27.9 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=2 ttl=51 time=25.4 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=3 ttl=51 time=27.8 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=4 ttl=51 time=26.9 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=5 ttl=51 time=27.9 ms
--- www.a.shifen.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 25.471/27.245/27.993/0.979 ms

三、流量转发

FCU2303(5G智能网关3.0)如果想将4G/5G模块的流量通过以太网或者wifi AP模式分享出去,请执行如下步骤:
设置转发: 
root@localhost:~# iptables -t nat -A POSTROUTING -o enx001e101f0000 -j MASQUERADE
使用iptables操作完转发规则之后,如果想要保存此配置等下次上电自动启动配置,可以使用以下命令:
保存iptables配置:

root@localhost:~# netfilter-persistent save
run-parts: executing /usr/share/netfilter-persistent/plugins.d/15-ip4tables save
run-parts: executing /usr/share/netfilter-persistent/plugins.d/25-ip6tables save
root@localhost:~# netfilter-persistent reload
run-parts: executing /usr/share/netfilter-persistent/plugins.d/15-ip4tables start
run-parts: executing /usr/share/netfilter-persistent/plugins.d/25-ip6tables start