SHARE
TWEET

DIR-505L OpenWrt setup guide

a guest Apr 20th, 2014 1,181 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. How to install OpenWrt on a D-Link 505L:
  2.  
  3.  
  4. A. Download the latest D-Link 505L firmware (just in case)
  5. http://support.dlink.com/ProductInfo.aspx?m=DIR-505L
  6. (2012/10/29) ea3a0d0a dir505L_fw_101.bin
  7.  
  8.  
  9. B. Download the latest OpenWrt firmware for DIR-505L
  10. http://downloads.openwrt.org/snapshots/trunk/ar71xx/
  11. (2014/04/17) 99e289c3 OpenWrt-ar71xx-generic-dir-505-a1-squashfs-factory.bin
  12. (2014/04/17) 9f041f8b OpenWrt-ar71xx-generic-dir-505-a1-squashfs-sysupgrade.bin
  13.  
  14.  
  15. C. Restart the router and flash the firmware in emergency restore mode
  16. http://forums.dlink.com/index.php?topic=44909.msg162511#msg162511
  17. 1. Make sure the router is unplugged.
  18. 2. Plug an ethernet cable from your router to your computer
  19. 3. Set your PC to have a static IP of 192.168.0.2 and subnet mask of 255.255.255.0
  20.    - Control Panel -> Network and Internet -> Network Connections
  21.    - Right click on your ethernet adapter -> Properties
  22.    - TCP/IPv4 -> Properties
  23.    - IP address: 192.168.0.2
  24.    - Subnet mask: 255.255.255.0
  25.    - Default gateway: blank
  26.    - Preferred DNS server: blank
  27.    - Alternate DNS server: blank
  28. 4. Press and hold the RESET button of the DIR-505L for ~5 seconds. Continue
  29.    holding the RESET button, and plug the router into a power outlet.
  30.    Continue holding the RESET button for ~10 seconds, or so, then let go.
  31. 5. Open a web browser to 192.168.0.1. You should see an EMERGENCY FLASHING page.
  32.    Click browse/upload, locate the *dir-505*-factory.bin, and upload it. If the
  33.    firmware is note accepted, see the NOTE below.
  34. 6. Give the router ~several~ minutes to flash the firmware. When it's done,
  35.    unplug the router from the power outlet. Don't unplug the ethernet cable yet,
  36.    we will need to communicate with the router via ethernet cable until we can
  37.    turn the wifi on in the OpenWrt settings.
  38. 7. Go back to your TCP/IPv4 properties and set your settings back to "Obtain an
  39.    IP address automatically", and "Obtain DNS server address automatically".
  40.    Plug the router back into the power outlet.
  41. 8. Open up a commandline window and try to "ping 192.168.1.1". If you get a
  42.    response, we can communicate with the router. Onto the next step.
  43.  
  44. NOTE: If the firmware is not accepted, you may have to slightly hex edit the
  45. OpenWrt *dir-505*-factory.bin. If you open the official firmware in a hex editor
  46. (dir505L_fw_101.bin), you will notice that it says, "505LA1" somewhere around
  47. hex offset 0x30. That is your model number. If you look at the same offset in
  48. your OpenWrt firmware (*dir-505*-factory.bin), you will notice it says, "505A1",
  49. instead. This is an older model number. Simply change the "505A1" into a
  50. "505LA1". See below for an example.
  51.  
  52. dir505L_fw_101.bin:
  53. 0x0030      52 35 30 35 4C 41 31 2D 33 00 00 00 00 00 44 45     R505LA1-3.....DE
  54.  
  55. (old) *dir-505*-factory.bin:
  56. 0x0030      52 35 30 35 41 31 2D 33 00 00 00 00 00 00 44 45     R505A1-3......DE
  57.  
  58. (new) *dir-505*-factory.bin:
  59. 0x0030      52 35 30 35 4C 41 31 2D 33 00 00 00 00 00 44 45     R505LA1-3.....DE
  60.  
  61.  
  62. D. Open a telnet session with your router
  63. http://wiki.openwrt.org/doc/howto/firstlogin
  64. 1. Open up a commandline window and do,
  65.        telnet 192.168.1.1
  66. 2. If you connect to the router, set a new password for root by typing,
  67.        passwd
  68. 3. Once your new password is set, telnet will be disabled and ssh will be
  69.    enabled. Go ahead and type "exit" to quit your telnet session, and then open
  70.    up a new ssh session with 192.168.1.1 using your favorite SSH client/utility.
  71.  
  72.  
  73. E. Open an SSH session with your router and configure the network
  74. http://wiki.openwrt.org/doc/howto/firstlogin
  75. http://wiki.openwrt.org/doc/howto/basic.config
  76. http://wiki.openwrt.org/doc/uci/wireless
  77. http://wiki.openwrt.org/doc/howto/internet.connection
  78. http://wiki.openwrt.org/doc/uci/network
  79. http://wiki.openwrt.org/doc/howto/luci.essentials
  80. 1. Open a new ssh session with 192.168.1.1 as user root,
  81.        ssh root@192.168.1.1
  82. 2. If you successfully open an ssh connection, go to step 3. If you get a
  83.    "connection refused" error, see the NOTE below.
  84. 3. It's time to set up the network. In your SSH terminal, run the following
  85.    commands to set up your router's ethernet (eth1) to connect to the internet
  86.    and split your router's LAN and WAN.
  87.        uci set network.wan=interface
  88.        uci set network.wan.proto=dhcp
  89.        uci set network.wan.ifname=eth1
  90.        uci del network.lan.ifname
  91.        uci commit
  92. 4. Now enable wifi by running these commands.
  93.        uci set wireless.@wifi-device[0].disabled=0
  94.        uci commit wireless
  95.        wifi
  96. 5. You can disconnect the ethernet cable from the router to your computer. Plug
  97.    your internet ethernet cable into the router, and then connect to the new
  98.    "OpenWrt" wifi hotspot.
  99. 6. You may have to power cycle the router, your modem, or both, but eventually
  100.    you should have the internet plugged into the DIR-505L via ethernet, you
  101.    should be connected to the "OpenWrt" wifi hotspot, and you should be able to
  102.    use the internet. Now it's time to install the web gui, LuCI.
  103.  
  104. NOTE: If you get a "connection refused" error, wait a few minutes and try,
  105. again. It can take a few minutes for the SSH server to begin working after
  106. telnet shuts down. If you can neither connect through telnet or ssh, you may
  107. need to do a factory reset. You can try to repeat the steps to get to the
  108. EMERGENCY FLASH page, or you can use OpenWrt's built-in failsafe mode. Activate
  109. failsafe mode by repeatedly pressing the WPS button on the DIR-505L as soon as
  110. you plug it into a power outlet. Failsafe mode will ~NOT~ activate if anything
  111. is plugged into the router's ethernet port, so make sure you unplug your
  112. ethernet cable before trying to activate failsafe mode. If failsafe mode
  113. activates, the green power LED should begin to flash ~very~ rapidly. You will
  114. then need to change your ethernet adapter's IP address, similar to before. Set
  115. your IP address to 192.168.1.2 with subnet mask 255.255.255.0. You should be
  116. able to open a telnet session with 192.168.1.1. Once in failsafe mode with a
  117. telnet session open, you should follow the steps, here.
  118. http://wiki.openwrt.org/doc/howto/generic.failsafe#in.failsafe.mode
  119.  
  120. Use these commands in the telnet session to factory reset and reboot your
  121. OpenWrt router.
  122. mount_root
  123. firstboot
  124. mtd -r erase rootfs_data
  125.  
  126. When the router reboots, you'll repeat the process like you just flashed a new
  127. OpenWrt. Return your ethernet adapter settings to obtain an IP address and DNS
  128. automatically, open a telnet session, use passwd, and try to open an ssh
  129. session, again. Continue from the ssh session. If you get "connection refused",
  130. again, you may have to delete your SSH authentication certificates. On a *nix
  131. system, these might be found in the folder, "~/.ssh/". I had this problem, and I
  132. was able to connect via SSH once I deleted ~/.ssh/known_hosts.
  133.  
  134.  
  135. F. Install the web GUI, LuCI
  136. 1. You should be connected to your router via wifi. SSH to your router, located
  137.    at 192.168.1.1, and run the folllowing commands to install LuCI.
  138.        opkg update
  139.        opkg install luci-ssl
  140. 2. When the installation is successful, run these commands to start the web gui
  141.    and enable it on router boot.
  142.        /etc/init.d/uhttpd start
  143.        /etc/init.d/uhttpd enable
  144. 3. Open your browser to 192.168.1.1, and login to your new web GUI. We're going
  145.    to update the version of OpenWrt, now by using LuCI to flash the
  146.    *dir-505*-sysupgrade.bin.
  147. 4. Once logged into the web gui, go to System > Backup / Flash Firmware. Flash
  148.    your *dir-505*-sysupgrade.bin, and make sure to check, "Keep settings".
  149. 5. When the firmware is flashed and the router reboots, you need to re-enable
  150.    the LuCI web gui. After reconnecting to the "OpenWrt" wifi hotspot, simply
  151.    open an ssh connection to your router (ssh root@192.168.1.1), and run these
  152.    commands, again.
  153.        opkg update
  154.        opkg install luci-ssl
  155.        /etc/init.d/uhttpd start
  156.        /etc/init.d/uhttpd enable
  157. 6. Finally, you can exit the ssh session, point your browser to 192.168.1.1,
  158.    login to your web gui, and configure your router to your liking.
  159.  
  160.  
  161. G. Set your router to reboot once per week
  162. http://www.smallbusinesstech.net/more-complicated-instructions/openwrt/configuring-openwrt-to-automatically-reboot-every-week-1
  163. 1. If you don't need the router to be connected to the internet without
  164.    interruption, I recommend setting it up to reboot once per week to maintain
  165.    stability. To do that, login to LuCI and browse to System > Scheduled Tasks.
  166.    This page allows you to edit the crontab file. Add the following line to the
  167.    scheduled tasks textbox (i.e., crontab file),
  168.        0 3 * * 0 reboot
  169.    The first number denotes the minute (0-59). In this case, 0 represents the top of the hour.
  170.    The second number denotes the hour (0-23). In this case, 3 represents 3 AM.
  171.    The third number denotes the day of the month (1-31). In this case, * matches any day of the month, so this field is ignored.
  172.    The fourth number denotes the month of the year (1-12). In this case, * matches any day of the month, so this field is ignored.
  173.    The fifth number denotes the day of the week (0-6) beginning with Sunday. In this case, 0 represents Sunday.
  174.    The final item is the command to be run. The crontab runs with root privileges, so it has power to reboot the device.
  175.  
  176.  
  177. H. Use alternate DNS servers
  178. 1. You may be interested to use alternate DNS servers instead of your default
  179.    ISP ones. To do this, open up your LuCI web gui and go to
  180.    Network > Interfaces > WAN > Edit > Advanced Settings. Uncheck the "Use DNS
  181.    servers advertised by peer" box, and then enter whichever servers you want in
  182.    the "Use custom DNS servers" box. Some recommendations include:
  183.        Level 3: 4.2.2.1 and 4.2.2.2
  184.        Google DNS: 8.8.8.8 and 8.8.4.4
  185.        OpenDNS: 208.67.222.222 and 208.67.220.220
  186.        DNS Advantage: 156.154.70.1 and 156.154.71.1
  187.    Also try GRC's DNS benchmark tool.
  188.    https://www.grc.com/dns/Benchmark.htm
  189.  
  190.  
  191. I. Install more packages
  192. 1. You might want to install some packages to further enhance your router's
  193.    features. Useful packages might include:
  194.        - UPnP (luci-app-upnp, miniupnpd)
  195.        - Dynamic DNS (luci-app-ddns, ddns-scripts)
  196.  
  197.  
  198. J. Other notes
  199. 1. Some people are having problems resolving hostnames from their internal
  200. network. For instance, if they plug their network ethernet cable directly into
  201. their computer, they can access hostname "example", but if they try to connect
  202. to that hostname from their OpenWrt router, it doesn't work. Instead, they have
  203. to use the whole domain name, "example.domain.com". To fix this, people have
  204. been going to their LuCI web GUI, then to Network > DHCP and DNS. In "General
  205. Settings", uncheck "Domain required", "Authoritative", and "Rebind protection".
  206. Then in "Advanced Settings" uncheck "Filter private". I personally have this
  207. hostname resolving problem, but unchecking these options didn't fix it. It seems
  208. like it fixed a lot of other people's, though. Your mileage my vary.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top