我的问题看起来类似于这个。
我在 FreeBSD 10.3-STABLE 上配置我的 Broadcom BCM4311 802.11b/g 设备,如下所示:
sudo kldload if_bwn
sudo kldload bwn_v4_ucode
sudo kldload bwn_v4_lp_ucode
#
# Now, interface `bwn0` is available
#
sudo ifconfig wlan0 create wlandev bwn0
sudo ifconfig wlan0 up # at this moment, laptop WiFi LED light turns on
sudo ifconfig wlan0 scan # I can see my wireless router SSID
sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
sudo ifconfig wlan0 list sta
sudo dhclient wlan0
#
# Optionally, rather than dhclient run:
#
sudo ifconfig wlan0 inet 192.168.1.103 netmask 0xffffff00
ifconfig
显示关联的无线网络状态:
$ ifconfig
bge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=8009b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LINKSTATE>
ether 00:15:c5:ad:63:9c
inet 192.168.1.101 netmask 0xffffff00 broadcast 192.168.1.255
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
inet 127.0.0.1 netmask 0xff000000
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
bwn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 2290
ether 00:18:f3:38:a0:36
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: IEEE 802.11 Wireless Ethernet autoselect mode 11g
status: associated
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ether 00:18:f3:38:a0:36
inet 192.168.1.103 netmask 0xffffff00 broadcast 192.168.1.255
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: IEEE 802.11 Wireless Ethernet OFDM/48Mbps mode 11g
status: associated
ssid Mine channel 11 (2462 MHz 11g) bssid e8:de:27:6b:3e:67
country US authmode WPA2/802.11i privacy ON deftxkey UNDEF
TKIP 2:128-bit txpower 30 bmiss 7 scanvalid 60 bgscan bgscanintvl 300
bgscanidle 250 roam:rssi 7 roam:rate 5 protmode CTS wme roaming MANUAL
$
我断开笔记本电脑的以太网线,通过以下方法检查与路由器的无线连接:
无线路由器显示我的笔记本电脑列在“当前连接的无线客户端”中:
ID MAC
1 00:18:F3:38:A0:36
无线路由器有一个诊断 ping 工具,我可以通过该工具 ping 到我的笔记本电脑,当我这样做时,timed out
会收到消息:
IP Address/Domain Name: 192.168.1.103
Request timed out
我从我的笔记本电脑 ping 到路由器:
$ ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
ping: sendto: No route to host
ping: sendto: No route to host
ping: sendto: No route to host
ping: sendto: No route to host
ping: sendto: No route to host
^C
--- 192.168.1.1 ping statistics ---
5 packets transmitted, 0 packets received, 100.0% packet loss
$
arp -an
输出:
$ arp -an
? (192.168.1.103) at 00:18:f3:38:a0:36 on wlan0 permanent [ethernet]
? (192.168.1.1) at e8:de:27:6b:3e:67 on bge0 expires in 803 seconds [ethernet]
? (192.168.1.101) at 00:15:c5:ad:63:9c on bge0 permanent [ethernet]
$
netstat -r
输出:
$ netstat -r
Routing tables
Internet:
Destination Gateway Flags Netif Expire
default 192.168.1.1 UGS bge0
localhost link#2 UH lo0
192.168.1.0 link#4 U wlan0
192.168.1.101 link#1 UHS lo0
192.168.1.103 link#4 UHS lo0
Internet6:
Destination Gateway Flags Netif Expire
:: localhost UGRS lo0
localhost link#2 UH lo0
::ffff:0.0.0.0 localhost UGRS lo0
fe80:: localhost UGRS lo0
fe80::%lo0 link#2 U lo0
fe80::1%lo0 link#2 UHS lo0
ff01::%lo0 localhost U lo0
ff02:: localhost UGRS lo0
ff02::%lo0 localhost U lo0
$
dmesg
wlan0
从创建接口到命令的输出dhclient
:
wlan0: Ethernet address: 00:18:f3:38:a0:36
bwn0: firmware version (rev 410 patch 2160 date 0x751a time 0x7c0a)
wlan0: ieee80211_new_state_locked: pending INIT -> SCAN transition lost
bwn0: status of RF switch is changed to OFF
bwn0: please turn on the RF switch
bwn0: firmware version (rev 410 patch 2160 date 0x751a time 0x7c0a)
bwn0: status of RF switch is changed to OFF
bwn0: please turn on the RF switch
wlan0: link state changed to UP
bwn0: need multicast update callback
bwn0: need multicast update callback
bwn0: need multicast update callback
配置文件
我不使用/etc/rc.conf
,我手动完成所有事情。我使用以下wpa_supplicant
配置:
$ cat /etc/wpa_supplicant.conf
network={
ssid="Mine"
psk=79a174594e2ec3563ff4c35c1a82a006b19df646fa020aaf53078d34d09ed962
}
$
我想知道是否有人可以伸出援手。
更新:
现在,我/etc/rc.conf
这样使用:
#
# Kernel modules to load after local disks are mounted
#
kld_list="linux nvidia if_bwn bwn_v4_ucode bwn_v4_lp_ucode fuse"
#
# DELL LATITUDE | D820
#
hostname="D820"
#
# $ sudo ifconfig wlan0 create wlandev bwn0
#
wlans_bwn0="wlan0"
#
# $ sudo ifconfig wlan0 up
# $ sudo ifconfig wlan0 scan
# $ sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
# $ sudo dhclient wlan0
#
wpa_supplicant_conf_file="/etc/wpa_supplicant.conf"
ifconfig_wlan0="WPA DHCP"
#
# gnome3-lite desktop environment services
#
#dbus_enable="YES"
#hald_enable="YES"
#gdm_enable="YES" # GDM will start automatically when the system boots
#gnome_enable="YES"
#linux_enable="YES"
##
## To enable the tor server
##
#tor_enable="YES"
##
## web proxy of choice
##
#polipo_enable="YES"
#privoxy_enable="YES"
##
##For Linux compatibility to be enabled at boot time
##
linux_enable="YES"
答案1
当您启动笔记本电脑并bge0
通过 配置有线接口时dhclient
,它成为默认路由(如 输出的最右列所示netstat -r
)。当您稍后配置无线bwn0
接口并断开有线接口时,它并未设置为默认路由。当您尝试访问网络(或回复请求)时,流量正在尝试使用bge0
但已断开连接。
重新启动笔记本电脑后,您只需配置无线接口即可,不会出现此问题。
如果您将来想从有线转向无线,我相信您可以执行以下操作:
route change default -iface wlan0
route change default 192.168.1.1
这会将默认路由接口设置为无线接口,从而重置路由器地址,因此我们在第二行中重新添加它。