OpenWrt Forum Archive

Topic: Need help for d-link DIR-300 rev. B1

The content of this topic has been archived between 2 Oct 2014 and 6 Sep 2015. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Thanks for the patch.

Hi there,

I'm following this thread with great attention to see if the solution for my RA3050 router comes along.
The routers I've got are some OEM boxes branded "KÖNIG", type CMP-WNAP20. They have a WAN-, only one LAN-port and no USB. 16MB RAM and 8MB flash. There is a pinheader onboard to easily connect a serial port buffer. They are sold rather cheap and the vendor still has pleny of them in stock.
I photographed one of them. Please have look on http://www.xs4all.nl/~mlf/RT3050/ and tell me if you recognise it. Maybe it's sold under another name too.

I've flashed them with all available flavors of firmware. DD-WRT works quite well but I really want to use OpenWrt cause I want to use it as more than just a router.
However, I cannot get the WAN-port to work using OpenWrt. What ever patch I tried (like the RT3.5 patch) there's no communication over WAN.
I compiled-in tcpdump. I can see the packets arrive and the device even tries to answer to the who-is and ping requests but nothing comes out. The only packets coming out of the WAN-port I can see are some multicast announcements but nothing else.

Is there anyone who can give me a valuable hint on this? And/or is someone willing to investigate it? I can make a setup next week that lets you telnet to the serial port.

I hope I can get my fingers behind it soon because I have great plans with these boxes.

BTW: I don't care about wireless yet. I can wait till there's more development done on that.

Cheers,

Erik

Zanzani wrote:

Hi there,

I'm following this thread with great attention to see if the solution for my RA3050 router comes along.
The routers I've got are some OEM boxes branded "KÖNIG", type CMP-WNAP20. They have a WAN-, only one LAN-port and no USB. 16MB RAM and 8MB flash. There is a pinheader onboard to easily connect a serial port buffer. They are sold rather cheap and the vendor still has pleny of them in stock.
I photographed one of them. Please have look on http://www.xs4all.nl/~mlf/RT3050/ and tell me if you recognise it. Maybe it's sold under another name too.

I've flashed them with all available flavors of firmware. DD-WRT works quite well but I really want to use OpenWrt cause I want to use it as more than just a router.
However, I cannot get the WAN-port to work using OpenWrt. What ever patch I tried (like the RT3.5 patch) there's no communication over WAN.
I compiled-in tcpdump. I can see the packets arrive and the device even tries to answer to the who-is and ping requests but nothing comes out. The only packets coming out of the WAN-port I can see are some multicast announcements but nothing else.

Is there anyone who can give me a valuable hint on this? And/or is someone willing to investigate it? I can make a setup next week that lets you telnet to the serial port.

I hope I can get my fingers behind it soon because I have great plans with these boxes.

BTW: I don't care about wireless yet. I can wait till there's more development done on that.

Cheers,

Erik

The switch driver for rt305x (ramips_esw) currently has the VLANs hard-coded, as there is no swconfig support yet in ramips (to configure the VLANs).  So if your router ports are configured differently than the default (which is LLLL/W for the dir-300 and fonera 2.0n), then your WAN either will be on wrong port or not available at all... this was the case with my router (HW550-3G, which is W/LLLL).  You can manually set the VLANs in your build to match your router (see ramips_esw.c).

Regards,
Layne

Thank you Layne,

