0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
会员中心
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

开发板开发笔记——网络管理的详细步骤说明

米尔MYIR 来源:米尔MYIR 作者:米尔MYIR 2022-03-04 10:50 次阅读

1.概述

systemd-networkd 是一个管理网络服务程序,可以用来管理以太网,WIFI,网桥,EC20 等模块的网络优先级,以及连接情况。配合 systemd-resolved 服务一起使用。

本章主要目的是学习以太网,wifi,EC20 模块同时管理,并按指定优先级收发数据。

2.硬件资源

 MYD-YA15XC-T 开发板

 WIFI 天线

USB 转接板

 EC20 模块

 网线

 路由器

3. 软件资源

Linux kernel 5.4.31

 systemd-networkd

 systemd-resolved

4.环境准备

将 MYD-YA15XC-T 烧入镜像,wifi 天线连接 WIFI, EC20 模块接入 USB 口,接入网线,路由器配置 wifi 热点,并连接外网。

5.操作步骤

5.1.检查环境

1) 检查 systemd-networkd 运行状态。

root@myir:~# systemctl status systemd-networkd

[[0;1;32m●[[0m systemd-networkd.service - Network Service

Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled; vend

or preset:

Active: active (running)[[0m since Fri 2020-04-10 18:39:40 UTC; 40min ago

2) 检查 systemd-resolved 运行状态。

root@myir:~# systemctl status systemd-resolved

systemd-resolved.service - Network Name Resolution

Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor

preset: enabled):40:02 myir systemd-networkd[205]: usb0: Configured

Active: active (running)[[0m since Fri 2020-04-10 18:39:41 UTC; 42min ago

Active: active(running) 正在运行

3) 查看 DNS 配置文件

root@myir:~# ls -l /etc/resolv.conf

lrwxrwxrwx 1 root root 24 Mar 9 2018 /etc/resolv.conf -> /etc/resolv-conf.system

d

root@myir:~# ls -l /sbin/resolvconf

lrwxrwxrwx 1 root root 21 Mar 9 2018 /sbin/resolvconf -> ../usr/bin/resolvectl

root@myir:~# ls -l /usr/bin/resolvectl -rwxr-xr-x 1 root root 79316 Mar 9 2018 /usr/bin/resolvectl

resolv.conf 是 resolv-conf.systemd 的软连接

/sbin/resolvconf 是/usr/bin/resolvectl 软连接

4) 查看网络管理信息

root@myir:~# networkctl

IDX LINK TYPE OPERATIONAL SETUP

1 lo loopback carrier unmanaged

2 can0 n/a off unmanaged

3 eth0 ether routable configured

4 wlan0 wlan off unmanaged

5 usb0 gadget no-carrier configured

5 links listed. lo 本地回环 没有在 systemd 上管理

eth0 以太网 已经在 systemd 上管理

wlan0 wifi 没有在 systemd 上管理

注意:如果是开发板是 STM32MP151 系列处理器则没有 can 网络。

5.2 检查 xx-xxx.network

Systemd-networkd 的设备写法为 xx-xxxx.network。 必须以 network 结尾,前面遍历会以字典顺序执行。 可以将设备配置文件放置这几个目录 /etc/systemd/network/ ,/run/systemd/network/ , /lib/systemd/network/. 优先级为 /etc/ > /run/ > /lib/ 。在 5.1 中已经知道以太网被管理,这里直接从它的配置文件入手。 新建文件

/lib/systemd/network/50-wired.network

[Match]

Name=eth*

[Network]

DHCP=ipv4

[DHCP]

RouteMetric=15

CriticalConnection=true

Name=eth* 所有 eth 开头设备适配下面方案

 HDCP=ipv4 自动获取 IP

 RouteMetric 跃点数 15

跃点数 ip route 可以看到如下信息:

root@myir:/etc/ppp/peers# ip route

default via 192.168.30.1 dev eth0 proto dhcp src 192.168.30.103 metric 15

192.168.7.0/24 dev usb0 proto kernel scope link src 192.168.7.2 linkdown

192.168.30.0/24 dev eth0 proto kernel scope link src 192.168.30.103

192.168.30.1 dev eth0 proto dhcp scope link src 192.168.30.103 metric 15

Metric 15 路由跃点数 15

注:跃点数能够反映跃点的数量、路径的速度、路径可靠性、路径吞吐量以及管理属性,Metric 的值越小,优先级越高。

5.3 开启 wifi 并检查网络现象

1) 使用 wpa_supplicant 命令连接 wifi。

root@myir:~# ifconfig wlan0 up

root@myir:~# wpa_passphrase SSID passwd >> /etc/wpa_supplicant.conf

root@myir:/# wpa_supplicant -B -iwlan0 -c /etc/wpa_supplicant.conf

Successfully initialized wpa_supplicant

root@myir:/# ls[ 8972.189374] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link b

ecomes ready

root@myir:/# udhcpc -i wlan0

udhcpc: started, v1.31.1

udhcpc: sending discover

udhcpc: sending discover

udhcpc: sending select for 192.168.43.185

udhcpc: lease of 192.168.43.185 obtained, lease time 3600

/etc/udhcpc.d/50default: Adding DNS 192.168.43.1

2) 查看 ip address 情况

root@myir:/# ip address

1: lo: mtu 65536 qdisc noqueue state UNKNOWN gr,up,lower_up>

oup default qlen 1000

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

inet 127.0.0.1/8 scope host lo

valid_lft forever preferred_lft forever

inet6 ::1/128 scope host

valid_lft forever preferred_lft forever

2: can0: mtu 16 qdisc noop state DOWN group default qlen 10,echo>

link/can

3: eth0: mtu 1500 qdisc mq state UP g,multicast,up,lower_up>

roup default qlen 1000

link/ether e2:2d:77:f3:19:23 brd ff:ff:ff:ff:ff:ff

inet 192.168.30.102/24 brd 192.168.30.255 scope global dynamic eth0

valid_lft 7194sec preferred_lft 7194sec

inet6 fe80::e02d:77ff:fef3:1923/64 scope link

valid_lft forever preferred_lft forever

4: wlan0: mtu 1500 qdisc fq_codel stat,multicast,up,lower_up>

e UP group default qlen 1000

link/ether b0:02:47:59:f5:e5 brd ff:ff:ff:ff:ff:ff

inet 192.168.43.185/24 brd 192.168.43.255 scope global wlan0

valid_lft forever preferred_lft forever

inet6 2408:84f3:2c41:7bb:b202:47ff:fe59:f5e5/64 scope global dynamic mngtmp

addr

valid_lft 3388sec preferred_lft 3388sec

inet6 fe80::b202:47ff:fe59:f5e5/64 scope link

valid_lft forever preferred_lft forever

5: usb0: mtu 1500 qdisc fq_codel sta,broadcast,multicast,up>

te DOWN group default qlen 1000

link/ether d6:b0:42:8d:a4:08 brd ff:ff:ff:ff:ff:ff

inet 192.168.7.2/24 brd 192.168.7.255 scope global usb0

valid_lft forever preferred_lft forever

eth0 ip 192.168.30.102

wlan0 ip 192.168.43.185

3) 再次查看 ip route 情况。

root@myir:/etc/ppp/peers# ip route

default via 192.168.30.1 dev eth0 proto dhcp src 192.168.30.103 metric 15

192.168.7.0/24 dev usb0 proto kernel scope link src 192.168.7.2 linkdown

192.168.30.0/24 dev eth0 proto kernel scope link src 192.168.30.103

192.168.30.1 dev eth0 proto dhcp scope link src 192.168.30.103 metric 15

192.168.43.0/24 dev wlan0 proto kernel scope link src 192.168.43.185

4) 查看 networkctl 情况。

