OpenWrt Forum Archive

Topic: D-link DIR-505 support?

The content of this topic has been archived between 2 Apr 2018 and 5 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

@chevron

i am new to openwrt, I was wondering whats the difference between squashfs-factory and the system-upgrade.bin?

i have been flashing a few times today, but i am not sure if i was following proper instructions.

as far as i understand i should flash squashfs first and then login to telnet to enable luci.

Is this correct? after i enable luci, should i flash the system-upgarde.bin?

Thanks in advance.

chevron wrote:

What do you mean by editing? You can use the A1 snapshot without any editing
http://downloads.openwrt.org/snapshots/ … actory.bin for first install and http://downloads.openwrt.org/snapshots/ … pgrade.bin for sysupgrade.

Those images are not accepted as valid images on the 505L. The header in the factory 505L images has an "L" in it, and if I add the L to the 505 trunk firmware, it accepts it and flashes it.

Regarding the emergency flash procedure, is there anything that I'm missing? I'll try the static IP address later, but I expected DHCP to give me an address admittedly.

PradeepVizz wrote:

I was wondering whats the difference between squashfs-factory and the system-upgrade.bin?

The squashfs-factory.bin is used when flashing the router from its factory firmware to openwrt. The system-upgrade.bin is used when updating openwrt to a later revision.

chrisheacock wrote:

Those images are not accepted as valid images on the 505L. The header in the factory 505L images has an "L" in it, and if I add the L to the 505 trunk firmware, it accepts it and flashes it.

Strange, on my DIR-505L rev. A2 I didn't have to do that. Which revision is your device?

chrisheacock wrote:

Regarding the emergency flash procedure, is there anything that I'm missing? I'll try the static IP address later, but I expected DHCP to give me an address admittedly.

Regarding the docs dnsmasq deamon should be running and giving connected clients IPs from 192.168.1.100 from 192.168.1.250. If dhcp fails for some reason, try giving your client a static IP and then try to ping it. If your device responds to pings, you should be able to telnet it.

(Last edited by chevron on 11 Apr 2014, 17:03)

chevron wrote:

Strange, on my DIR-505L rev. A2 I didn't have to do that. Which revision is your device?

I have a rev A1 device.

chevron wrote:

Regarding the docs dnsmasq deamon should be running and giving connected clients IPs from 192.168.1.100 from 192.168.1.250. If dhcp fails for some reason, try giving your client a static IP and then try to ping it. If your device responds to pings, you should be able to telnet it.

When I plug the cable into the port, the green light comes on on the 505, but with a static address of 192.168.1.5, 192.168.1.1 is not pingable and does not respond to telnet on port 23. THe 505 is linking at 100Mbit, but that's all I can confirm at this point.

I would like to try flashing another firmware, but I can't get the emergency flash procedure to operate as expected, so I'm pretty much dead in the water at this point.

Any help is appreciated. Thanks again!

Okay, you have two options. D-Link recovery and OpenWRT Generic Failsafe Mode.

For the D-Link recovery you have to press reset while powering the DIR-505 up. After that you can open http://192.168.0.1 where you can upload the original D-Link Firmware or an OpenWRT bin. This procedure is described here http://wiki.openwrt.org/toh/d-link/dir-505#debricking.

For the generic failsafe mode you can follow http://wiki.openwrt.org/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. May I ask which operating system you are using?

In OS-X for example, you can rearrange the priority of the interfaces. Usually I'm connected via WiFi and the IP 192.168.0.x. My ethernet (non-WiFi) interface is in the 192.168.1.x range. Each interface needs to get its own gateway and dns setting, lets say 192.168.0.1 for wifi and 192.168.1.1 for ethernet. However, sometimes this doesn't work. So when I try to reach the DIR-505 from my browser or from the terminal, I get a "No route to host" error message. After changing the interface priority (ethernet over wifi) it works. Maybe this helps you, though I don't know how this is done with windows.

chevron wrote:

Okay, you have two options. D-Link recovery and OpenWRT Generic Failsafe Mode.

