- 樹莓派開發從零開始學:超好玩的智能小硬件制作書
- 胡松濤
- 342字
- 2021-03-19 19:29:49
2.2.3 無線網絡配置
如果可以,盡量使用有線網卡。不是Raspberry的無線不給力,而是免驅支持Raspberry的無線網卡實在是不多。為了避免安裝驅動的麻煩,還是使用有線網卡方便。
如果無線網卡是免驅的或者已經安裝好驅動后,RaspBian上配置無線網卡很簡單。同樣還是使用vim修改/etc/network/interfaces。以下是最后修改好的interfaces代碼:
#### 回環地址 auto lo iface lo inet loopback #### 第一個有線網卡 auto eth0 allow-hotplug eth0 #iface eth0 inet manual iface eth0 inet static address 192.168.2.91 netmask 255.255.255.0 gateway 192.168.2.1 #### 第一個無線網卡 auto wlan0 allow-hotplug wlan0 iface wlan0 inet static address 192.168.2.92 netmask 255.255.255.0 gateway 192.168.2.1 wpa-ssid yourssid wpa-psk youpassword
重啟系統,執行命令:
sudo reboot
好了,系統重啟后無線網卡將自動連接到wifi上了。可以拔下有線網卡上的網線了。無線連接網絡優勢在于使用方便,有線連接的優勢在于性能優越。根據需要自行選擇。
注意
不管是選擇有線連接還是無線連接,建議都是用靜態分配IP。這是為了以后Putty連接方便。總不能每次連接Raspberry前都掃描一次內網確定Raspberry的IP吧。