Wifi

在 FreeBSD 12-CURRENT 中無法訪問強制門戶

  • December 2, 2017

問題

我正在嘗試使用執行 FreeBSD 12-CURRENT 的機器連接到開放 WiFi。

通常,wifi-start.sh每當我想連接到 Internet 時,我都會執行(見下文)。它適用於 WPA 網路,但我在使用開放網路時遇到了很多問題。dhclient能夠連接到開放網路並通過/etc/wpa_supplicant.confDHCP 接收 IP 地址。但是後來,我無法訪問強制門戶進行登錄。

有時在瀏覽器中打開http://neverssl.com就足夠了,但它並不總是有效。

設置

  • /boot/loader.conf:
if_iwm_load="YES"
iwm3160fw_load="YES"
  • /etc/rc.conf
local_unbound_enable="YES"
  • /etc/resolvconf.conf
# This file was generated by local-unbound-setup.
# Modifications will be overwritten.
resolv_conf="/dev/null" # prevent updating /etc/resolv.conf
unbound_conf="/var/unbound/forward.conf"
unbound_pid="/var/run/local_unbound.pid"
unbound_service="local_unbound"
unbound_restart="service local_unbound reload"
  • /etc/wpa_supplicant.conf:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
network={
ssid="Open Network"
key_mgmt=NONE
}
  • wifi-start.sh:
wlandev="${wlandev:-${1:-wlan0}}"
device="${device:-${2:-iwm0}}"

if ! ifconfig "$wlandev" 1>&2 2>/dev/null; then
   sudo ifconfig "$wlandev" create wlandev "$device"
else
   sudo service netif restart
fi

sudo ifconfig "$wlandev" up
sudo wpa_supplicant -B -i "$wlandev" -c /etc/wpa_supplicant.conf
sudo dhclient "$wlandev"

我用來配置設備並連接到網路的腳本


細節

  1. 設置在 Ubuntu 和 macOS 上是無憂的,所以:

  2. 應該不是路由器的問題

  3. 應該可以正確配置 FreeBSD。

  4. Wi-Fi 設備是 Intel Corporation Dual Band Wireless-AC 3160,所以我使用的是 iwm(4) 驅動程序。

  5. xconsole 中的錯誤

這是我在執行後在控制台中遇到的一個錯誤wifi-start.sh——dhclient然後放棄了。我第二次執行腳本時dhclient成功獲得了地址,並且xconsole.

但是,它可能與此問題無關。

Ethernet address: 34:e6:ad:16:bf:66
iwm_auth: failed to set multicast
iwm_newstate: could not move to auth state: 35
dumping device error log
Start Error Log Dump:
Status: 0x3, count: 6
0x0000090A | ADVANCED_SYSASSERT
080000B0 | trm_hw_status0
00000000 | trm_hw_status1
00000B30 | branchlink2
000148E0 | interruptlink1
00000000 | interruptlink2
DEADBEEF | data1
DEADBEEF | data2
DEADBEEF | data3
001CA815 | beacon time
002362E3 | tsf low
00000000 | tsf hi
00000000 | time gp1
002362E4 | time gp2
00000000 | uCode revision type
00000011 | uCode version major
000561E2 | uCode version minor
00000164 | hw version
00809004 | board version
0000001C | hcmd
00022002 | isr0
00000000 | isr1
00000002 | isr2
00417C81 | isr3
00000000 | isr4
00004110 | last cmd Id
00000000 | wait_event
00000080 | l2p_control
00450020 | l2p_duration
0000003F | l2p_mhvalid
00000000 | l2p_addr_match
00000007 | lmpm_pmg_sel
15061432 | timestamp
00003038 | flow_handler
driver status:
  tx ring  0: qid=0  cur=1   queued=1
  tx ring  1: qid=1  cur=0   queued=0
  tx ring  2: qid=2  cur=0   queued=0
  tx ring  3: qid=3  cur=0   queued=0
  tx ring  4: qid=4  cur=0   queued=0
  tx ring  5: qid=5  cur=0   queued=0
  tx ring  6: qid=6  cur=0   queued=0
  tx ring  7: qid=7  cur=0   queued=0
  tx ring  8: qid=8  cur=0   queued=0
  tx ring  9: qid=9  cur=33  queued=1
  tx ring 10: qid=10 cur=0   queued=0
  tx ring 11: qid=11 cur=0   queued=0
  tx ring 12: qid=12 cur=0   queued=0
  tx ring 13: qid=13 cur=0   queued=0
  tx ring 14: qid=14 cur=0   queued=0
  tx ring 15: qid=15 cur=0   queued=0
  tx ring 16: qid=16 cur=0   queued=0
  tx ring 17: qid=17 cur=0   queued=0
  tx ring 18: qid=18 cur=0   queued=0
  tx ring 19: qid=19 cur=0   queued=0
  tx ring 20: qid=20 cur=0   queued=0
  tx ring 21: qid=21 cur=0   queued=0
  tx ring 22: qid=22 cur=0   queued=0
  tx ring 23: qid=23 cur=0   queued=0
  tx ring 24: qid=24 cur=0   iwm_newstate: Failed to remove station: 35