root@myir:~# networkctl

IDXLINK TYPE OPERATIONAL SETUP

1 lo loopback carrier unmanaged

2 can0 can off unmanaged

3 eth0 ether routable configured

4 wlan0 wlan routable unmanaged

5 usb0 gadget no-carrier configuring

5 links listed. wlan 已经开启,但是没有被管理

5) 再次查看路由情况。

root@myir:/# cat /etc/resolv.conf

# This file is managed by man:systemd-resolved(8). Do not edit. #

# This is a dynamic resolv.conf file for connecting local clients directly to

# all known uplink DNS servers. This file lists all configured search domains. #

# Third party programs must not access this file directly, but only through the

# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way, # replace this symlink by a static file or a different symlink. #

# See man:systemd-resolved.service(8) for details about the supported modes of

# operation for /etc/resolv.conf. nameserver 192.168.1.1

nameserver 192.168.43.1

 192.168.43.1 为 wlan0 新增

6) 根据以上情况,可以得出,访问外网时,只有 eth0 可以工作,wlan0 无法工作。

root@myir:~# ping www.baidu.com -I eth0

PING www.a.shifen.com (14.215.177.38) from 192.168.30.103 eth0: 56(84) bytes of

data. 64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=1 ttl=55 time=7.68 ms

64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=2 ttl=55 time=6.82 ms

