标题:[实践OK]Raspberry Pi下安装FreeBSD系统并实现无线网络连接无线网卡,及DNS设置。 出处:向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除 时间:Sat, 20 Feb 2016 21:04:56 +0000 作者:jackxiang 地址:http://jackxiang.com/post/8518/ 内容: 配置FreeBSD下的Wifi主要参考这两篇文章即可,树莓派下的也大体一样一样的没有什么大的区别: http://www.111cn.net/sys/freebsd/59534.htm 国外有一个文章在后面有写。 总之,按这样来配置连接上了家里的路由器。 Raspberry Pi Model B+ Run FreeBSD11+Apache+PHP+MySQL+Webmin+Wordpress: http://www.bigsea.com.cn/archives/1393/ ifconfig -a时没有wlan0,是因为没有配置及没有启动服务:service netif start root@rpi2:~ # ifconfig wlan0 wlan0: flags=8843 metric 0 mtu 1500 ether 3c:46:d8:8e:7d:dc inet6 fe80::3e46:d8ff:fe8e:7ddc%wlan0 prefixlen 64 tentative scopeid 0x3 groups: wlan ssid HiWiFi_256ECA channel 4 (2427 MHz 11g) bssid d4:ee:07:25:6e:ca country US authmode WPA2/802.11i privacy ON deftxkey UNDEF AES-CCM 2:128-bit txpower 0 bmiss 7 scanvalid 60 bgscan bgscanintvl 300 bgscanidle 250 roam:rssi 7 roam:rate 5 protmode CTS wme roaming MANUAL media: IEEE 802.11 Wireless Ethernet DS/1Mbps mode 11g status: associated nd6 options=29 其中“status: associated”表示无线网络已经连接,可以上网冲浪了。 固定你的 resolv.conf 如果你用DHCP,有一个问题可能会不断地搔扰你,就是/etc/resolv.conf里所记录的 DNS 会时不时地被修改。当然除了暴力地 代码如下 复制代码 #chflags schg /etc/resolv.conf 让它不能被修改外,还可以很简单地解决此问题,就是往/etc/dhclient.conf里添加 代码如下 复制代码 prepend domain-name-servers 8.8.8.8, 8.8.4.4; # See ``man 5 dhclient.conf'' for details. 修改成自己的: prepend domain-name-servers 114.114.114.114, 123.125.81.6; # See ``man 5 dhclient.conf'' for details. 详细配置WIFI可查看FreeBSD官方文档。 ========================================================================= USB硬件信息: root@rpi2:~ # dmesg | grep urtwn0 urtwn0: on usbus0 urtwn0: MAC/BB RTL8188EU, RF 6052 1T1R urtwn0: at uhub1, port 3, addr 4 (disconnected) urtwn0: on usbus0 urtwn0: MAC/BB RTL8188EU, RF 6052 1T1R root@rpi2:~ # cat /var/log/messages | grep urtwn0 Feb 17 11:19:16 rpi2 kernel: urtwn0: on usbus0 Feb 17 11:19:16 rpi2 kernel: urtwn0: MAC/BB RTL8188EU, RF 6052 1T1R Feb 17 11:39:37 rpi2 kernel: urtwn0: on usbus0 Feb 17 11:39:37 rpi2 kernel: urtwn0: MAC/BB RTL8188EU, RF 6052 1T1R Feb 17 14:15:35 rpi2 kernel: urtwn0: at uhub1, port 3, addr 4 (disconnected) Feb 17 14:20:14 rpi2 kernel: urtwn0: on usbus0 Feb 17 14:20:14 rpi2 kernel: urtwn0: MAC/BB RTL8188EU, RF 6052 1T1R 启动时信息提示: root@rpi2:~ # ifconfig wlan create wlandev urtwn0 ieee80211_load_module: load the wlan_amrr module by hand for now. wlan0: Ethernet address: 3c:46:d8:8e:7d:dc wlan0 拔下无线Wifi的USB时提示: root@rpi2:~ # ugen0.4: at usbus0 (disconnected) urtwn0: at uhub1, port 3, addr 4 (disconnected) 查看网络: root@rpi2:~ # ifconfig wlan0 up scan wlan0: ieee80211_new_state_locked: pending INIT -> SCAN transition lost SSID/MESH ID BSSID CHAN RATE S:N INT CAPS 123456 b8:55:10:1a:9d:05 6 54M -77:-95 100 EP RSN HTCAP WME ChinaNet-iYDT fc:e3:3c:54:b8:ec 11 54M -93:-95 98 EP HTCAP WPS WPA WME CALT 40:16:9f:55:33:2c 7 54M -90:-95 100 EPS RSN WPA WME HTCAP ATH WPS ChinaNet-Kjvz 60:b6:17:79:14:b7 2 54M -89:-95 100 EP HTCAP WPA WME CU_VGSU 88:cf:98:dd:fa:18 3 54M -91:-95 100 EP HTCAP RSN WME HiWiFi_256ECA d4:ee:07:25:6e:ca 4 54M -69:-95 100 EP HTCAP WPA RSN WME jiaweiyi 8c:be:be:2f:ae:5b 8 54M -93:-95 100 EP RSN HTCAP WPS WPA WME ChinaNet-qePR 60:b6:17:78:89:3e 10 54M -79:-95 100 EP HTCAP WPA WME service netif start # 这个能自动帮你连接无线获取IP地址,当然如果配置正确的话,开机就可以自动连接上无线了。 实践来源:http://jackxiang.com/post/7492/ ————————————————————————————————————————————————————————————— Setting up USB WiFi under FreeBSD is not a very hard task. We can use official handbook. But in my opinion it’s too complex. Here is a simple guide how to configure USB WiFi. Our goal is to configure WiFi interface to connect and use available wireless network. I use Miniature WiFi Module from Adafruit. This is in reality Realtek RTL8188CUS. elinux.org says this is a problem adapter. And I had some problems with it under Raspbian. There was no driver for this adapter in FreeBSD-10.0-RELEASE. Driver for this adapter appears in stable images in March. This is good for us, so we don’t need to adding it into kernel. During boot we can see our adapter: 点击在新窗口中浏览此图片 https://vzaigrin.files.wordpress.com/2014/04/14.jpg After boot we can see it in interfaces list: 点击在新窗口中浏览此图片 http://jackxiang.com/file:///E:/Raspberry%20Pi/%E6%A0%91%E8%8E%93%E6%B4%BEFreeBSD%E8%AE%BE%E7%BD%AEWifi%E8%81%94%E7%BD%91/How%20to%20setup%20USB%20WiFi%20on%20Raspberry%20Pi%20with%20FreeBSD%20_%20Vadim%20Zaigrin_files/15.jpg If we try to up this interface we will see some warning and error messages: urtwn-rtl8192cfwT: You need to read the LICENSE file in /usr/share/doc/legal/realtek/. urtwn-rtl8192cfwT: If you agree with the license, set legal.realtek.license_ack=1 in /boot/loader.conf. module_register_init: MOD_LOAD (urtwn-rtl8192cfwT_fw, 0xc2aa24f0, 0) error 1 urtwn-rtl8192cfwT: could not load firmware image, error 8 urtwn0: failed loadfirmware of file urtwn-rtl8192cfwT 点击在新窗口中浏览此图片 http://jackxiang.com/file:///E:/Raspberry%20Pi/%E6%A0%91%E8%8E%93%E6%B4%BEFreeBSD%E8%AE%BE%E7%BD%AEWifi%E8%81%94%E7%BD%91/How%20to%20setup%20USB%20WiFi%20on%20Raspberry%20Pi%20with%20FreeBSD%20_%20Vadim%20Zaigrin_files/18.jpg We need to add this two strings to file /boot/loader.conf: legal.realtek.license_ack=1 if_urtwn_load="YES" 点击在新窗口中浏览此图片 http://jackxiang.com/file:///E:/Raspberry%20Pi/%E6%A0%91%E8%8E%93%E6%B4%BEFreeBSD%E8%AE%BE%E7%BD%AEWifi%E8%81%94%E7%BD%91/How%20to%20setup%20USB%20WiFi%20on%20Raspberry%20Pi%20with%20FreeBSD%20_%20Vadim%20Zaigrin_files/19.jpg After reboot we can continue. Next step is creating wlan interface: ifconfig wlan0 create wlandev urtwn0 Then we can to up this wlan interface and scan available wireless networks: ifconfig wlan0 up scan 点击在新窗口中浏览此图片 http://jackxiang.com/file:///E:/Raspberry%20Pi/%E6%A0%91%E8%8E%93%E6%B4%BEFreeBSD%E8%AE%BE%E7%BD%AEWifi%E8%81%94%E7%BD%91/How%20to%20setup%20USB%20WiFi%20on%20Raspberry%20Pi%20with%20FreeBSD%20_%20Vadim%20Zaigrin_files/21.jpg For permanent use WiFi connection we need to add this two strings to file /etc/rc.conf: wlans_urtwn0="wlan0" ifconfig_wlan0="WPA DHCP" 点击在新窗口中浏览此图片 http://jackxiang.com/file:///E:/Raspberry%20Pi/%E6%A0%91%E8%8E%93%E6%B4%BEFreeBSD%E8%AE%BE%E7%BD%AEWifi%E8%81%94%E7%BD%91/How%20to%20setup%20USB%20WiFi%20on%20Raspberry%20Pi%20with%20FreeBSD%20_%20Vadim%20Zaigrin_files/22.jpg And we need to configure authentication in file /etc/wpa_supplicant.conf 点击在新窗口中浏览此图片 http://jackxiang.com/file:///E:/Raspberry%20Pi/%E6%A0%91%E8%8E%93%E6%B4%BEFreeBSD%E8%AE%BE%E7%BD%AEWifi%E8%81%94%E7%BD%91/How%20to%20setup%20USB%20WiFi%20on%20Raspberry%20Pi%20with%20FreeBSD%20_%20Vadim%20Zaigrin_files/23.jpg After reboot we can check network connection: 点击在新窗口中浏览此图片 http://jackxiang.com/file:///E:/Raspberry%20Pi/%E6%A0%91%E8%8E%93%E6%B4%BEFreeBSD%E8%AE%BE%E7%BD%AEWifi%E8%81%94%E7%BD%91/How%20to%20setup%20USB%20WiFi%20on%20Raspberry%20Pi%20with%20FreeBSD%20_%20Vadim%20Zaigrin_files/25.jpg It works! Generated by Jackxiang's Bo-blog 2.1.1 Release