iwm_mvm_mac_ctxt_changed: called; uploaded = 0
iwm_newstate: Failed to change mac context: 5
iwm_newstate: Failed to remove channel ctx: 22
iwm_newstate: failed to update power management
  1. ifconfig -v wlan0

這是結果ifconfig -v wlan0

wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 34:e6:ad:16:bf:66
        hwaddr 34:e6:ad:16:bf:66
        inet6 fe80::36e6:adff:fe16:bf66%wlan0 prefixlen 64 tentative scopeid 0x2
        inet 10.1.2.41 netmask 0xffffff00 broadcast 10.1.2.255
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: IEEE 802.11 Wireless Ethernet OFDM/54Mbps mode 11g
        status: associated
        ssid "Open Network" channel 11 (2462 MHz 11g) bssid 4e:5e:0c:eb:8e:ad
        regdomain FCC country US anywhere -ecm authmode OPEN -wps -tsn
        privacy OFF deftxkey UNDEF powersavemode OFF powersavesleep 100
        txpower 30 txpowmax 50.0 -dotd rtsthreshold 2346 fragthreshold 2346
        bmiss 10
        11a     ucast NONE    mgmt  6 Mb/s mcast  6 Mb/s maxretry 6
        11b     ucast NONE    mgmt  1 Mb/s mcast  1 Mb/s maxretry 6
        11g     ucast NONE    mgmt  1 Mb/s mcast  1 Mb/s maxretry 6
        turboA  ucast NONE    mgmt  6 Mb/s mcast  6 Mb/s maxretry 6
        turboG  ucast NONE    mgmt  1 Mb/s mcast  1 Mb/s maxretry 6
        sturbo  ucast NONE    mgmt  6 Mb/s mcast  6 Mb/s maxretry 6
        11na    ucast NONE    mgmt 12 MCS  mcast 12 MCS  maxretry 6
        11ng    ucast NONE    mgmt  2 MCS  mcast  2 MCS  maxretry 6
        half    ucast NONE    mgmt  3 Mb/s mcast  3 Mb/s maxretry 6
        quarter ucast NONE    mgmt  1 Mb/s mcast  1 Mb/s maxretry 6
        11acg   ucast NONE    mgmt  1 Mb/s mcast  1 Mb/s maxretry 6
        11ac    ucast NONE    mgmt  6 Mb/s mcast  6 Mb/s maxretry 6
        scanvalid 60 -bgscan bgscanintvl 300 bgscanidle 250
        roam:11a     rssi    7dBm rate 12 Mb/s
        roam:11b     rssi    7dBm rate  1 Mb/s
        roam:11g     rssi    7dBm rate  5 Mb/s
        roam:turboA  rssi    7dBm rate 12 Mb/s
        roam:turboG  rssi    7dBm rate 12 Mb/s
        roam:sturbo  rssi    7dBm rate 12 Mb/s
        roam:11na    rssi    7dBm  MCS  1
        roam:11ng    rssi    7dBm  MCS  1
        roam:half    rssi    7dBm rate  6 Mb/s
        roam:quarter rssi    7dBm rate  3 Mb/s
        roam:11acg   rssi    7dBm rate 64 Mb/s
        roam:11ac    rssi    7dBm rate 64 Mb/s
        -pureg protmode CTS -ht -htcompat -ampdu ampdulimit 64k
        ampdudensity NA -amsdu -shortgi htprotmode RTSCTS -puren -smps -rifs
        -stbc -ldpc -vht -vht40 -vht80 -vht80p80 -vht160 wme -burst -dwds
        roaming MANUAL bintval 100
        AC_BE cwmin  4 cwmax 10 aifs  3 txopLimit   0 -acm ack
              cwmin  4 cwmax 10 aifs  3 txopLimit   0 -acm
        AC_BK cwmin  4 cwmax 10 aifs  7 txopLimit   0 -acm ack
              cwmin  4 cwmax 10 aifs  7 txopLimit   0 -acm
        AC_VI cwmin  3 cwmax  4 aifs  2 txopLimit  94 -acm ack
              cwmin  3 cwmax  4 aifs  2 txopLimit  94 -acm
        AC_VO cwmin  2 cwmax  3 aifs  2 txopLimit  47 -acm ack
              cwmin  2 cwmax  3 aifs  2 txopLimit  47 -acm
        groups: wlan
  1. http://neverssl.com XML