64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=3 ttl=55 time=7.15 ms

64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=4 ttl=55 time=7.09 ms

64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=5 ttl=55 time=7.13 ms

^C

--- www.a.shifen.com ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4005ms

rtt min/avg/max/mdev = 6.819/7.174/7.677/0.278 ms

 wlan0 无法连接外网。

root@myir:~# ping www.baidu.com -I wlan0

PING www.a.shifen.com (14.215.177.38) from 192.168.43.185 wlan0: 56(84) bytes o

f data.  测试拔掉网线后情况。

root@myir:~# ip route

192.168.7.0/24 dev usb0 proto kernel scope link src 192.168.7.2 linkdown

192.168.43.0/24 dev wlan0 proto kernel scope link src 192.168.43.185

root@myir:~# networkctl

IDX LINK TYPE OPERATIONAL SETUP

1 lo loopback carrier unmanaged

2 can0 can off unmanaged

3 eth0 ether no-carrier configured

4 wlan0 wlan routable unmanaged

5 usb0 gadget no-carrier configuring

5 links listed. root@myir:~# cat /etc/resolv.conf

# This file is managed by man:systemd-resolved(8). Do not edit. #

# This is a dynamic resolv.conf file for connecting local clients directly to

# all known uplink DNS servers. This file lists all configured search domains. #

# Third party programs must not access this file directly, but only through the

# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way, # replace this symlink by a static file or a different symlink. #

# See man:systemd-resolved.service(8) for details about the supported modes of

# operation for /etc/resolv.conf. nameserver 192.168.43.1

7) 根据以上的现象 unmanaged 与没有路由表。还是无法使用 wlan0 接口连通外网。

root@myir:~# ping www.baidu.com -I wlan0

PING www.a.shifen.com (163.177.151.110) from 192.168.43.185 wlan0: 56(84) byte

s of data. ^C

--- www.a.shifen.com ping statistics --- 5 packets transmitted, 0 received, 100% packet loss, time 4177ms

 但当使用手动给 wlan0 增加一条路由表后如下。

root@myir:~# ip route add default via 192.168.43.1 dev wlan0

root@myir:~# ip route

default via 192.168.43.1 dev wlan0

192.168.7.0/24 dev usb0 proto kernel scope link src 192.168.7.2 linkdown

192.168.43.0/24 dev wlan0 proto kernel scope link src 192.168.43.185

 此时 IP,路由,DNS 都有,那么就可以 ping 通外网

root@myir:~# ping www.baidu.com -I wlan0

PING www.a.shifen.com (163.177.151.109) from 192.168.43.185 wlan0: 56(84) byte

s of data. 64 bytes from 163.177.151.109 (163.177.151.109): icmp_seq=1 ttl=53 time=38.0 m

s

64 bytes from 163.177.151.109 (163.177.151.109): icmp_seq=2 ttl=53 time=127 m

s

^C

--- www.a.shifen.com ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4005ms

rtt min/avg/max/mdev = 38.038/78.559/126.632/34.542 ms

所以到这里可以得到即使 wifi 联通还无法连通外网的原因,是需要对应的路由表。分析了网络联通的过程,那就可以使用 systemd-networkd 来进行多网络管理。

5.4 systemd-networkd 增加 wlan0 管理

1) 在 /lib/systemd/network/中增加 79-wlan0.network 文件,并添加以下内容。

[Match]

Name=wlan0

[Network]

DHCP=yes

[DHCP]

RouteMetric=20

RouteMetric 20 跃点数 20 (小于 eth0 的 15)

 重启 systemd-networkd 服务

