博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
树莓派3链接wifi
阅读量:6293 次
发布时间:2019-06-22

本文共 6089 字,大约阅读时间需要 20 分钟。

hot3.png

查看网卡状态

我们可以使用ifconfig命令查看当前的网卡状态信息。

root@raspberrypi:~# ifconfig eth0: flags=4163
mtu 1500 inet 192.168.31.159 netmask 255.255.255.0 broadcast 192.168.31.255 inet6 fe80::a579:e25:d60e:838a prefixlen 64 scopeid 0x20
ether b8:27:eb:08:b2:02 txqueuelen 1000 (Ethernet) RX packets 42954 bytes 2101217 (2.0 MiB) RX errors 0 dropped 27 overruns 0 frame 0 TX packets 292 bytes 26175 (25.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73
mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0wlan0: flags=4099
mtu 1500 ether b8:27:eb:5d:e7:57 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

其中eth0为有线网卡,lo代表127.0.0.1即localhost,wlan0代表无线网卡。

下表对参数做一下简单解释

<>

UP 网卡已启用

BROADCAST 广播

LOOPBACK 本地访问

RUNNING 网卡正在运行

MULTICAST 多路广播

mtu MTU(Maximum Transmission Unit)最大传输单元
inet IPV4地址
netmask 网络掩码
broadcast 广播地址
inet6 IPV6地址
prefixlen 前缀长度
ether 网卡地址(MAC)
txqueuelen 传输缓区长度大小意思
RX packets bytes 接收{数据包数量 数据包大小}
RX errors dropped overruns frame 接收{错误数 丢包数 溢出数 框架}
TX packets bytes 发送{数据包数量 数据包大小}
TX errors  dropped overruns  carrier  collisions 发送{错误数 丢包数 溢出数 载体 冲突}

 

查看无线连接状态

ESSID参数为off显然还没有链接无线网络

root@raspberrypi:~# iwconfigwlan0     IEEE 802.11  ESSID:off/any            Mode:Managed  Access Point: Not-Associated   Tx-Power=31 dBm             Retry short limit:7   RTS thr:off   Fragment thr:off          Encryption key:off          Power Management:on          lo        no wireless extensions.eth0      no wireless extensions.

 

查找无线网络

列出能够搜索到的全部无线网络

root@raspberrypi:~# iwlist wlan0 scan    wlan0     Scan completed :          Cell 01 - Address: A8:57:4E:86:7B:7E                    Channel:1                    Frequency:2.412 GHz (Channel 1)                    Quality=43/70  Signal level=-67 dBm                      Encryption key:on                    ESSID:"TP-LINK_867"                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s                              9 Mb/s; 12 Mb/s; 18 Mb/s                    Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s                    Mode:Master                    Extra:tsf=0000000000000000                    Extra: Last beacon: 80ms ago                    IE: Unknown: 000B54502D4C494E4B5F383637                    IE: Unknown: 010882848B960C121824                    IE: Unknown: 030101                    IE: Unknown: 2A0100                    IE: Unknown: 32043048606C                    IE: Unknown: 2D1A6E1003FFFF000000000000000000000000000000000000000000                    IE: Unknown: 3D1601050200000000000000000000000000000000000000                    IE: IEEE 802.11i/WPA2 Version 1                        Group Cipher : CCMP                        Pairwise Ciphers (1) : CCMP                        Authentication Suites (1) : PSK                    IE: WPA Version 1                        Group Cipher : CCMP                        Pairwise Ciphers (1) : CCMP                        Authentication Suites (1) : PSK                    IE: Unknown: DD180050F2020101000003A4000027A4000042435E0062322F00                    IE: Unknown: DD05000AEB0100                    IE: Unknown: DD8E0050F204104A0001101044000102103B0001031047001000000000000010000000A8574E867B7E1021000754502D4C494E4B10230009544C2D57523834324E10240003342E3010420007312E312E312E331054000800060050F204000110110018576972656C657373204E20526F757465722057523834324E100800022288103C0001011049000600372A000120

 

配置wifi信息

root@raspberrypi:~# vim /etc/wpa_supplicant/wpa_supplicant.conf

在配置文件中增加无线wifi的配置

...network={        ssid="Xiaomi_F636"    psk="imlichao"}

 

重启系统

重启系统后我们可以看到无线网卡已经启用并连接到了wifi。

root@raspberrypi:~# ifconfig eth0: flags=4163
mtu 1500 inet 192.168.31.159 netmask 255.255.255.0 broadcast 192.168.31.255 inet6 fe80::a579:e25:d60e:838a prefixlen 64 scopeid 0x20
ether b8:27:eb:08:b2:02 txqueuelen 1000 (Ethernet) RX packets 895 bytes 48460 (47.3 KiB) RX errors 0 dropped 1 overruns 0 frame 0 TX packets 91 bytes 13742 (13.4 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73
mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0wlan0: flags=4163
mtu 1500 inet 192.168.31.134 netmask 255.255.255.0 broadcast 192.168.31.255 inet6 fe80::36eb:7046:a7fb:ddb3 prefixlen 64 scopeid 0x20
ether b8:27:eb:5d:e7:57 txqueuelen 1000 (Ethernet) RX packets 69 bytes 8121 (7.9 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 36 bytes 6014 (5.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
root@raspberrypi:~# iwconfig wlan0     IEEE 802.11  ESSID:"Xiaomi_F636"            Mode:Managed  Frequency:2.412 GHz  Access Point: 64:09:80:12:F6:37             Bit Rate=24 Mb/s   Tx-Power=31 dBm             Retry short limit:7   RTS thr:off   Fragment thr:off          Encryption key:off          Power Management:on          Link Quality=55/70  Signal level=-55 dBm            Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0          Tx excessive retries:0  Invalid misc:0   Missed beacon:0lo        no wireless extensions.eth0      no wireless extensions.

 

转载于:https://my.oschina.net/u/3452433/blog/1814037

你可能感兴趣的文章
Vue实例初始化的选项配置对象详解
查看>>
PLM产品技术的发展趋势 来源:e-works 作者:清软英泰 党伟升 罗先海 耿坤瑛
查看>>
vue part3.3 小案例ajax (axios) 及页面异步显示
查看>>
浅谈MVC3自定义分页
查看>>
.net中ashx文件有什么用?功能有那些,一般用在什么情况下?
查看>>
select、poll、epoll之间的区别总结[整理]【转】
查看>>
CSS基础知识(上)
查看>>
PHP中常见的面试题2(附答案)
查看>>
26.Azure备份服务器(下)
查看>>
mybatis学习
查看>>
LCD的接口类型详解
查看>>
Spring Boot Unregistering JMX-exposed beans on shutdown
查看>>
poi 导入导出的api说明(大全)
查看>>
Mono for Android 优势与劣势
查看>>
将图片转成base64字符串并在JSP页面显示的Java代码
查看>>
js 面试题
查看>>
sqoop数据迁移(基于Hadoop和关系数据库服务器之间传送数据)
查看>>
腾讯云下安装 nodejs + 实现 Nginx 反向代理
查看>>
Javascript 中的 Array 操作
查看>>
java中包容易出现的错误及权限问题
查看>>