From personal experience, OpenWrt failsafe does not work on DIR-505. It initializes, and the LED starts blinking fast, but the router does not reply on the LAN port. The Emergency Recovery might be the only option.

Edit October 2014: This has been fixed in the meantime, with Barrier Breaker 14.07, failsafe works perfectly fine.

(Last edited by metai on 31 Oct 2014, 17:44)

Okay, then OpenWRT seems to be messed up. Did you succeed with D-Link recovery?

chevron wrote:

Okay, then OpenWRT seems to be messed up. Did you succeed with D-Link recovery?

Negative. As I mentioned earlier, I can get the unit into an apparent emergency recovery mode where the LED flashes red 2 seonds, off one second. Once it's doing that, I set the IP of my PC to 192.168.0.10 and the interface comes up. I can never ping 192.168.0.1 nor can I reach a web interface. I've tried multiple times and veried various things to get something to happen. I put a switch between my pc and the 505, which didn't change anything, and I've run wireshark while connecting, and power cycling the 505, and cannot see it doing anything that gives me any clues.

I'm just about to call D-Link support but I feel like I"ll be chasing my tail on that endeavor. smile

Thanks for not giving up on me yet!!

Just an update for anyone else who may have a similar issue. It seems that the static IP addressing I was doing on my test machine was being somehow wrecked by the virtualization layer in the network adapter. Everything looked good in the network config and wireshark, but somewhere in the network subsystem, it was not operable.

I switched to a different machine and everything started working as expected.

Thanks to everyone for all for the help!

Alright. I just bought a DIR-505L on a whim because it was cheap ($25) and because I saw I could install OpenWrt on it, from this thread. There are three versions of this thing, as far as I've been able to tell by Googling. These are:

  • DIR-505LA1 - This is what I got. It's the current standard US model.

  • DIR-505LA2 - Judging from what I've read, this is identical to the US model, but it has exchangeable electric plugs for the European market

  • DIR-505 - This is the older model. It doesn't have the "Charger" mode on the side.

Now, I've installed DD-WRT on a couple routers in the past, but that was cakewalk compared to OpenWrt. I've never used OpenWrt, before, so this was my first time trying to get it installed. After screwing up the network settings multiple times requiring factory resets/reflashing, I made a guide for myself and my friends on how to get OpenWrt up and running on this little device. I figured that since I already made the guide for my own use, I might as well post it here for others who are new to OpenWrt. I'm happy to say that this thing is up-and-running perfectly for my setup; but even if you have a complicated environment for yours, by the time you finish my guide, you should be in a good position to understand how to setup and configure your new OpenWrt DIR-505L device.