root@myir:# systemctl restart systemd-networkd

 查看 networkctl 状态

root@myir:/lib/systemd/network# networkctl

IDX LINK TYPE OPERATIONAL SETUP

1 lo loopback carrier configured

2 can0 can off initialized

3 eth0 ether routable configured

4 wlan0 wlan routable configured

5 usb0 gadget no-carrier configuring

5 links listed. wlan0 现在变成 configured

接下来,重启下系统,可以观察到一个现象,就是 wifi 会自动打开,但是不会连接,那是因为没有 wpa_supplicant 服务,需要手动开启。这样才会将要连接 wifi 的SSID,PASSWD 和配置信息放置在/etc/wpa_supplicant.conf

手动开启 wpa_supplicant 服务

root@myir:~# wpa_supplicant -B -iwlan0 -c /etc/wpa_supplicant.conf

ip route 信息

root@myir:~# ip route

default via 192.168.30.1 dev eth0 proto dhcp src 192.168.30.103 metric 15

default via 192.168.43.1 dev wlan0 proto dhcp src 192.168.43.186 metric 20

192.168.7.0/24 dev usb0 proto kernel scope link src 192.168.7.2 linkdown

192.168.30.0/24 dev eth0 proto kernel scope link src 192.168.30.103

192.168.30.1 dev eth0 proto dhcp scope link src 192.168.30.103 metric 15

192.168.43.0/24 dev wlan0 proto kernel scope link src 192.168.43.186

192.168.43.1 dev wlan0 proto dhcp scope link src 192.168.43.186 metric 20

 这里可以看到 2 个 default,前面一个是 eth0 跃点数 15,后面 wlan0,跃点数 20。

此时就是以太网优先,如果以太网断开,就走 WIFI 路由。测试 ping 百度不指定网

卡,中途拔掉以太网。

root@myir:~# ping www.baidu.com

PING www.a.shifen.com (163.177.151.110) 56(84) bytes of data. 64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=1 ttl=52 time=9.88 m

s

64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=2 ttl=53 time=188 m

s

64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=3 ttl=52 time=9.45 m

s

64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=4 ttl=53 time=164 m

s

64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=5 ttl=52 time=8.71 m

s

[ 190.316708] stm32-dwmac 5800a000.ethernet eth0: Link is Down

64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=10 ttl=53 time=73.4

ms

64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=11 ttl=53 time=71.6

ms

64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=12 ttl=53 time=130

ms

64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=13 ttl=53 time=68.8

ms

[ 190.316708] stm32-dwmac 5800a000.ethernet eth0: Link is Down 拔掉网线

打印信息

可以看到以太网,wifi 同时连接时,网络不会因为以太网中断而停止。这里还有一个点,到底 ping 的时候走那个网卡,这里直接说明,会走 ip route 最前面的 default 路由,由于 eth0 metric = 15 ,wifi metric=20,所以连接顺序无论怎么接,都是以太网在前。

5.5 wpa_supplicant 自动启动连接 wifi

上面章节虽然说明了 优先级情况,但是 wifi 需要手动启动,无法自动连接,这里介绍如何开机启动 wpa_supplicant。

前面章节有连接 wifi 时需要执行 wpa_supplicant 命令。

wpa_supplicant -B -iwlan0 -c /etc/wpa_supplicant.conf

 Wpa_supplicant 对应命令

 -B 后台运行此程序

 -i wlan0 指定网卡名称

 -c /etc/wpa_supplicant.conf 指定配置文件

其中/etc/wpa_supplicnat.conf 是需要写入 SSID 与 passwd 的脚本

查看下使用 wpa_supplicant 服务的相关服务

root@myir:~# ls -l /lib/systemd/system/wpa_supplicant*

-rw-r--r-- 1 root root 453 Mar 9 2018 /lib/systemd/system/wpa_supplicant-nl802

11@.service

-rw-r--r-- 1 root root 447 Mar 9 2018 /lib/systemd/system/wpa_supplicant-wired

@.service

-rw-r--r-- 1 root root 245 Mar 9 2018 /lib/systemd/system/wpa_supplicant.servic

e

-rw-r--r-- 1 root root 415 Mar 9 2018 /lib/systemd/system/wpa_supplicant@.ser

