问题

问题

问题

我正在尝试使用运行 FreeBSD 12-CURRENT 的计算机连接到开放 WiFi。


通常,wifi-start.sh只要我想连接到互联网,我就会运行(见下文)。它适用于 WPA 网络,但我在使用开放网络时遇到很多问题。能够dhclient连接到已设置的开放网络/etc/wpa_supplicant.conf,并通过 DHCP 接收 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 上的设置很简单,因此:

    1. 很可能不是路由器的问题
    2. 应该可以正确配置 FreeBSD。
  2. Wi-Fi 设备是 Intel Corporation Dual Band Wireless-AC 3160,因此我使用 iwm(4) 驱动程序。

  3. 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
    
  4. 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
    
  5. http://neverssl.comXML

    另外,我收到了来自的有趣的 XML 响应http://neverssl.com当我执行以下步骤时:

    • 连接到开放网络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>
    
  6. 调整 /etc/resolv.conf

    有人建议我应该设置/etc/resolv.conf然后运行resolvconf -i​​和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

      wlan0: no link .... got link
      DHCPREQUEST on wlan0 to 255.255.255.255 port 67
      DHCPACK from 10.1.236.1
      bound to 10.1.236.56 -- renewal in 450 seconds.
      
    • 添加nameserver 10.1.236.1似乎/etc/resolv.conf并没有改变任何东西。

    • 输出resolvconf -i

      wlan0
      
    • 输出resolvconf -l

      # resolv.conf from wlan0
      nameserver 10.1.236.1
      nameserver 194.204.159.1
      
    • 我在任何时候都无法打开http://neverssl.com或者http://google.pl。我也无法重定向到强制门户。

    • 的结果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.236.56 netmask 0xffffffff broadcast 10.1.236.56
          nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
          media: IEEE 802.11 Wireless Ethernet OFDM/36Mbps mode 11g
          status: associated
          ssid "Open Hotspot" channel 6 (2437 MHz 11g) bssid 9c:1c:12:0b:10:73
          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 8k
          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
      
      • echo nameserver 10.1.236.1 | resolvconf -a wlan0返回:

        cp: /dev/null.bak: Operation not supported
        

参考文献和注释

  • /var/db/dhclient.leases.wlan* 文件可能存储有趣的信息。
  • /etc/resolv.conf 为空。

答案1

尝试打开任何建立 wifi 连接后,在 FireFox 中访问该站点。它将打开强制门户; Firefox 了解所涉及的协议并将向您显示身份验证页面。

从那时起,在正确进行身份验证后,您将可以像往常一样访问强制门户背后的服务。

您必须使用 DHCP 提供的 DNS 服务器,而不是 8.8.8.8。

它适用于我的 FON 强制门户。

答案2

解释

问题出/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.

相关内容