Raspberry pi之wifi设置-3
1.配件套装里最好有wifi网卡,非常小如下图
插入Raspberry pi的USB口,用lsusb来查看USB设备列表如下
pi@raspberrypi~/Desktop $ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0c45:6340 Microdia
Bus 001 Device 005: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
802.11n WLAN Adapter就是本机的无线网卡
2.ifconfig查看网络配置,eth0是有线,我已经连接上(不然ssh毛啊),wlan0是无线口,暂时木有ip
eth0 Link encap:Ethernet HWaddr b8:27:eb:76:af:9b
inet addr:192.168.1.103 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:53269 errors:0 dropped:0 overruns:0 frame:0
TX packets:6304 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:12538447 (11.9 MiB) TX bytes:1240210 (1.1 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr e8:4e:06:15:5c:80
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:2 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
3.修改网络配置文件/etc/network/interfaces文件
sudo vim /etc/network/interfaces
显示
auto lo //表示使用localhost
iface lo inet loopback
iface eth0 inet dhcp //如果有网卡,就用dhcp获取ip地址
allow-hotplug wlan0 //表示wlan设备可以热插拔
iface wlan0 inet manual //manual表示手动配置wlan,dhcp表示自动获取
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf //无线网络默认配置列表文件,不建议用这种配置,我之前出错了,只能考虑外接显示屏处理了,淡淡的忧伤
iface default inet dhcp//不明白
修改原来的内容为
auto lo
iface lo inet loopback
iface eth0 inet dhcp
auto wlan0 //自动启动无线链接
allow-hotplug wlan0
iface wlan0 inet dhcp //dhcp获取ip地址f
wpa-ssid "ssidname"
wpa-psk "password"
iface default inet dhcp
此处我是配置一个网络,表示之前尝试修改很坑,最后还不得不用显示屏,用这种方式比较保险吧
配置完以后直接用sudo /etc/init.d/networking restart 或者reboot一下就ok了
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。