vice

这里的 wpa_supplicnat@.service 是一个通配服务,试下执行命令

root@myir:~# systemctl enable wpa_supplicant@wlan0.service

Created symlink /etc/systemd/system/multi-user.target.wants/wpa_supplicant@wl

an0.service ->
/lib/systemd/system/wpa_supplicant@.service. 可以看到建立了一个开机启动服务的软连接到/etc/systemd/system/multi- user.target.wants/wpa_supplicant@wlan0.service

查看下自启动软连接信息。

root@myir:~# cat /etc/systemd/system/multi-user.target.wants/wpa_supplicant

@wlan0.service

[Unit]

Description=WPA supplicant daemon (interface-specific version)

Requires=sys-subsystem-net-devices-%i.device

After=sys-subsystem-net-devices-%i.device

Before=network.target

Wants=network.target

# NetworkManager users will probably want the dbus version instead. [Service]

Type=simple

ExecStart=/usr/sbin/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-%I.co

nf -i%I

[Install]

WantedBy=multi-user.target

ExecStart=/usr/sbin/wpa_supplicant
-c/etc/wpa_supplicant/wpa_supplicant-%I.conf -i%I 这里我们将上面的生成的文件放置在/etc/wpa_supplicant/wpa_supplicant- wlan0.conf 不就可以自动启动。 注意:MYD-YA15XC-T 的 wpa_supplicant.conf 在目录/etc 下。需要按照自启动的配置目录,将 wpa_supplicant.conf 改成 wpa_supplicant-wlan0.conf 并拷贝到新建的目录下

/etc/wpa_supplicant. root@myir:/etc/wpa_supplicant# ls

wpa_supplicant-wlan0.conf

重启后可自动连接 wifi。

5.6 4G 模块配置

从以上章节对 wifi 的配置来看,可以很快添加 4G 模块的网络,步骤如下:

/lib/systemd/network/ 下添加 EC20 模块的设备,设置成自动获取 IP, metric。

手动/自动连接模块。

MYD-YA15XC-T 没有直接的 4G 模块的接口,需要通过 USB 转 miniPCIe 的转接板连接 4G 模块。米尔默认移植的 4G 模块为移远 EC20;运营商测试为移动。

1) 启动自动拨号脚本 quectel-CM &

root@myir:/etc/ppp# ./quectel-CM &

root@myir:/etc/ppp# [02-07_15:53:06:002] Quectel_QConnectManager_Linux_V1. 5.5

[02-07_15:53:06:004] Find /sys/bus/usb/devices/2-1 idVendor=0x2c7c idProduct=

0x125

[02-07_15:53:06:005] Auto find qmichannel = /dev/cdc-wdm0

[02-07_15:53:06:005] Auto find usbnet_adapter = wwan0

[02-07_15:53:06:005] Modem works in QMI mode

[02-07_15:53:06:043] cdc_wdm_fd = 7

[02-07_15:53:06:144] Get clientWDS = 18

[02-07_15:53:06:178] Get clientDMS = 1

[02-07_15:53:06:210] Get clientNAS = 3

[02-07_15:53:06:241] Get clientUIM = 1

[02-07_15:53:06:275] Get clientWDA = 1

[02-07_15:53:06:306] requestBaseBandVersion EC20CEFDKGR06A04M2G

[02-07_15:53:06:434] requestGetSIMStatus SIMStatus: SIM_READY

[02-07_15:53:06:466] requestGetProfile[1] ctnet///0

[02-07_15:53:06:498] requestRegistrationState2 MCC: 460, MNC: 0, PS: Attached, DataCap: LTE

[02-07_15:53:06:529] requestQueryDataCall IPv4ConnectionStatus: DISCONNECTE

D

[02-07_15:53:06:529] ifconfig wwan0 down

[02-07_15:53:06:547] ifconfig wwan0 0.0.0.0

[02-07_15:53:06:594] requestSetupDataCall WdsConnectionIPv4Handle: 0xe18a5fc

0

[02-07_15:53:06:722] ifconfig wwan0 up

[02-07_15:53:06:755] busybox udhcpc -f -n -q -t 5 -i wwan0

udhcpc: started, v1.31.1

