Guest User

DIR-505L OpenWrt setup guide

a guest
Apr 20th, 2014
1,659
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.89 KB | None | 0 0
  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. 2. If you successfully open an ssh connection, go to step 3. If you get a
  82. "connection refused" error, see the NOTE below.
  83. 3. It's time to set up the network. In your SSH terminal, run the following
  84. commands to set up your router's ethernet (eth1) to connect to the internet
  85. and split your router's LAN and WAN.
  86. uci set network.wan=interface
  87. uci set network.wan.proto=dhcp
  88. uci set network.wan.ifname=eth1
  89. uci del network.lan.ifname
  90. uci commit
  91. 4. Now enable wifi by running these commands.
  92. uci set wireless.@wifi-device[0].disabled=0
  93. uci commit wireless
  94. wifi
  95. 5. You can disconnect the ethernet cable from the router to your computer. Plug
  96. your internet ethernet cable into the router, and then connect to the new
  97. "OpenWrt" wifi hotspot.
  98. 6. You may have to power cycle the router, your modem, or both, but eventually
  99. you should have the internet plugged into the DIR-505L via ethernet, you
  100. should be connected to the "OpenWrt" wifi hotspot, and you should be able to
  101. use the internet. Now it's time to install the web gui, LuCI.
  102.  
  103. NOTE: If you get a "connection refused" error, wait a few minutes and try,
  104. again. It can take a few minutes for the SSH server to begin working after
  105. telnet shuts down. If you can neither connect through telnet or ssh, you may
  106. need to do a factory reset. You can try to repeat the steps to get to the
  107. EMERGENCY FLASH page, or you can use OpenWrt's built-in failsafe mode. Activate
  108. failsafe mode by repeatedly pressing the WPS button on the DIR-505L as soon as
  109. you plug it into a power outlet. Failsafe mode will ~NOT~ activate if anything
  110. is plugged into the router's ethernet port, so make sure you unplug your
  111. ethernet cable before trying to activate failsafe mode. If failsafe mode
  112. activates, the green power LED should begin to flash ~very~ rapidly. You will
  113. then need to change your ethernet adapter's IP address, similar to before. Set
  114. your IP address to 192.168.1.2 with subnet mask 255.255.255.0. You should be
  115. able to open a telnet session with 192.168.1.1. Once in failsafe mode with a
  116. telnet session open, you should follow the steps, here.
  117. http://wiki.openwrt.org/doc/howto/generic.failsafe#in.failsafe.mode
  118.  
  119. Use these commands in the telnet session to factory reset and reboot your
  120. OpenWrt router.
  121. mount_root
  122. firstboot
  123. mtd -r erase rootfs_data
  124.  
  125. When the router reboots, you'll repeat the process like you just flashed a new
  126. OpenWrt. Return your ethernet adapter settings to obtain an IP address and DNS
  127. automatically, open a telnet session, use passwd, and try to open an ssh
  128. session, again. Continue from the ssh session. If you get "connection refused",
  129. again, you may have to delete your SSH authentication certificates. On a *nix
  130. system, these might be found in the folder, "~/.ssh/". I had this problem, and I
  131. was able to connect via SSH once I deleted ~/.ssh/known_hosts.
  132.  
  133.  
  134. F. Install the web GUI, LuCI
  135. 1. You should be connected to your router via wifi. SSH to your router, located
  136. at 192.168.1.1, and run the folllowing commands to install LuCI.
  137. opkg update
  138. opkg install luci-ssl
  139. 2. When the installation is successful, run these commands to start the web gui
  140. and enable it on router boot.
  141. /etc/init.d/uhttpd start
  142. /etc/init.d/uhttpd enable
  143. 3. Open your browser to 192.168.1.1, and login to your new web GUI. We're going
  144. to update the version of OpenWrt, now by using LuCI to flash the
  145. *dir-505*-sysupgrade.bin.
  146. 4. Once logged into the web gui, go to System > Backup / Flash Firmware. Flash
  147. your *dir-505*-sysupgrade.bin, and make sure to check, "Keep settings".
  148. 5. When the firmware is flashed and the router reboots, you need to re-enable
  149. the LuCI web gui. After reconnecting to the "OpenWrt" wifi hotspot, simply
  150. open an ssh connection to your router (ssh [email protected]), and run these
  151. commands, again.
  152. opkg update
  153. opkg install luci-ssl
  154. /etc/init.d/uhttpd start
  155. /etc/init.d/uhttpd enable
  156. 6. Finally, you can exit the ssh session, point your browser to 192.168.1.1,
  157. login to your web gui, and configure your router to your liking.
  158.  
  159.  
  160. G. Set your router to reboot once per week
  161. http://www.smallbusinesstech.net/more-complicated-instructions/openwrt/configuring-openwrt-to-automatically-reboot-every-week-1
  162. 1. If you don't need the router to be connected to the internet without
  163. interruption, I recommend setting it up to reboot once per week to maintain
  164. stability. To do that, login to LuCI and browse to System > Scheduled Tasks.
  165. This page allows you to edit the crontab file. Add the following line to the
  166. scheduled tasks textbox (i.e., crontab file),
  167. 0 3 * * 0 reboot
  168. The first number denotes the minute (0-59). In this case, 0 represents the top of the hour.
  169. The second number denotes the hour (0-23). In this case, 3 represents 3 AM.
  170. 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.
  171. 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.
  172. The fifth number denotes the day of the week (0-6) beginning with Sunday. In this case, 0 represents Sunday.
  173. The final item is the command to be run. The crontab runs with root privileges, so it has power to reboot the device.
  174.  
  175.  
  176. H. Use alternate DNS servers
  177. 1. You may be interested to use alternate DNS servers instead of your default
  178. ISP ones. To do this, open up your LuCI web gui and go to
  179. Network > Interfaces > WAN > Edit > Advanced Settings. Uncheck the "Use DNS
  180. servers advertised by peer" box, and then enter whichever servers you want in
  181. the "Use custom DNS servers" box. Some recommendations include:
  182. Level 3: 4.2.2.1 and 4.2.2.2
  183. Google DNS: 8.8.8.8 and 8.8.4.4
  184. OpenDNS: 208.67.222.222 and 208.67.220.220
  185. DNS Advantage: 156.154.70.1 and 156.154.71.1
  186. Also try GRC's DNS benchmark tool.
  187. https://www.grc.com/dns/Benchmark.htm
  188.  
  189.  
  190. I. Install more packages
  191. 1. You might want to install some packages to further enhance your router's
  192. features. Useful packages might include:
  193. - UPnP (luci-app-upnp, miniupnpd)
  194. - Dynamic DNS (luci-app-ddns, ddns-scripts)
  195.  
  196.  
  197. J. Other notes
  198. 1. Some people are having problems resolving hostnames from their internal
  199. network. For instance, if they plug their network ethernet cable directly into
  200. their computer, they can access hostname "example", but if they try to connect
  201. to that hostname from their OpenWrt router, it doesn't work. Instead, they have
  202. to use the whole domain name, "example.domain.com". To fix this, people have
  203. been going to their LuCI web GUI, then to Network > DHCP and DNS. In "General
  204. Settings", uncheck "Domain required", "Authoritative", and "Rebind protection".
  205. Then in "Advanced Settings" uncheck "Filter private". I personally have this
  206. hostname resolving problem, but unchecking these options didn't fix it. It seems
  207. like it fixed a lot of other people's, though. Your mileage my vary.
Advertisement
Add Comment
Please, Sign In to add comment