如何在 OpenWrt 上调试 wifi 设置?

如何在 OpenWrt 上调试 wifi 设置?

我有 TP-LINK MR3020 设备,它通过 UTP 电缆连接到我的笔记本电脑。它是可访问的。我最近安装了完整发行版,但后来把它弄坏了,然后从头开始使用故障安全/首次启动。

现在我已经删除了 luci 并想从命令行配置一切。

我有可用的 Wi-Fi 网络,我想让我的设备连接到该网络并通过我的 UTP 连接共享互联网。

这是我的 /etc/config 无线文件的内容:

config wifi-device  radio0
        option type     mac80211
        option channel  auto
        option macaddr  e8:de:27:54:68:78
        option hwmode   11ng
        option htmode   HT20
        list ht_capab   SHORT-GI-20
        list ht_capab   SHORT-GI-40
        list ht_capab   RX-STBC1
        list ht_capab   DSSS_CCK-40
        # REMOVE THIS LINE TO ENABLE WIFI:
        option disabled 0

#config wifi-iface
#       option device   radio0
#       option network  lan
#       option mode     ap
#       option ssid     OpenWrt
#       option encryption none
#       option disabled 1

config wifi-iface
        option device   radio0
        option network  inthemoon
        option mode     sta
        option ssid     'In The Moon Network'
        option encryption 'psk2'
        option key      'mykey'

这是我的 /etc/config/network 文件的内容:

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config interface 'lan'
        option ifname 'eth0'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'

config interface 'inthemoon'
        option proto 'dhcp'

我认为这足以完成任务了。

以下是一些命令的结果:

Successfully initialized wpa_supplicant
root@MR3020:~# ifup inthemoon
Successfully initialized wpa_supplicant
root@MR3020:~# wifi
Successfully initialized wpa_supplicant
root@MR3020:~#

不幸的是,我看不到任何表明 Wi-Fi 连接正常的迹象。

没有任何内部命令像“ping”那样工作。

如何查看、发生了什么以及如何调试配置?

更新

logread说“发送发现”和“wan 已关闭”(我将 inthemoon 重命名为 wan 并将 radio0 重命名为 wlan0,希望与其他配置兼容firewall

更新2

命令执行后的完整日志

root@MR3020:/etc/config# /etc/init.d/network restart ; ifup wan ; ping 192.168.10.1
Successfully initialized wpa_supplicant
Successfully initialized wpa_supplicant
PING 192.168.10.1 (192.168.10.1): 56 data bytes
ping: sendto: Network is unreachable

192.168.10.1是网关的 IP 地址。在网关上我没有看到设备的 DHCP 租约。

日志:

Jan  1 00:53:38 MR3020 daemon.notice netifd: Interface 'lan' is now down
Jan  1 00:53:38 MR3020 kern.info kernel: [ 3218.140000] br-lan: port 1(eth0) entered disabled state
Jan  1 00:53:38 MR3020 kern.info kernel: [ 3218.160000] device eth0 left promiscuous mode
Jan  1 00:53:38 MR3020 kern.info kernel: [ 3218.160000] br-lan: port 1(eth0) entered disabled state
Jan  1 00:53:38 MR3020 kern.info kernel: [ 3218.160000] eth0: link down
Jan  1 00:53:38 MR3020 daemon.notice netifd: Interface 'loopback' is now down
Jan  1 00:53:38 MR3020 daemon.notice netifd: Interface 'wan' is now down
Jan  1 00:53:38 MR3020 user.info firewall: removing lan (br-lan) from zone lan
Jan  1 00:53:40 MR3020 kern.info kernel: [ 3220.270000] device eth0 entered promiscuous mode
Jan  1 00:53:40 MR3020 daemon.notice netifd: Interface 'lan' is now up
Jan  1 00:53:40 MR3020 daemon.notice netifd: Interface 'loopback' is now up
Jan  1 00:53:40 MR3020 kern.info kernel: [ 3220.510000] eth0: link up (100Mbps/Full duplex)
Jan  1 00:53:40 MR3020 kern.info kernel: [ 3220.510000] br-lan: port 1(eth0) entered forwarding state
Jan  1 00:53:40 MR3020 kern.info kernel: [ 3220.520000] br-lan: port 1(eth0) entered forwarding state
Jan  1 00:53:41 MR3020 user.notice ifup: Enabling Router Solicitations on lan (br-lan)
Jan  1 00:53:42 MR3020 user.info firewall: adding lan (br-lan) to zone lan
Jan  1 00:53:42 MR3020 kern.info kernel: [ 3222.520000] br-lan: port 1(eth0) entered forwarding state
Jan  1 00:53:43 MR3020 user.notice ifup: Enabling Router Solicitations on loopback (lo)
Jan  1 00:53:46 MR3020 daemon.notice netifd: Interface 'wan' is now down
Jan  1 00:53:47 MR3020 daemon.notice netifd: wan (10625): udhcpc (v1.19.4) started
Jan  1 00:53:47 MR3020 daemon.notice netifd: wan (10625): Sending discover...
Jan  1 00:53:47 MR3020 daemon.notice netifd: wan (10625): udhcpc: sendto: Network is down
Jan  1 00:53:47 MR3020 daemon.notice netifd: wan (10625): Read error: Network is down, reopening socket
Jan  1 00:53:47 MR3020 daemon.notice netifd: wan (10625): udhcpc: bind: No such device
Jan  1 00:53:47 MR3020 daemon.notice netifd: Interface 'wan' is now down

如果我输入错误的无线密码,就会出现相同的日志。

相关内容