udhcpc: sending discover

udhcpc: sending select for 10.38.63.3

udhcpc: lease of 10.38.63.3 obtained, lease time 7200

RTNETLINK answers: File exists

[02-07_15:53:07:222] /etc/udhcpc.d/50default: Adding DNS 120.196.165.7

[02-07_15:53:07:222] /etc/udhcpc.d/50default: Adding DNS 221.179.38.7

2) 查看 networkctl 状态

LINK TYPE OPERATIONALSETUP

1 lo loopback carrier configured

2 can0 can off initialized

3 eth0 ether routable configured

4 wlan0 wlan routable configured

5 usb0 gadget no-carrier configuring

6 wwan0 wwan routable configured

6 links listed. 3) 再次重启,eth0 和 wlan0 自动连接,执行 4G 的拨号脚本让 EC20 拨号成功。

查看路由表:

root@myir:/etc/ppp# ip route

default via 10.75.115.24 dev wwan0 metric 10

default via 192.168.30.1 dev eth0 proto dhcp src 192.168.30.103 metric 15

default via 192.168.43.1 dev wlan0 proto dhcp src 192.168.43.185 metric 20

10.75.115.16/28 dev wwan0 proto kernel scope link src 10.75.115.23

192.168.7.0/24 dev usb0 proto kernel scope link src 192.168.7.2

192.168.30.0/24 dev eth0 proto kernel scope link src 192.168.30.103

192.168.30.1 dev eth0 proto dhcp scope link src 192.168.30.103 metric 15

192.168.43.0/24 dev wlan0 proto kernel scope link src 192.168.43.185

192.168.43.1 dev wlan0 proto dhcp scope link src 192.168.43.185 metric 20

4) Ping 外网的同时,下列做两组测试。

 第一组,依此拔下 EC20 模块,拔下网线,关闭 wifi。

root@myir:/etc/ppp# ping www.baidu.com

PING www.a.shifen.com (163.177.151.110) 56(84) bytes of data. 64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=9 ttl=49 time=69.9 m

s

64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=13 ttl=50 time=50.2

ms

64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=14 ttl=50 time=55.2

ms

64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=15 ttl=50 time=58.4

ms

[ 360.021410] usb 2-1: USB disconnect, device number 2

[ 360.025904] option1 ttyUSB0: GSM modem (1-port) converter now disconnecte

d from ttyUSB0

[ 360.034187] option 2-1:1.0: device disconnected

[ 360.039434] option1 ttyUSB1: GSM modem (1-port) converter now disconnecte

d from ttyUSB1

[ 360.046381] option 2-1:1.1: device disconnected

[ 360.059715] option1 ttyUSB2: GSM modem (1-port) converter now disconnecte

d from ttyUSB2

[ 360.066565] option 2-1:1.2: device disconnected

[ 360.094517] option1 ttyUSB3: GSM modem (1-port) converter now disconnecte

d from ttyUSB3

[ 360.114436] option 2-1:1.3: device disconnected

[ 360.127444] qmi_wwan_q 2-1:1.4 wwan0: unregister 'qmi_wwan_q' usb-5800d00

0.usbh-ehci-1, WWAN/QMI device

[02-07_15:56:39:842] QmiWwanThread poll err/hup/inval

[02-07_15:56:39:842] poll fd = 7, events = 0x0018

[02-07_15:56:39:842] QmiWwanThread exit

[02-07_15:56:39:845] ifconfig wwan0 down

ifconfig: SIOCGIFFLAGS: No such device

[02-07_15:56:39:957] ifconfig wwan0 0.0.0.0

ifconfig: SIOCSIFADDR: No such device

[02-07_15:56:40:053] qmi_main exit

64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=17 ttl=52 time=10.0

ms

64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=18 ttl=52 time=11.8

ms

64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=19 ttl=52 time=10.7

ms

64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=20 ttl=52 time=9.87

ms

64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=28 ttl=52 time=9.82

ms

[ 373.447569] stm32-dwmac 5800a000.ethernet eth0: Link is Down

64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=30 ttl=53 time=1573

ms

64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=31 ttl=53 time=533

ms

64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=32 ttl=53 time=73.5

ms

ping: sendmsg: Network is unreachable

ping: sendmsg: Network is unreachable