此外,當我執行以下步驟時,我從http://neverssl.com收到了一個有趣的 XML 響應:

  • 連接到開放網路dhclient成功接收地址)。
  • 嘗試打開http://neverssl.com。它只是掛起試圖載入。
  • 重新連接到其他實際可用的 Wi-Fi。
  • 查看http://neverssl.com選項卡並查看以下內容:

此 XML 文件似乎沒有任何與之關聯的樣式資訊。文件樹如下所示。

 -<Error>
    <Code>AccessDenied</Code>
    <Message>Access Denied</Message>
    <RequestId>3FD41663CABFE8CD</RequestId>
   -<HostId>
      dsczv0lxKSFmBneOVS5nm5Ru5D3Br1bCRCqqj25WZVb1BzKI9McRR+djm9IrmgXHVIk/mdUCvfM=
    </HostId>
  </Error>
  1. 調整 /etc/resolv.conf

有人建議我應該設置/etc/resolv.conf然後執行resolvconf -iand resolvconf -l. 結果如下:

  • 在 /var/db/dhclient.leases.wlan0 內部:
lease {
  interface "wlan0";
  fixed-address 10.1.236.56;
  next-server 10.1.236.1;
  option subnet-mask 255.255.255.255;
  option routers 10.1.236.1;
  option domain-name-servers 10.1.236.1,194.204.159.1;
  option dhcp-lease-time 900;
  option dhcp-message-type 5;
  option dhcp-server-identifier 10.1.236.1;
  renew 5 2017/7/7 16:10:15;
  rebind 5 2017/7/7 16:15:49;
  expire 5 2017/7/7 16:17:45;
}
輸出`dhclient wlan0`:
an0: no link .... got link
CPREQUEST on wlan0 to 255.255.255.255 port 67
CPACK from 10.1.236.1
und to 10.1.236.56 -- renewal in 450 seconds.
添加`nameserver 10.1.236.1`到`/etc/resolv.conf`似乎沒有改變任何東西。
輸出`resolvconf -i`:
an0
輸出`resolvconf -l`:
resolv.conf from wlan0
meserver 10.1.236.1
meserver 194.204.159.1
在任何時候我都無法打開<http://neverssl.com&gt;或&lt;http://gooogle.pl>。我也無法重定向到強制門戶。
結果`ifconfig -v wlan0`:
an0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; metric 0 mtu 1500
her 34:e6:ad:16:bf:66
addr 34:e6:ad:16:bf:66
et6 fe80::36e6:adff:fe16:bf66%wlan0 prefixlen 64 tentative scopeid 0x2
et 10.1.236.56 netmask 0xffffffff broadcast 10.1.236.56
6 options=29&lt;PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL&gt;
dia: IEEE 802.11 Wireless Ethernet OFDM/36Mbps mode 11g
atus: associated
id "Open Hotspot" channel 6 (2437 MHz 11g) bssid 9c:1c:12:0b:10:73
gdomain FCC country US anywhere -ecm authmode OPEN -wps -tsn
ivacy OFF deftxkey UNDEF powersavemode OFF powersavesleep 100
power 30 txpowmax 50.0 -dotd rtsthreshold 2346 fragthreshold 2346
iss 10
a     ucast NONE    mgmt  6 Mb/s mcast  6 Mb/s maxretry 6
b     ucast NONE    mgmt  1 Mb/s mcast  1 Mb/s maxretry 6
g     ucast NONE    mgmt  1 Mb/s mcast  1 Mb/s maxretry 6
rboA  ucast NONE    mgmt  6 Mb/s mcast  6 Mb/s maxretry 6
rboG  ucast NONE    mgmt  1 Mb/s mcast  1 Mb/s maxretry 6
urbo  ucast NONE    mgmt  6 Mb/s mcast  6 Mb/s maxretry 6
na    ucast NONE    mgmt 12 MCS  mcast 12 MCS  maxretry 6
ng    ucast NONE    mgmt  2 MCS  mcast  2 MCS  maxretry 6
lf    ucast NONE    mgmt  3 Mb/s mcast  3 Mb/s maxretry 6
arter ucast NONE    mgmt  1 Mb/s mcast  1 Mb/s maxretry 6
acg   ucast NONE    mgmt  1 Mb/s mcast  1 Mb/s maxretry 6
ac    ucast NONE    mgmt  6 Mb/s mcast  6 Mb/s maxretry 6
anvalid 60 -bgscan bgscanintvl 300 bgscanidle 250
am:11a     rssi    7dBm rate 12 Mb/s
am:11b     rssi    7dBm rate  1 Mb/s
am:11g     rssi    7dBm rate  5 Mb/s
am:turboA  rssi    7dBm rate 12 Mb/s
am:turboG  rssi    7dBm rate 12 Mb/s
am:sturbo  rssi    7dBm rate 12 Mb/s
am:11na    rssi    7dBm  MCS  1
am:11ng    rssi    7dBm  MCS  1
am:half    rssi    7dBm rate  6 Mb/s
am:quarter rssi    7dBm rate  3 Mb/s
am:11acg   rssi    7dBm rate 64 Mb/s
am:11ac    rssi    7dBm rate 64 Mb/s
ureg protmode CTS -ht -htcompat -ampdu ampdulimit 8k
pdudensity NA -amsdu -shortgi htprotmode RTSCTS -puren -smps -rifs
tbc -ldpc -vht -vht40 -vht80 -vht80p80 -vht160 wme -burst -dwds
aming MANUAL bintval 100
_BE cwmin  4 cwmax 10 aifs  3 txopLimit   0 -acm ack
min  4 cwmax 10 aifs  3 txopLimit   0 -acm
_BK cwmin  4 cwmax 10 aifs  7 txopLimit   0 -acm ack
min  4 cwmax 10 aifs  7 txopLimit   0 -acm
_VI cwmin  3 cwmax  4 aifs  2 txopLimit  94 -acm ack
min  3 cwmax  4 aifs  2 txopLimit  94 -acm
_VO cwmin  2 cwmax  3 aifs  2 txopLimit  47 -acm ack
min  2 cwmax  3 aifs  2 txopLimit  47 -acm
oups: wlan

