飞凌嵌入式5G智能网关功能测试第二章-WIFI功能测试

原文链接:https://www.forlinx.com/article_view_647.html

本文以飞凌嵌入式FCU2303(5G智能网关3.0)为基础讲解,本节主要介绍5G智能网关WIFI功能的测试。关于FCU2303(5G智能网关3.0)如果想将4G/5G模块的流量通过以太网或者wifi AP模式分享出去的方式在《5G智能网关功能测试第一章4G/5G 上网测试》中已经有所设计,此章节就不在赘述。

一、FCU2303(5G智能网关3.0)WiFi测试

5G智能网关WiFi天线在外壳上的标识为:

1、板载WiFi 测试

FCU2303(5G智能网关3.0)上可以通过m.2Type2230接口,即E KEY标准接口默认外接INTEL 3168NGW模块。

系统上电前将模块插入底板相应卡槽,上电后启动linux后,通过lspci可以看到对应设备枚举成功。

 
  1. root@localhost:~# lspci

  2. 0000:00:00.0 PCI bridge: Freescale Semiconductor Inc Device 81c0 (rev 10)

  3. 0001:00:00.0 PCI bridge: Freescale Semiconductor Inc Device 81c0 (rev 10)

  4. 0001:01:00.0 Network controller: Intel Corporation Device 24fb (rev 10)

  5. 0002:00:00.0 PCI bridge: Freescale Semiconductor Inc Device 81c0 (rev 10)

2、配置WiFi上网

输入ifconfig wlP1p1s0命令查看WiFi网络节点:

 
  1. root@localhost:~# ifconfig wlP1p1s0

  2. wlP1p1s0: flags=4098<BROADCAST,MULTICAST> mtu 1500

  3. ether d8:3b:bf:b9:dd:27 txqueuelen 1000 (Ethernet)

  4. RX packets 0 bytes 0 (0.0 B)

  5. RX errors 0 dropped 0 overruns 0 frame 0

  6. TX packets 0 bytes 0 (0.0 B)

  7. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Ubuntu18 中 wifi 的名称不再是wlan0类似的命名方式,而是采用固件版本的形式,如上所示INTEL 3168NGW的名称为 wlP1p1s0。

注意:在FCU2303(5G智能网关3.0)中,WiFi模块已经配置成AP热点功能并加入网桥br0中,Wifi热点名称为wifi_test,密码为12345678,Wifi热点的配置文件为:

 
  1. root@localhost:~# cat /etc/hostapd/hostapd.conf

  2. interface=wlP1p1s0

  3. driver=nl80211

  4. ssid=wifi_test

  5. channel=9

  6. hw_mode=g

  7. macaddr_acl=0

  8. ignore_broadcast_ssid=0

  9. auth_algs=1

  10. wpa=3

  11. wpa_passphrase=12345678

  12. wpa_key_mgmt=WPA-PSK

  13. wpa_pairwise=TKIP

  14. rsn_pairwise=CCMP

如果客户想关闭掉WiFi模块的AP热点功能,用作STA模式,并将WiFi模块从网桥中去除,可以执行以下命令:

 
  1. root@localhost:~# rm /etc/systemd/system/multi-user.target.wants/hostapd.service

  2. root@localhost:~# rm /etc/systemd/network/wlan0.network

二、STA模式测试

1、使用简易脚本测试

为了方便客户能够更快速验证功能,我们提供了wifi连接的脚本,首先查看wifi_connect.sh的使用说明,如下表:

参数 说明
-s 准备连接的WIFI的名称
-p 准备连接的WIFI的密码,如果没有加密请使用-p NONE
-a 是否随开机自动启动,如果是则为ON,如果不是则为OFF,如果没有此项则保持原有设置