ping: sendmsg: Network is unreachable

ping: sendmsg: Network is unreachable

^C

--- www.a.shifen.com ping statistics --- 39 packets transmitted, 37 received, 5.12821% packet loss, time 42301ms

rtt min/avg/max/mdev = 8.666/110.402/1572.819/261.269 ms, pipe 2

[1]+ Done ./quectel-CM

红色字体分别是拔下 4G 模块与拔下以太网的信息再断下 wifi(由于断 wifi 无消息显示),打印消息上看,网络并没有断掉。

 第二组,分别断掉 wifi, 以太网,4G 模块。

root@myir:/etc/ppp# ping www.baidu.com

PING www.a.shifen.com (183.232.231.174) 56(84) bytes of data. 64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=1 ttl=56 time=49.6 m

s

64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=21 ttl=56 time=45.7

ms

64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=22 ttl=56 time=48.8

ms

64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=23 ttl=56 time=47.8

ms

64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=24 ttl=56 time=47.7

ms

[ 248.247712] stm32-dwmac 5800a000.ethernet eth0: Link is Down

64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=25 ttl=56 time=46.6

ms

64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=29 ttl=56 time=134

ms

64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=30 ttl=56 time=394

ms

64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=31 ttl=56 time=88.2

ms

[ 255.315629] usb 2-1: USB disconnect, device number 2

[ 255.320113] option1 ttyUSB0: GSM modem (1-port) converter now disconnecte

d from ttyUSB0

[ 255.342216] option 2-1:1.0: device disconnected

[ 255.349262] option1 ttyUSB1: GSM modem (1-port) converter now disconnecte

d from ttyUSB1

[ 255.356317] option 2-1:1.1: device disconnected

[ 255.376938] option1 ttyUSB2: GSM modem (1-port) converter now disconnecte

d from ttyUSB2

[ 255.394263] option 2-1:1.2: device disconnected

[ 255.417228] option1 ttyUSB3: GSM modem (1-port) converter now disconnecte

d from ttyUSB3

[ 255.442233] option 2-1:1.3: device disconnected

[ 255.462782] qmi_wwan_q 2-1:1.4 wwan0: unregister 'qmi_wwan_q' usb-5800d00

0.usbh-ehci-1, WWAN/QMI device

[02-07_15:54:56:702] QmiWwanThread poll err/hup/inval

[02-07_15:54:56:702] poll fd = 7, events = 0x0018

[02-07_15:54:56:703] QmiWwanThread exit

[02-07_15:54:56:705] ifconfig wwan0 down

ifconfig: SIOCGIFFLAGS: No such device

[02-07_15:54:56:798] ifconfig wwan0 0.0.0.0

ifconfig: SIOCSIFADDR: No such device

[02-07_15:54:56:819] qmi_main exit

ping: sendmsg: Network is unreachable

ping: sendmsg: Network is unreachable

ping: sendmsg: Network is unreachable

ping: sendmsg: Network is unreachable

^C

--- www.a.shifen.com ping statistics --- 39 packets transmitted, 31 received, 20.5128% packet loss, time 38340ms

rtt min/avg/max/mdev = 37.010/65.549/393.764/63.096 ms

[1]+ Done ./quectel-CM

root@myir:/etc/ppp#

可以看到最后断下 4G 模块后才断掉网络。

审核编辑:符乾江

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • 网络管理
    +关注

    关注

    0

    文章

    120

    浏览量

    27673
  • 开发板
    +关注

    关注

    25

    文章

    5046

    浏览量

    97438