還`echo nameserver 10.1.236.1 | resolvconf -a wlan0`返回:
	
	
	
t; 
t; 
t; ```
t; cp: /dev/null.bak: Operation not supported
t; 
t; ```
t; 
t;




---


參考資料和註釋
-------


* /var/db/dhclient.leases.wlan* 文件可能儲存有趣的資訊。
* /etc/resolv.conf 為空。

解釋

問題在於安裝過程中/etc/resolvconf.conf自動生成的配置。

原來是因為設置local_unbound_enable="YES",FreeBSD添加了

resolv_conf="/dev/null" # prevent updating /etc/resolv.conf

/etc/resolvconf.conf,這阻止了 的修改/etc/resolv.conf。結果,我的系統似乎總是將 DNS 查詢發送到根之一,而不是熱點提供的 DNS 伺服器。

解決方案

  1. resolv_conf="/dev/null"從中刪除/etc/resolvconf.conf

系統會自動退回到/etc/resolv.conf那時。 2. local_unbound_enable="YES"從中刪除/etc/rc.conf。 3. (可選)執行service local_unbound stop.

建立 wifi 連接後,嘗試在 FireFox 中打開*任何站點。*它將打開強制門戶;Firefox 了解所涉及的協議,並將向您顯示身份驗證頁面。

從那裡開始,在您正確進行身份驗證後,您將可以像往常一樣訪問強制門戶後面的服務。

例如,您必須使用 DHCP 提供的 DNS 伺服器,而不是 8.8.8.8。

它適用於我的 FON 強制門戶。

引用自:https://unix.stackexchange.com/questions/375282