举例如下,连接 WIFI 的名称为 resona 密码为 23456789 的 WIFI:

 
  1. root@localhost:~# /root/Net_Tools/wifi_connect.sh -s resona -p 23456789

  2. Begain Wireless connect ...

  3. -----------------------

  4. SSID: resona

  5. PASW: 23456789

  6. -----------------------

  7. Wireless point is wlP1p1s0

  8. Wireless status is DISCONNECTED

  9. Wireless status is SCANNING

  10. Wireless status is COMPLETED

  11. -----------------------

  12. Wireless connect status

  13. bssid=2a:9a:7d:5f:4e:bb

  14. freq=2462

  15. ssid=resona

  16. id=0

  17. mode=station

  18. pairwise_cipher=CCMP

  19. group_cipher=CCMP

  20. key_mgmt=WPA2-PSK

  21. wpa_state=COMPLETED

  22. address=28:7f:cf:ca:89:9c

  23. uuid=2d6ba737-00d3-55c6-ab0b-b10df8ef1d1d

  24. -----------------------

  25. Wireless connect done !!!

  26. Auto start setting not change

此步完成以后则Wifi连接成功

2、使用命令逐步操作测试:

下面的方法为使用命令连接wifi的详细方法,供客户后期开发程序使用

首先使用 wifi_wpa.sh 脚本生成 wpa_supplicant 配置文件,首先查看wifi_wpa.sh的使用说明,如下表:

参数 说明
-s 准备连接的WIFI的名称
-p 准备连接的WIFI的密码,如果没有加密请使用-p NONE

举例如下,连接 WIFI 的名称为 resona 密码为 23456789 的 WIFI:

 
  1. root@localhost:~# /root/Net_Tools/wifi_wpa.sh -s resona -p 23456789

  2. ssid resona

  3. pasw 23456789

生成的配置文件为:/etc/wpa_supplicant.conf

 
  1. root@localhost:~# cat /etc/wpa_supplicant.conf

  2. #PSK/TKIP

  3. ctrl_interface=/var/run/wpa_supplicant

  4. p2p_disabled=1

  5. network={

  6. ssid="resona"

  7. scan_ssid=1

  8. psk="23456789"

  9. key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE

  10. group=CCMP TKIP WEP104 WEP40

  11. }

连接测试:

 
  1. root@localhost:~# wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlP1p1s0 &

  2. [1] 5173

  3. Successfully initialized wpa_supplicant

查看连接状态

 
  1. root@localhost:~# wpa_cli status -i wlP1p1s0

  2. bssid=b6:24:1e:e8:9b:82

  3. freq=2462

  4. ssid=resona

  5. id=0

  6. mode=station

  7. pairwise_cipher=CCMP

  8. group_cipher=CCMP

  9. key_mgmt=WPA2-PSK

  10. wpa_state=COMPLETED

  11. address=d8:3b:bf:b9:dd:27

  12. uuid=ada8b469-9fb8-5e6d-890a-daf96422b26c

获取IP地址:

root@localhost:~# dhclient -i wlP1p1s0

测试WiFi

测试WiFi,ping 域名或者IP。

 
  1. root@localhost:~# dhclient -i wlP1p1s0

  2. root@localhost:~# ping www.forlinx.com -c 3 -I wlP1p1s0

  3. PING www.a.shifen.com (61.135.169.125) from 192.168.43.143 wlP1p1s0: 56(84) bytes of data.

  4. 64 bytes from 61.135.169.125 (61.135.169.125): icmp_seq=1 ttl=53 time=39.2 ms

  5. 64 bytes from 61.135.169.125 (61.135.169.125): icmp_seq=2 ttl=53 time=58.2 ms

  6. 64 bytes from 61.135.169.125 (61.135.169.125): icmp_seq=3 ttl=53 time=48.9 ms

  7. --- www.a.shifen.com ping statistics ---

  8. 3 packets transmitted, 3 received, 0% packet loss, time 2003ms

  9. rtt min/avg/max/mdev = 39.216/48.822/58.282/7.784 ms

5G智能网关功能测试第二章-WIFI功能测试

猜你喜欢

转载自blog.csdn.net/key_qt1/article/details/113946370