收藏 人收藏

    评论

    相关推荐

    全志T113-S3开发板网络通信

    前言:在使用开发板的过程中经常会使用到ssh、ftp等网络服务,这时需要使用开发板网络功能。因此新拿到的开发板要先进行
    的头像 发表于 12-26 08:32 139次阅读
    全志T113-S3<b class='flag-5'>开发板</b><b class='flag-5'>网络</b>通信

    迅为RK3588开发板Android系统开发笔记-使用ADB工具

    工具在网盘资料“iTOP-3588 开发板\\\\02_【iTOP-RK3588 开发板开发资料\\\\ 07_Android 系统开发配套资料\\\\01_ADB 工具配套资料”
    发表于 11-27 10:39

    51开发板芯片资料

    51开发板芯片资料
    发表于 09-18 09:29 1次下载

    linux开发板与树莓派的区别

    操作系统的微型计算机,主要用于教育、编程、媒体播放等领域。 硬件配置 Linux开发板:Linux开发板的硬件配置因厂商和型号而异,通常包括处理器、内存、存储、网络接口等。 树莓派:树莓派的硬件配置相对固定,包括处理器、内存、U
    的头像 发表于 08-30 15:34 962次阅读

    linux开发板如何编译curl

    在Linux开发板上编译 curl 库通常涉及到几个步骤,包括准备开发环境、下载源代码、配置编译选项以及执行编译和安装过程。以下是一个基本的指南,帮助你在Linux开发板上编译 cur
    的头像 发表于 08-30 15:33 620次阅读

    合宙LuatOS开发板使用手册——Air700EAQ

    本文详细讲解了Air700EAQ开发板的使用说明
    的头像 发表于 08-28 14:37 521次阅读
    合宙LuatOS<b class='flag-5'>开发板</b>使用手册——Air700EAQ

    EVASH Ultra EEPROM 开发板使用说明书 简介

    EVASH Ultra EEPROM 开发板使用说明书 简介 欢迎使用EVASH Ultra EEPROM开发板使用说明书。本说明书将为
    的头像 发表于 07-01 09:39 494次阅读

    米尔基于NXP iMX.93开发板的M33处理器应用开发笔记

    资源MYD-LMX9X开发板(米尔基于NXPiMX.93开发板)3.软件资源Windows7及以上版本软件:IAREmbeddedWorkbench4.板载固件调试
    的头像 发表于 06-29 08:01 1372次阅读
    米尔基于NXP iMX.93<b class='flag-5'>开发板</b>的M33处理器应用<b class='flag-5'>开发笔记</b>

    迅为国产四核RK3562开发板底板硬件接口原理说明

    迅为国产四核RK3562开发板底板硬件接口原理说明
    的头像 发表于 06-14 15:27 1611次阅读
    迅为国产四核RK3562<b class='flag-5'>开发板</b>底板硬件接口原理<b class='flag-5'>说明</b>

    fpga开发板是什么?fpga开发板有哪些?

    FPGA开发板是一种基于FPGA(现场可编程门阵列)技术的开发平台,它允许工程师通过编程来定义和配置FPGA芯片上的逻辑电路,以实现各种数字电路和逻辑功能。FPGA开发板通常包括FPGA芯片、时钟模块、电源模块、输入输出接口等组
    的头像 发表于 03-14 18:20 2021次阅读

    fpga开发板使用教程

    FPGA开发板的使用教程主要包括以下几个关键步骤
    的头像 发表于 03-14 15:50 1137次阅读

    fpga开发板与linux开发板区别

    FPGA开发板与Linux开发板是两种不同的硬件开发平台,各自具有不同的特点和应用场景。在以下的文章中,我将详细介绍FPGA开发板和Linu
    的头像 发表于 02-01 17:09 2252次阅读

    51单片机开发板的主要功能 51单片机开发板能做什么

    51单片机开发板是一种基于8051系列单片机芯片的开发板,具有丰富的功能和广泛的应用。下面将详细介绍51单片机开发板的主要功能以及能够实现的各种应用。 一、基本功能: 通用输入输出:5
    的头像 发表于 01-23 15:52 3759次阅读

    学习笔记分享|使用C库函数控制ELF 1开发板的LED

    (ELF1/ELF1S开发板及显示屏)在嵌入式Linux系统开发中,通过编程控制硬件资源是至关重要的技能之一,今天跟各位小伙伴分享一篇专注于介绍如何使用C库函数控制ELF1开发板LED的学习
    的头像 发表于 01-19 11:12 569次阅读
    学习<b class='flag-5'>笔记</b>分享|使用C库函数控制ELF 1<b class='flag-5'>开发板</b>的LED

    BQ3568开发板 RK3568鸿蒙系统主板

    BQ3568_使用说明_开发板详情
    的头像 发表于 01-10 17:06 592次阅读
    BQ3568<b class='flag-5'>开发板</b> RK3568鸿蒙系统主板