I actually wrote my guide just as a simple .txt (which I've uploaded to pastebin), but I'll try to reformat it with BBCode for the forums, here.

EDIT: Oh, and if anyone wants to know what the throughput on this little thing is, here are some of my speedtest results.

Ethernet cable plugged directly into my computer:
http://www.speedtest.net/result/3445742161.png

Ethernet cable plugged into my router; my computer connected via 802.11n wifi:
http://www.speedtest.net/result/3445739156.png


-----------------------------

How to install OpenWrt on a D-Link 505L:

A. Download the latest D-Link 505L firmware (just in case)

(2012/10/29) ea3a0d0a dir505L_fw_101.bin


B. Download the latest OpenWrt firmware for DIR-505L

(2014/04/17) 99e289c3 OpenWrt-ar71xx-generic-dir-505-a1-squashfs-factory.bin
(2014/04/17) 9f041f8b OpenWrt-ar71xx-generic-dir-505-a1-squashfs-sysupgrade.bin


C. Restart the router and flash the firmware in emergency restore mode
  1. Make sure the router is unplugged.

  2. Plug an ethernet cable from your router to your computer

  3. Set your PC to have a static IP of 192.168.0.2 and subnet mask of 255.255.255.0
        - Control Panel -> Network and Internet -> Network Connections
        - Right click on your ethernet adapter -> Properties
        - TCP/IPv4 -> Properties
        - IP address: 192.168.0.2
        - Subnet mask: 255.255.255.0
        - Default gateway: blank
        - Preferred DNS server: blank
        - Alternate DNS server: blank

  4. Press and hold the RESET button of the DIR-505L for ~5 seconds. Continue holding the RESET button, and plug the router into a power outlet. Continue holding the RESET button for ~10 seconds, or so, then let go.

  5. Open a web browser to 192.168.0.1. You should see an EMERGENCY FLASHING page. Click browse/upload, locate the *dir-505*-factory.bin, and upload it. If the firmware is note accepted, see the NOTE below.

  6. Give the router ~several~ minutes to flash the firmware. When it's done, unplug the router from the power outlet. Don't unplug the ethernet cable yet, we will need to communicate with the router via ethernet cable until we can turn the wifi on in the OpenWrt settings.

  7. Go back to your TCP/IPv4 properties and set your settings back to "Obtain an IP address automatically", and "Obtain DNS server address automatically". Plug the router back into the power outlet.

  8. Open up a commandline window and try to "ping 192.168.1.1". If you get a response, we can communicate with the router. Onto the next step.

NOTE: If the firmware is not accepted, you may have to slightly hex edit the OpenWrt *dir-505*-factory.bin. If you open the official firmware in a hex editor (dir505L_fw_101.bin), you will notice that it says, "505LA1" somewhere around hex offset 0x30. That is your model number. If you look at the same offset in your OpenWrt firmware (*dir-505*-factory.bin), you will notice it says, "505A1", instead. This is an older model number. Simply change the "505A1" into a "505LA1". See below for an example.

dir505L_fw_101.bin:

0x0030      52 35 30 35 4C 41 31 2D 33 00 00 00 00 00 44 45     R505LA1-3.....DE

(old) *dir-505*-factory.bin:

0x0030      52 35 30 35 41 31 2D 33 00 00 00 00 00 00 44 45     R505A1-3......DE

(new) *dir-505*-factory.bin:

0x0030      52 35 30 35 4C 41 31 2D 33 00 00 00 00 00 44 45     R505LA1-3.....DE

D. Open a telnet session with your router
  1. Open up a commandline window and do,
           telnet 192.168.1.1

  2. If you connect to the router, set a new password for root by typing,
           passwd

  3. Once your new password is set, telnet will be disabled and ssh will be enabled. Go ahead and type "exit" to quit your telnet session, and then open up a new ssh session with 192.168.1.1 using your favorite SSH client/utility.


E. Open an SSH session with your router and configure the network
  1. Open a new ssh session with 192.168.1.1 as user root,
           ssh root@192.168.1.1

  2. If you successfully open an ssh connection, go to step 3. If you get a "connection refused" error, see the NOTE below.

  3. It's time to set up the network. In your SSH terminal, run the following commands to set up your router's ethernet (eth1) to connect to the internet and split your router's LAN and WAN.
           uci set network.wan=interface
           uci set network.wan.proto=dhcp
           uci set network.wan.ifname=eth1
           uci del network.lan.ifname
           uci commit

  4. Now enable wifi by running these commands.
           uci set wireless.@wifi-device[0].disabled=0
           uci commit wireless
           wifi

  5. You can disconnect the ethernet cable from the router to your computer. Plug your internet ethernet cable into the router, and then connect to the new "OpenWrt" wifi hotspot.

  6. You may have to power cycle the router, your modem, or both, but eventually you should have the internet plugged into the DIR-505L via ethernet, you should be connected to the "OpenWrt" wifi hotspot, and you should be able to use the internet. Now it's time to install the web gui, LuCI.

NOTE: If you get a "connection refused" error, wait a few minutes and try, again. It can take a few minutes for the SSH server to begin working after telnet shuts down. If you can neither connect through telnet or ssh, you may need to do a factory reset. You can try to repeat the steps to get to the EMERGENCY FLASH page, or you can use OpenWrt's built-in failsafe mode. Activate failsafe mode by repeatedly pressing the WPS button on the DIR-505L as soon as you plug it into a power outlet. Failsafe mode will ~NOT~ activate if anything is plugged into the router's ethernet port, so make sure you unplug your ethernet cable before trying to activate failsafe mode. If failsafe mode activates, the green power LED should begin to flash ~very~ rapidly. You will then need to change your ethernet adapter's IP address, similar to before. Set your IP address to 192.168.1.2 with subnet mask 255.255.255.0. You should be able to open a telnet session with 192.168.1.1. Once in failsafe mode with a telnet session open, you should follow the steps, here.
http://wiki.openwrt.org/doc/howto/gener … lsafe.mode

Use these commands in the telnet session to factory reset and reboot your OpenWrt router.
    mount_root
    firstboot
    mtd -r erase rootfs_data

When the router reboots, you'll repeat the process like you just flashed a new OpenWrt. Return your ethernet adapter settings to obtain an IP address and DNS automatically, open a telnet session, use passwd, and try to open an ssh session, again. Continue from the ssh session. If you get "connection refused", again, you may have to delete your SSH authentication certificates. On a *nix system, these might be found in the folder, "~/.ssh/". I had this problem, and I was able to connect via SSH once I deleted ~/.ssh/known_hosts.


F. Install the web GUI, LuCI
  1. You should be connected to your router via wifi. SSH to your router, located at 192.168.1.1, and run the folllowing commands to install LuCI.
           opkg update
           opkg install luci-ssl

  2. When the installation is successful, run these commands to start the web gui and enable it on router boot.
           /etc/init.d/uhttpd start
           /etc/init.d/uhttpd enable

  3. Open your browser to 192.168.1.1, and login to your new web GUI. We're going to update the version of OpenWrt, now by using LuCI to flash the *dir-505*-sysupgrade.bin.

  4. Once logged into the web gui, go to System > Backup / Flash Firmware. Flash your *dir-505*-sysupgrade.bin, and make sure to check, "Keep settings".

  5. When the firmware is flashed and the router reboots, you need to re-enable the LuCI web gui. After reconnecting to the "OpenWrt" wifi hotspot, simply open an ssh connection to your router (ssh root@192.168.1.1), and run these commands, again.
           opkg update
           opkg install luci-ssl
           /etc/init.d/uhttpd start
           /etc/init.d/uhttpd enable

  6. Finally, you can exit the ssh session, point your browser to 192.168.1.1, login to your web gui, and configure your router to your liking.


G. Set your router to reboot once per week
  1. If you don't need the router to be connected to the internet without interruption, I recommend setting it up to reboot once per week to maintain stability. To do that, login to LuCI and browse to System > Scheduled Tasks. This page allows you to edit the crontab file. Add the following line to the scheduled tasks textbox (i.e., crontab file),
           0 3 * * 0 reboot

  • The first number denotes the minute (0-59). In this case, 0 represents the top of the hour.

  • The second number denotes the hour (0-23). In this case, 3 represents 3 AM.

  • 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.

  • 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.

  • The fifth number denotes the day of the week (0-6) beginning with Sunday. In this case, 0 represents Sunday.

  • The final item is the command to be run. The crontab runs with root privileges, so it has power to reboot the device.


H. Use alternate DNS servers
  1. You may be interested to use alternate DNS servers instead of your default ISP ones. To do this, open up your LuCI web gui and go to Network > Interfaces > WAN > Edit > Advanced Settings. Uncheck the "Use DNS servers advertised by peer" box, and then enter whichever servers you want in the "Use custom DNS servers" box. Some recommendations include:
        Level 3: 4.2.2.1 and 4.2.2.2
        Google DNS: 8.8.8.8 and 8.8.4.4
        OpenDNS: 208.67.222.222 and 208.67.220.220
        DNS Advantage: 156.154.70.1 and 156.154.71.1

  2. Also try GRC's DNS benchmark tool.
        https://www.grc.com/dns/Benchmark.htm


I. Install more packages
  1. You might want to install some packages to further enhance your router's features. Useful packages might include:
        - UPnP (luci-app-upnp, miniupnpd)
        - Dynamic DNS (luci-app-ddns, ddns-scripts)


J. Other Notes
  1. Some people are having problems resolving hostnames from their internal network. For instance, if they plug their network ethernet cable directly into their computer, they can access hostname "example", but if they try to connect to that hostname from their OpenWrt router, it doesn't work. Instead, they have to use the whole domain name, "example.domain.com". To fix this, people have been going to their LuCI web GUI, then to Network > DHCP and DNS. In General Settings, uncheck Domain required, Authoritative, and Rebind protection. Then in Advanced Settings uncheck Filter private. I personally have this hostname resolving problem, but unchecking these options didn't fix it. It seems like it fixed a lot of other people's, though. Your mileage my vary.

(Last edited by masamunecyrus on 20 Apr 2014, 22:56)

Has anyone tried connecting a USB to serial adapter to the DIR-505 host USB port?  Does it suffer from the same USB problem that is seen in devices based on the ar9331 (ar9331's usb stability issue)?  The ar9331 USB will often hang when a full speed device is connected and the radio PLL is relocking, as would happen when scanning channels.  Oddly this problem doesn't occur when a high speed USB device is connected.

Apparently the ar1311 that is used in the DIR-505 is very similar, if not identical, to the ar9331.  However the ar1311 seems to have been released later, so I'm wondering if Atheros fixed the USB problem.

Thanks!

galens wrote:

Has anyone tried connecting a USB to serial adapter to the DIR-505 host USB port?  Does it suffer from the same USB problem that is seen in devices based on the ar9331 (ar9331's usb stability issue)?  The ar9331 USB will often hang when a full speed device is connected and the radio PLL is relocking, as would happen when scanning channels.  Oddly this problem doesn't occur when a high speed USB device is connected.

Apparently the ar1311 that is used in the DIR-505 is very similar, if not identical, to the ar9331.  However the ar1311 seems to have been released later, so I'm wondering if Atheros fixed the USB problem.

FYI, a friend has tried a USB to serial adapter on a D-Link DIR-505 running OpenWRT, and it exhibits the same USB problem.  Thus it appears that the AR1311 has the same USB problem as the AR9331.

galen

masamunecyrus wrote:

Alright. I just bought a DIR-505L on a whim because it was cheap ($25) and because I saw I could install OpenWrt on it, from this thread. There are three versions of this thing, as far as I've been able to tell by Googling. These are: ...

Very nice step by step tutorial. Thank you for sharing.

By the way, I am starting a new home project myself using the DIR-505. The goal is to transform my DIR505 into a NAS/ROUTER portable.

I started flashing my router with the OpenWRT. Success!
Now I am studying linux/network configuration to manage to understand how each network topology is built. It is not easy as I thought.

The next pratical step would be to replicate all the stock firmware router modes (AP <-> Repeater <-> Wifi Hotspot) in OpenWRT.
At this point I did not manage to configure any network different from the basic (DIR505 connected to the internet by ethernet cable and sharing the internet connection in WIFI AP).
Anyone knows how to setup one repeater configuration via UCI commands? And how about Wifi hotspot?

The next steps would be configure the router switch to run the configuration script. Anyone knows how to do that?

(Last edited by spam-toaster on 13 Jun 2014, 16:44)

I have a high definition webcam hung on the USB port OK.  It uses a lot of bandwidth.


BusyBox v1.19.4 (2014-04-22 12:35:18 PDT) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
|       |.-----.-----.-----.|  |  |  |.----.|  |_
|   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
|_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
-----------------------------------------------------
BARRIER BREAKER (Bleeding Edge, r40569)
-----------------------------------------------------
  * 1/2 oz Galliano         Pour all ingredients into
  * 4 oz cold Coffee        an irish coffee mug filled
  * 1 1/2 oz Dark Rum       with crushed ice. Stir.
  * 2 tsp. Creme de Cacao
-----------------------------------------------------
root@OpenWrt:~# lsusb
Bus 001 Device 002: ID 0ac8:3420 Z-Star Microelectronics Corp. Venus USB2.0 Camera
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@OpenWrt:~# uptime
09:27:12 up 2 days, 23:56,  load average: 0.08, 0.05, 0.05

Ops

I need help hmm

I'm following the guide of masamunecyrus.... Probably i shulden't becouse i really don't have a clue of what i'm doing hmm
The guide is really well made, it's my foult.


I'm blocked in point E.

I set a password in telnet but this password is not recognised in putty (ssh client).

So i can't go on. I'm doing something wrong?
Putty ask me the ssh root password.... I type the password written in telnet, but putty denied acces for wrong password


Edit:
I've done a reset, open telnet again and set a new password, but once again the password in denied



By the way...
I was following this procedure in the hope to improve a ftp connection with USB HOST...

Have i any possibilities to do that?

(Last edited by Ganzdroid on 14 Jun 2014, 16:23)

Ganzdroid wrote:

I set a password in telnet but this password is not recognised in putty (ssh client).

The fact that you're able to connect via telnet and use the passwd command makes me think that you should be able to connect with ssh. Is it possible there's an issue somewhere in your Putty settings? Maybe double-check that you're trying to connect as user root. Also, I had a problem with my ssh using an older encryption key that no longer worked after I factory reset my DIR-505L. I had to delete my old encryption key so that I could use the new one upon connection. See if you can't delete the encryption keys somewhere in Putty, and try to reconnect.

galens wrote:
galens wrote:

Has anyone tried connecting a USB to serial adapter to the DIR-505 host USB port?  Does it suffer from the same USB problem that is seen in devices based on the ar9331 (ar9331's usb stability issue)?  The ar9331 USB will often hang when a full speed device is connected and the radio PLL is relocking, as would happen when scanning channels.  Oddly this problem doesn't occur when a high speed USB device is connected.

Apparently the ar1311 that is used in the DIR-505 is very similar, if not identical, to the ar9331.  However the ar1311 seems to have been released later, so I'm wondering if Atheros fixed the USB problem.

FYI, a friend has tried a USB to serial adapter on a D-Link DIR-505 running OpenWRT, and it exhibits the same USB problem.  Thus it appears that the AR1311 has the same USB problem as the AR9331.

galen

Isn't the solution to use a USB 2.0 hub?

Quite late to answer this, I know, but:

Ganzdroid wrote:

Putty ask me the ssh root password.... I type the password written in telnet, but putty denied acces for wrong password

I have seen this behaviour before. You probably initially flashed the "sysupgrade" image by accident. The first image to be flashed should always be the "factory" image. Get current images, go through the emergency flash again, this time with the "factory" image.

If anyone is wondering, the DIR-505LA1 works fine with r41391.

Hello,
I am wondering if any one could help me out. I am thinking of using this little guy with a NAC. (Packet Fence)
I have a couple of questions, will this work with hostapd?
Does it support 802.1q?
Does it allow Dynamic VLAN assignments?

Just a few..

hmmm anything wrong with the current trunk version?  I made the hex modification as shown.  The emergency flash interface says the flash is successful.  When the device comes up there is no wifi network and I can't ping 192.168.1.1 from the ethernet(even if I manually set an IP on my computer of 192.168.1.2).

Anyone have any thoughts.  This is probably the 3rd device I've flashed with OpenWRT and I've never had these problems.

Plug it out some minutes.
You made configuration of your network-card?
You need to setup fix IP. DHCP doesn't work.
Read careful #185

For me it worked after plug out the router some minutes

thanks.  I did set a static IP on my computer's NIC of 192.168.1.2.  It still doesn't work.  I've done this dance a couple times now.  I tried the WPS button pressing to try and get it in to failsafe mode, but that doesn't affect the LED, so I'm thinking something might be up with the current version in trunk?

Ok, so I got this working after many flashes.   It took me a couple hex editors and two operating systems.  The thing that wasn't apparent to me is that the number of  periods/dots/etc between the two pieces of text is somehow important(maybe for image size or offsets of various pieces of code).  Make sure that after you edit the hex for the right model number that you have the right number of periods/dots/nulls between the two pieces of text.

Hallo,
I´m looking for a router to use as webradio. Is it possible to use the modeswitch on the 505 to switch between radiostations?
regards Michael