I did some changes on ramips_esw.c. As I have no experience on this and as I'm not a programmer I had to guess what determines the VLAN assignment. At about line 255 I found this:

    /* set default vlan */
    rt305x_esw_set_vlan_id(esw, 0, 1);
    rt305x_esw_set_vlan_id(esw, 1, 2);
    rt305x_esw_set_vmsc(esw, 0,
                (BIT(RT305X_ESW_PORT0) | BIT(RT305X_ESW_PORT1) |
                 BIT(RT305X_ESW_PORT2) | BIT(RT305X_ESW_PORT3) |
                 BIT(RT305X_ESW_PORT6)));
    rt305x_esw_set_vmsc(esw, 1,
                (BIT(RT305X_ESW_PORT4 | BIT(RT305X_ESW_PORT6)));
    rt305x_esw_set_vmsc(esw, 2, 0);
    rt305x_esw_set_vmsc(esw, 3, 0);

This seemed to me the place where the different ports are set to respectively VLAN1 and VLAN2. After some unsuccessful compiles because of little experience and late-night tiredness the following lines seem to to exactly what I need:

                (BIT(RT305X_ESW_PORT4) | BIT(RT305X_ESW_PORT1) |
                 BIT(RT305X_ESW_PORT2) | BIT(RT305X_ESW_PORT3) |
                 BIT(RT305X_ESW_PORT6)));
    rt305x_esw_set_vmsc(esw, 1,
                (BIT(RT305X_ESW_PORT0 | BIT(RT305X_ESW_PORT6)));

As you see I just swapped PORT0 and 4. This equals to the knowledge I got after comparing the traces on the pcb with the datasheet (that's what I'm far more experienced in). Than, indeed, it comes out that my device is soldered as W/L (respectively port 0 and 1) where the default OpenWrt-trunk uses LLLL/W (respectively port 0 to 4).

However this kind of configuration is far from perfect it's now time for me to go to my next challenge on these devices: OpenVPN and virtual hosts on uhttpd.

Many thanks for now,

Erik

I've build a firmware for DIR-600 rev B using latest trunk  and all the mac addreses are in the form of 11:22:33:44:55:66. I've managed to change them using  webif with the real mac addresses of the router but they don't survive past reboot. Any clues ?

(Last edited by boink on 11 Apr 2011, 16:28)

boink wrote:

I've build a firmware for DIR-600 rev B using latest trunk  and all the mac addreses are in the form of 11:22:33:44:55:66. I've managed to change them using  webif with the real mac addresses of the router but they don't survive past reboot. Any clues ?

The eth0 MAC address is currently hard-coded in the driver.  The driver needs to be updated to pull it from the eeprom.  It works fine with the hard-coded value for now though.  Just keep in mind that ramips targets are still a WIP.

Some body has used this patch? What is the difference from using this patch and the network patchs from: https://forum.openwrt.org/viewtopic.php?pid=130692#p130692 ?

I could sucessfuly build openWrt trunk to my dir-600 B2 but I? getting some weird behavior. Some times I have trouble when I try to connect through WiFi with WPA2 enabled. My computer says that it can't connect to network after typing the correct password, or it connects but i don't get an ip address by DHCP. After some time I can connect and get an address and them I'm able to browse the internet or access another computers in the network.
The WiFi speed is not good too. I can only get about 2 MB/s in file transfers or some times even below that.

Other thing I noticed is the amount of mtd partitions when running OpenWRT:

root@OpenWrt:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00030000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00010000 00010000 "factory"
mtd3: 000d0000 00010000 "kernel"
mtd4: 002e0000 00010000 "rootfs"
mtd5: 00180000 00010000 "rootfs_data"
mtd6: 003b0000 00010000 "firmware"

Is this really correct?

When I revert back to the original D-link Firmware the router behaves even poorly than OpenWRT. Most problems occur on WiFi. I can connect to wifi, get an address but can't ping anything. Not even the router.

Any help or comment about these problems? Thanks!

The patch has nothing to do with wireless, it only adds some config files to identify the device as DIR-600 rev.B. I've flashed my router which is a DIR-600 rev. B with the latest trunk and i get the same mtd partitions:


root@OpenWrt:/etc/init.d# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00030000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00010000 00010000 "factory"
mtd3: 000d0000 00010000 "kernel"
mtd4: 002e0000 00010000 "rootfs"
mtd5: 000a0000 00010000 "rootfs_data"
mtd6: 003b0000 00010000 "firmware"

I don't think that's an issue. My problem is that the settings are not saved to nvram. I've modified some settings regarding network with uci, but after reboot they don't persist. And sometimes luci gets corrupted after reboot.

root@OpenWrt:/www/cgi-bin# ./luci
/usr/lib/lua/luci/dispatcher.lua:163: /etc/config/luci seems to be corrupt, unable to find section 'main'
stack traceback:
        [C]: in function 'assert'
        /usr/lib/lua/luci/dispatcher.lua:163: in function 'dispatch'
        /usr/lib/lua/luci/dispatcher.lua:146: in function </usr/lib/lua/luci/dispatcher.lua:145>
Status: 500 Internal Server Error
Content-Type: text/plain
Cache-Control: no-cache
Expires: 0

/usr/lib/lua/luci/dispatcher.lua:163: /etc/config/luci seems to be corrupt, unable to find section 'main'
stack traceback:
        [C]: in function 'assert'
        /usr/lib/lua/luci/dispatcher.lua:163: in function 'dispatch'
        /usr/lib/lua/luci/dispatcher.lua:146: in function </usr/lib/lua/luci/dispatcher.lua:145>root@OpenWrt:/www/cgi-bin#  /etc/config/luci seems to be corrupt, unable
/bin/ash: /etc/config/luci: Permission denied

(Last edited by boink on 13 Apr 2011, 12:22)

Another RT3050 user here. I put up a photograph of the Tenda 3G611R+ system board:
http://sites.google.com/site/stephengutknecht/Home/Tenda_3G611RPLUS_internal1_medium1.jpg
http://sites.google.com/site/stephengutknecht/Home/Tenda_3G611RPLUS_internal2_medium1.jpg

keywordz: Tenda 3G 3G611R 3G611R+ 611R 611R+ D-Link USB Ralink router wifi 801.11n 3G622R 622R

(Last edited by RoundSparrow on 14 Apr 2011, 12:17)

boink wrote:

The patch has nothing to do with wireless, it only adds some config files to identify the device as DIR-600 rev.B. I've flashed my router which is a DIR-600 rev. B with the latest trunk and i get the same mtd partitions:


root@OpenWrt:/etc/init.d# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00030000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00010000 00010000 "factory"
mtd3: 000d0000 00010000 "kernel"
mtd4: 002e0000 00010000 "rootfs"
mtd5: 000a0000 00010000 "rootfs_data"
mtd6: 003b0000 00010000 "firmware"

I don't think that's an issue. My problem is that the settings are not saved to nvram. I've modified some settings regarding network with uci, but after reboot they don't persist. And sometimes luci gets corrupted after reboot.

root@OpenWrt:/www/cgi-bin# ./luci
/usr/lib/lua/luci/dispatcher.lua:163: /etc/config/luci seems to be corrupt, unable to find section 'main'
stack traceback:
        [C]: in function 'assert'
        /usr/lib/lua/luci/dispatcher.lua:163: in function 'dispatch'
        /usr/lib/lua/luci/dispatcher.lua:146: in function </usr/lib/lua/luci/dispatcher.lua:145>
Status: 500 Internal Server Error
Content-Type: text/plain
Cache-Control: no-cache
Expires: 0

/usr/lib/lua/luci/dispatcher.lua:163: /etc/config/luci seems to be corrupt, unable to find section 'main'
stack traceback:
        [C]: in function 'assert'
        /usr/lib/lua/luci/dispatcher.lua:163: in function 'dispatch'
        /usr/lib/lua/luci/dispatcher.lua:146: in function </usr/lib/lua/luci/dispatcher.lua:145>root@OpenWrt:/www/cgi-bin#  /etc/config/luci seems to be corrupt, unable
/bin/ash: /etc/config/luci: Permission denied

Hi boink.

Well, I applied the patch and built a new OpenWrt image with the latest trunk. I also applied the network patchs from previous posts.

The image that gets created is: openwrt-ramips-rt305x-dir-600-b2-squashfs-sysupgrade.bin

The router boots ok, i can get ethernet working and access internet through it. But with wifi. No luck. With or without encryption I'm getting the same problems. Some times I can't even connect.
When using WPA/WPA2 my computer says that the password is not correct, but I'm sure i had entered the correct password. Without encryption I can aways connect and receive IP through DHCP after some time (this is a little bit slow, even when i connected using ethernet) but I can't ping the router or any thing else using wifi I only receive DHCP packets. The Ethernet aways works as expected.

After rebooting my configurations are aways saved, but I built a small image, leaving about 1,5 MB to the jffs partition (which is mtd5).

What I think it's strange is that the offsets of the mtd partitions are not the same as the patch from LinkZ.

I hope these problems are related only with the wireless drivers, not with the hardware it self. While using D-link firmware I could see a kernel panic a couple of times. The kernel used was 2.6.21 from D-link's GPL source code.

be.cool wrote:

What I think it's strange is that the offsets of the mtd partitions are not the same as the patch from LinkZ.

This is because the flash partitions are set in the kernel command line, which overwrites the partitions in the board configuration.  See the image/Makefile:

mtdlayout_4M=mtdparts=physmap-flash.0:192k(u-boot)ro,64k(u-boot-env)ro,64k(factory)ro,832k(kernel),2944k(rootfs),3776k@0x50000(firmware)
LinkZ wrote:
be.cool wrote:

What I think it's strange is that the offsets of the mtd partitions are not the same as the patch from LinkZ.

This is because the flash partitions are set in the kernel command line, which overwrites the partitions in the board configuration.  See the image/Makefile:

mtdlayout_4M=mtdparts=physmap-flash.0:192k(u-boot)ro,64k(u-boot-env)ro,64k(factory)ro,832k(kernel),2944k(rootfs),3776k@0x50000(firmware)

I don't quite understand.  So You're saying that my partitions are wrong? I'm thinking that what is causing the Original D-Link firmware to malfunction are the partitions or some garbage in them.

I got the Original firmware (ver 2.02) to work correctly yesterday. But after upgrading to 2.05, the wifi stopped working. And continued not working after flashing OpenWRT.

I'm starting to wonder if my device hardware is the source of these problems.

Edit:
I also noted that the partition "rootfs_data" that appears on my device, isn't mentioned in trunk/target/linux/ramips/image/Makefile at the 4M generic mtd layout variable.

(Last edited by be.cool on 13 Apr 2011, 23:55)

No, your partitions are fine.  I'm just saying that the partition definitions in the mach-dir-600-revb.c file won't be used, because the flash physmap is set in the kernel command line.  Either way it doesn't matter though.  The partition names don't make any difference (only the addresses)... and the bootloader, bootloader config and factory config are the only partitions that must be the same (and they are).

The rootfs_data partition is created automatically.  It is your writable jffs2 partition.

Whatever problems you're having with wifi, I'm pretty sure it has nothing to do with the partitions.  However, if your radio uses configuration data from the bootloader config partition (or NVRAM), then it's possible that data is corrupted.  Usually restoring to the factory settings (i.e. a 30-30-30) reset using the FACTORY firmware will restore NVRAM and/or the bootloader config data... but I don't know about the DIR-600 for sure.

Regards,
Layne

LinkZ wrote:

No, your partitions are fine.  I'm just saying that the partition definitions in the mach-dir-600-revb.c file won't be used, because the flash physmap is set in the kernel command line.  Either way it doesn't matter though.  The partition names don't make any difference (only the addresses)... and the bootloader, bootloader config and factory config are the only partitions that must be the same (and they are).

The rootfs_data partition is created automatically.  It is your writable jffs2 partition.

Whatever problems you're having with wifi, I'm pretty sure it has nothing to do with the partitions.  However, if your radio uses configuration data from the bootloader config partition (or NVRAM), then it's possible that data is corrupted.  Usually restoring to the factory settings (i.e. a 30-30-30) reset using the FACTORY firmware will restore NVRAM and/or the bootloader config data... but I don't know about the DIR-600 for sure.

Regards,
Layne

Thank you Layne for clearing the things up for me.

I'll try as you suggested a a 30-30-30 reset with the default firmware from D-link.

But just for curiosity. Is there any one here that have this radio working properly with any of the available firmwares: OpenWRT, DD-WRT and D-link's official firmware?

The 30-30-30 reset flash procedure didn't work (I ended up in the rescue firmware upload tool). I reverted back to the original D-Link firmware but I can't get the wireless to work correctly. It works when it wants. The only systematic thing I see is that only arp requests/responses and dhcp trafic is flowing through the wireless interface. Nothing else.

The problems started to occur after flashing dd-wrt firmware.

Does somebody know how to wipe the mtd partitions completely ? Leaving just the u-boot and u-boot-env partitons intact? Or know that may be happening?

Thanks!

Edit:
I've run wireshark on my computer to listen in the wireless interface while connected to dir-600 with stock firmware. I could confirm that only arp requests (i managed to arping the router successfully ) are being routed though the wifi interface. I'm not geting why...

(Last edited by be.cool on 14 Apr 2011, 07:55)

I'm running wireless on DD-WRT without issues. And it seems to work on OPENWRT as well. As for stock firmware I can't tell, as I've flashed it from the day I boughted.

(Last edited by boink on 14 Apr 2011, 09:07)

boink wrote:

I'm running wireless on DD-WRT without issues. And it seems to work on OPENWRT as well. As for stock firmware I can't tell, as I've flashed it from the day I boughted.

The same problem happens in DD-WRT and OpenWRT in my radio. Wich version of dd-wrt firmware you are using?

boink wrote:

I'm using the latest build from ftp://dd-wrt.com/others/eko/BrainSlayer-V24-preSP2/2011/04-09-11-r16785/dlink-dir600b/ , but I haven't encountered any issues with previous releases.

I downloaded and flashed the latest firmware on my device. The wifi interface starte working and I could make some file transferences, the speed wasn't too good, but it worked.

So I started to do some configurations. Added WPA2 but i could only connect to the wifi network, not get an IP adress via dhcp. I removed the WPA2 and it started to work again.
Then I tried WPA, but again I could connect to the network but can't obtain an IP.
After removing this configuration, the wifi interface stopped working at all. I can associate to the wifi network and get an IP, but can't ping or access anything. Just arping the router it-self

Another thing I noticed it that for the short time the wireless worked after flashing dd-wrt the RX rate was very high, about 54 Mbps, now that the wifi is not working, the RX Rate (DD-WRT wireless status page) shows only 5.5 Mbps (some times it drops to 1 Mbps) for RX and full 65 Mbps for TX.

(Last edited by be.cool on 14 Apr 2011, 22:09)

RoundSparrow wrote:

Another RT3050 user here. I put up a photograph of the Tenda 3G611R+ system board:
keywordz: Tenda 3G 3G611R 3G611R+ 611R 611R+ D-Link USB Ralink router wifi 801.11n 3G622R 622R

@RoundSparrow: Hey! That look like a cool router, I see from the pictures that there is an extra, but unused antenna trace! Perhaps that thing can do more than you think... Although I can't see from the photo if it's also missing the components. If you have any good stuff please add your device+info to the main OpenWRT website! smile

(Last edited by PopOpen on 14 Apr 2011, 21:53)

Any news on the ramips port ? Seems it hasn't been updated in  trunk for over a month.

I am attempting to copy a large file (500Mb) from a computer on the wireless network to a computer on the wired network attached to the lan.  After a few megabytes are transferred, I am no longer able to contact the computer on the wired network, until after I reboot the router.

See https://dev.openwrt.org/ticket/9743 for more details

My question is: are other people able to do this on their DIR 600 VB2? If yes, what version of trunk are they using?  I may need to downgrade to an older version of the firmware.  Also I had exactly the same problem with this router, using the standard dlink firmware, so maybe it's a hardware fault?

** EDIT 2011/09/30 ** with revision 28314 of the trunk I can no longer reproduce this problem.

(Last edited by petdr on 30 Sep 2011, 06:38)

Hello,

made my first steps with OpenWrt and this is my first post.
I had success building the latest trunk rev27711 for my D-Link DIR-300 B1,  chip Ralink RT3052.  Maybe someone needs this info.

I tested the default functionality, that is I get a DHCP-lease on the LAN side, receive a DHCP-lease on the WAN-interface from my local DHCP-server and can route through the  DIR-300 B1 to the internet.

Wireless can be switched on telneting from LAN to 192.168.1.1 and enabling WIFI in root@OpenWrt:/#/etc/config/wireless. But I didn't test at the moment, if I can connect to WIFI.

For building I followed the advice in the Wiki: http://wiki.openwrt.org/toh/d-link/dir-300revb. Flashing the new firmware was done from the original D-Link Web-GUI.

My interest for OpenWrt woke up reading this article about IPv6-Tunnels:
http://www.heise.de/netze/artikel/IPv6-Zugang-fuers-LAN-nachruesten-1260260.html

I hope I will be able to configure a Gogo6-Tunnel later with OpenWrt, as described on Page 3:
http://www.heise.de/netze/artikel/IPv6-Zugang-fuers-LAN-nachruesten-1260260.html?artikelseite=3

Thanks to all developers!

(Last edited by Hank on 21 Jul 2011, 17:07)

An appendix to my last post. After replacing the original D-Link firmware with a basic trunk version of OpenWrt I missed some commands like ip6tables. So I recompiled the trunk with selecting ip6tables in 'make menuconfig' and make. As a noob, it was difficult for me to find out afterwards, how to reflash OpenWrt for the first time. The original Web-GUI of the router wasn't available at this point and I had to select, which of the compiled firmware-binaries were apropriate. I found a small hint in http://wiki.openwrt.org/toh/d-link/dir-300 to use the tool 'sysupgrade'.

So I ...

* changed telnet to ssh access with the command passwd on the router.
* uploaded the new firmware from the LAN with 'scp openwrt-ramips-rt305x-dir-300-b1-squashfs-sysupgrade.bin root@192.168.1.1:/tmp/'.
* flashed it on the router with 'sysupgrade /tmp/openwrt-ramips-rt305x-dir-300-b1-squashfs-sysupgr
ade.bin'.

Now the command ip6tables for example works on my DIR-300B1.

I hope this was helpful for other starters.

cheers