OpenWrt wifi设置

  • Post author:
  • Post category:其他




1.启用无线网卡

重置配置文件,如果是新系统没有进行过相关设置可以跳过

rm -f /etc/config/wireless; wifi config instead

启用无线网卡

uci set wireless.@wifi-device[0].disabled="0"
uci commit wireless
wifi

提示:这里是设置第一块无线网卡。

如果要设置第二块网卡,如下操作

uci set wireless.@wifi-device[1].disabled="0"
uci commit wireless
wifi wlan1



2.无线网络设置

执行

iw dev

命令显示如下格式信息

phy#0
        Interface wlan0
                ifindex 5
                wdev 0x1
                addr ab:12:23:dc:03:45
                type managed
                txpower 20.00 dBm

搜索无线网络

iw dev wlan0 scan

显示如下格式无线网络信息,若有多个无线网络,会显示多个这样格式的信息

BSS c8:d5:fe:c8:61:b0(on wlan0) 
        TSF: 24324848870 usec (0d, 06:45:24)
        freq: 2412
        beacon interval: 100 TUs
        capability: ESS (0x0411)
        signal: -72.00 dBm
        last seen: 140 ms ago
        Information elements from Probe Response frame:
        SSID: Violetta
        HT capabilities:
                Capabilities: 0x102c
                        HT20
                        SM Power Save disabled
                        RX HT20 SGI
                        No RX STBC
                        Max AMSDU length: 3839 bytes
                        DSSS/CCK HT40
                Maximum RX AMPDU length 32767 bytes (exponent: 0x002)
                Minimum RX AMPDU time spacing: 16 usec (0x07)
                HT RX MCS rate indexes supported: 0-7
                HT TX MCS rate indexes are undefined
        HT operation:
                 * primary channel: 13
                 * secondary channel offset: no secondary
                 * STA channel width: 20 MHz
        RSN:     * Version: 1
                 * Group cipher: CCMP
                 * Pairwise ciphers: CCMP
                 * Authentication suites: PSK
                 * Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c)

编辑

/etc/config/network

,添加修改以下内容

config interface 'wwan'
        option proto 'dhcp'

编辑

/etc/config/wireless

,添加修改以下内容

config wifi-iface 'default_radio0'
        option device 'radio0'
        option network 'wwan'
        option mode 'sta'
        option ssid 'Violetta'
        option encryption 'psk2'
        option bssid 'c8:d5:fe:c8:61:b0'
        option key 'YourWifiPassword'

编辑

/etc/config/firewall

,找到zone wan,添加一行

list network 'wwan'

,如下

config zone
        option name             wan
        list   network          'wan'
        list   network          'wan6'
        list   network          'wwan'
        option input            REJECT
        option output           ACCEPT
        option forward          REJECT
        option masq             1
        option mtu_fix          1



3.启用wifi

wifi; /etc/init.d/firewall restart

查看信息

iw dev
phy#0
        Interface wlan0
                ifindex 5
                wdev 0x1
                addr ab:12:23:dc:03:45
                ssid Violetta
                type managed
                channel 13 (2472 MHz), width: 20 MHz, center1: 2472 MHz
                txpower 20.00 dBm



版权声明:本文为kangzeru原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。