如何进入 DIR-505 恢复模式
在学习OpenWrt可能要测试很多配置,有时会出现错误,需恢复或补救,这时就需要进入路由器的恢复模式
有两种方法进入 DIR-505 的恢复模式
进入D-Link 恢复模式
把 DIR-505和计算机用网线连接起来,设置计算机网卡的IPv4地址为 192.168.0.98, 子网掩码 255.255.255.0, 在路由器启动时顶住 reset 孔,当红色指示灯开始缓慢闪烁时,松开reset孔。然后浏览器打开 192.168.0.1,这里你可以上传原厂固件或刷 OpenWrt 固件
Plug in your computer to the unit, assign it an ip address of 192.168.0.98, and boot the unit up while holding down the reset. Once the red light starts to blink slowly, release the reset, and go to 192.168.0.1 on your web browser. From there you can upload a new image. After successful flashing, you'll see a "Success" page in your browser.
刷新固件完成后,重新改回自动获取IP地址
进入 OpenWrt 恢复模式
用网线将路由器和电脑连接起来,将电脑网卡的IPv4地址设置成 192.168.1.97
路由器插上电源重新开机, 在启动时多次按压路由器侧面的圆形 WPS 按钮直到 LED 指示灯开始快速闪烁
For the generic failsafe mode you can follow https://openwrt.org/zh-cn/doc/howto/generic.failsafe You can use the WPS button for that. While booting up, just press it several times until the LED flashes very quick. If you're still not able to telnet it on 192.168.1.1 maybe there's something wrong on the client-side.
接下来就是ubuntu 里 telnet 进入 OpenWrt 并设置 root 密码
telnet 192.168.1.1
telnet连上后就设置root密码,自动启用 ssh:
root@OpenWrt:/# passwd
Changing password for root
New password:
Retype password:
Password for root changed by root
root@OpenWrt:/#
可以在 Ubuntu 里 Ctrl + Shift + t 新开一个命令行窗口,尝试 ssh 连接OpenWrt:
ssh root@192.168.1.1
如果 ssh 连上了,则后面设置的内容和 前面 TLWR-2543N 翻墙教程一样了
要注意的是,D-Link DIR-505 使用接口名称 eth1 而不是通常的 eth0
Other than similar routers (e.g., the TP-Link TL-WR703N), the D-Link DIR-505 uses the interface eth1 rather than eth0. This means that if you build your own firmware, you must configure /etc/config/network accordingly (option ifname 'eth1'), or you will not be able to connect later on via Ethernet.
如果 telnet 连不上,尝试一下直接ssh登录
设置D-Link DIR-505k路由器无线连接
在没有设置无线连接前,要登录OpenWrt,必须用网线把电脑和路由器连接起来,不太方便。设置无线连接后,电脑就可以通过无线方式连上路由器,再登录 DIR-505 OpenWrt 进行设置
uci set wireless.@wifi-device[0].disabled=0;
uci set wireless.@wifi-iface[0].ssid='eastking-dir505';
uci set wireless.@wifi-iface[0].encryption='psk2+ccmp';
uci set wireless.@wifi-iface[0].key='icanfly9876';
uci commit wireless;
wifi
设置好无线连接后,就可以拔掉电脑的有线连接,连接无线,再ssh登录路由器
相关资源: