пятница, 10 декабря 2010 г.

How-To: upgrading TP-Link WR1043ND router from Factory Firmware to OpenWrt


Upgrading factory firmware to something else (like OpenWrt, or DD-Wrt) is quite often complex and painful process.
But not always.

To help people who want to move from factory firmware to OpenWrt, I did this process step-by-step, capturing all screens and messages.
I used TP-Link TL-WR1043ND wireless router, which is based on Atheros chipset, and can be flashed directly from web interface, without need to setup tftp server or other trick.

Firmware upgrade for TP-Link TL-WR1043ND
Hardware version is TL-WR1043ND v1.6
Before going further, make sure that hardware version of your device is compatible with OpenWrt firmware.

1. To upgrade from TP-Link TL-WR1043ND factory firmware to OpenWrt, you need first to reset all settings to default.
Go to System Tools - Factory Defaults. Click on "Restore" button to reset settings to factory.

2. You will see message "Factory settings restored successfully!", and your router is restarting
.
WR1043ND Restoring Factory Defaults

3. Default IP address for TP-Link WR1043ND router is 192.168.1.1
Netmask is 255.255.255.0
If you flash from Windows (I used Windows XP for this testcase), go to Network Connections and change IP address for your computer to static, from the same subnet as your router has.
For example: 192.168.1.200

Ping your router from command line (>ping 192.168.1.1) to make sure that router is accessible.
Disconnect all cables from router except cable from tour PC (other computers, WAN cable from provider or cable/DSL modem)

4. Open in web browser web interface of your router.
Go to System Tools - Firmware Upgrade. Enter filename for firmware downloaded previously to you disk.

WR1043ND Firmware Upgrade

You need to download before doing this step firmware from /backfire/10.03.1-rc4/ar71xx/ repository.
Version to flash from factory firmware: openwrt-ar71xx-tl-wr1043nd-v1-squashfs-factory.bin
When OpenWrt Backfire 10.03.1 is released, you need to use repository from that final release.


5. You will see message "Please wait until system reboots..."

WR1043ND Firmware Upgrade - System Reboot

IMPORTANT!
Never flash your router via Wi-Fi (wireless) connection. You can damage your router
Never turn power off for your computer or router during flashing procedure.
This would brick your router.


6. Wait until you see message "Software Upgraded Successfully! Restarting..."

WR1043ND - Software Upgraded Successfully

Do not switch off computer or router until you see this message.
From my experience, this procedure with WR1043ND is quire fast, much faster comparing to other routers which I flashed before. It takes appx. 2-3 minutes.

7. Wait a little bit until your browser rebooted.
And open again address 192.168.1.1 in your browser
Before this you can ping 192.168.1.1 from command line to make sure interface is up and responding.

You will see OpenWrt LuCI web screen with login.

WR1043ND upgraded to OpenWrt, LuCI web interface

Click on "Login" button, without entering any password.

8. Go to System - Admin in menu, and change default password to your own password.

OpenWrt Change Admin Password

9. (optional)
Go to Overview - Hello screen, and see greetings from OpenWrt/LuCI and its developers.

OpenWrt LuCI Hello screen

Your system is up and running.
You can start configuring it up to your needs.

Версия этого How-To на русском языке: FAQ: как установить OpenWrt на маршрутизатор TP-Link WR1043ND

32 комментария:

Анонимный комментирует...

Спасибо за статью.

У меня возникла пара вопросов.

1. Как Вы определили hardware version? В веб-интерфейсе у меня стоит единичка с кучей нулей (как и у Вас на картинке).

2. После перепрошивки на устройстве появится ли возможность включить VPN PPTP сервер для удаленного подключения к внутренней сети?

Borisskin комментирует...

Добрый день! Тоже интересует возможность подключение так называемого Russian dual access. А то на родной прошивке wr841nd v7 не могу подключиться по PPTP.

Vadim Plessky комментирует...

Hardware version можно узнать, перевернув корпус устройства.
На дне есть этикетка (лейбл), где помимо всего прочего (Model Number, Power, Default IP settings) есть версия устройства.
У меня на TP-Link WR1043ND это ver.1.6

Vadim Plessky комментирует...

TP-Link WR841ND v7 поддерживается OpenWrt Trunk.
Это версия OpenWrt, находящаяся в разработке.
OpenWrt Backfire поддерживает TP-Link WR841ND v5 и более ранние версии.

Для подключения по PPTP необходимо установить дополнительный пакет - в варианте OpenWrt Backfire это pptp_1.7.1-3_ar71xx.ipk
Для установки надо войти в меню Software (Administration-> System -> Software), выбрать Update package lists, затем ввести в поле Download and install package: pptp, нажать OK
Пакет автоматически установится, больше ничего делать не нужно.

Borisskin комментирует...

Спасибо большое!
Буду пробовать.

Sev4ik комментирует...

Обновил свои 1043 по выше указанному сценарию, не могу добавить pptp, как ты описал выше не получается, в ответ: Could not set default destination, подскажи как правильно добавить pttp ?

Vadim Plessky комментирует...

попробуйте из командной строки (ssh или telnet)
#opkg update
#opkg install pptp

Sev4ik комментирует...

Пробовал, т.к. пишет что не может соединиться с сервером...есть вариант как-то подсунуть его без интернета ? этот модуль pptp_1.7.1-3_ar71xx.ipk. Т.к. сетку настроить могу, а интернет без pptp ни как.

Vadim Plessky комментирует...

Можно загрузить пакет из Интернет, из репозитория.
Выложить его на локальный HTTP сервер.
И поправить дорожку на этот сервер в файле opkg.conf:

root@OpenWrt:~# cat /etc/opkg.conf
src/gz packages http://downloads.openwrt.org/backfire/10.03.1-rc4/ar71xx/packages
...

Borisskin комментирует...
Этот комментарий был удален автором.
Borisskin комментирует...

Добрый день!
Удалил коммент о невозможности захода по ssh. Справился через telnet, но отсутствие web-интерфейса осложняет настройку дальнейшую. Подскажете, как его можно установить?

С наступающим Новым годом!

Vadim Plessky комментирует...

Чтобы активировать SSH, надо сменить пароль пользователю root.
для этого надо выполнить команду
# passwd
После этого можно будет зайти на маршрутизатор по ssh, login: root, пароль: .

Для установки веб-интерфейса LuCI:
Если соединение с Интернет работает, устанавливаем следующие пакеты (команда #opkg install ):

luci luci-admin-core luci-admin-full luci-admin-mini luci-admin-rpc luci-app-firewall luci-app-initmgr luci-app-livestats luci-app-ntpc luci-app-samba luci-app-statistics luci-app-upnp luci-cbi luci-core luci-http luci-i18n-english luci-ipkg luci-json luci-lmo luci-nixio luci-sgi-cgi luci-sys luci-theme-base - 0.9+svn6512-1
luci-theme-openwrt luci-uci luci-uvl luci-web

Это список из того, что установлено у меня.
Если Самба и Статистика не нужна - из списка удаляем ненужные пакеты.

и проверяем что установилось:
root@OpenWrt:~# opkg list-installed | grep luci

После установки перезагружаем роутер.
В меню Initscripts - разрешаем запуск сервисов (Enable) и делаем Start для требуемых процессов.

Unknown комментирует...

Подскажите, пожалуйста, а в OpenWrt где закопано dyndns? Все перерыл и не нашел. Ткните носом, не сочтите за труд. Спасибо.

Vadim Plessky комментирует...

Надо поставить модуль:
luci-app-ddns

Он автоматически добавит дополнительные меню в веб-интерфейс, и установит по завсисимости требуемый модуль для DynDNS.

Если делать это из командной строки:
#opkg install luci-app-ddns

Далее маршрутизатор надо перезагрузить, чтобы появились новые меню (перезапуск веб интерфейса эффекта не даёт)

TheBigD комментирует...

I followed your guide and now I got openwrt on the router (using hardware verison 1.7). But I didn't manage to install an external flashdrive using the usb port. Namely I wasn't even able to find it in order to mount it.

"lsusb" gives
/bin/ash: lsusb: not found

so I'm guessing something is wrong. Did you have the same problem?

I'd love an how-to about setting up external storage and a torrent client if you ever have the time.

Anyway, thanks for taking the time to write a very useful how-to.

Vadim Plessky комментирует...

To install USB drive, you need to follow USB Storage How-To on OpenWrt site.

And here is my simplified (short) version.
Simple USB storage install guide
1. #opkg install
kmod-usb-core kmod-usb-ohci
kmod-usb-storage kmod-usb2 block-hotplug block-mount kmod-nls-cp437

2. edit /etc/config/fstab
#vi /etc/config/fstab
Define what kind of partition you have on USB drive (vfat, ext3, etc.)

And change
option enabled 0
to
option enabled 1
Save file.

3. Reboot
4. Menu Services -> Initscripts
fstab -> change to Enabled
Than press "Start".

5. You USB drive should be mounted
You may check this with command:
# mount

Feel free to report here any problems.
I have USB drive fully functional, with FTP, NFS and SAMBA servers installed on OpenWrt.

Vadim Plessky комментирует...

I forgot to mention:

1a. you need to install kernel modules for required filesystems
For ext3 and vfat (FAT32) filesystems:

# opkg install kmod-fs-ext3 kmod-fs-vfat

and if you want/need NFS server:
7. install NFS server daemon and filesystem
#opkg install kmod-fs-nfs kmod-fs-nfs-common kmod-fs-nfsd nfs-kernel-server nfs-kernel-server-utils

8. edit /etc/exports
For access without password/username:
---------
/home/pub *(ro,insecure,all_squash,no_subtree_check)

/home/pub - it a folder which you created on mounted drive.
You can change name to actual name of your folder.

9. Menu Services -> Initscripts

Enable portmap and nfsd. And start both services.

TheBigD комментирует...

Excellent, thank you. I really needed your short guide, the openwrt site is very hard to follow since the commands seem to have have changed.

With your help, everything seemed to install ok, as long as I made an "opkg update" first.

I then managed to mount an ext3 flashdrive, but I failed mounting one formated with fat32. Not sure why, I changed it to vfat in fstab and rebooted, but it still refused to mount.

I'm still not sure if I managed to make the NFS server to work, haven't been able to mount it in win7, but that's berhaps due to me using win7 own NFS client. It seems buggy. Maybe SAMBA or FTP would work better with windows. How did you manage to install that?

Again, thank you. I'm new to the world of linux so this is not straightforward to me, so any help is much appreciated.

Vadim Plessky комментирует...

Installation of vsftpd ftp server and samba on OpenWrt (WR1043ND) has been actively discussed here
Not sure if you can follow that forum, as it's in Russian.

Samba installation
1. install samba package and LuCI web management for it
# opkg install luci-app-samba samba3
You may need to reboot router to make menu for Samba available in Web Interface.
2. Menu Services -> Network Shares
- define hostname and workgroup for OpenWrt SAMBA server
You may leave hostname 'openwrt' and workgroup 'WORKGROUP' as it is
- add shared drives to the list
Shared Directory should point to exsting mount point/location on your file system.
Leave Create Mask / Directory MaskAllow Guests - Yes, if you want to have anonymous access to your drives.
3. Menu Services -> Initscripts
Samba -> Enabled, Start (Restart)
That's it. Samba server should be functional after it.

TheBigD комментирует...

OK, I've managed to get password protected samba on the router as well as the ftp server and transmission. So it seemes that my setup would be pretty similar to yours (part from the user-password perhaps), but the speeds I see is no where near the speeds you saw from your router. For wired samba (transfering a large file) I see 3.5 MB down and 2 MB up and that is with all other services turned off. That's with ext3. With the same hardrive using stock firmware and NTFS I saw speeds of 7.5 Down and 2.5 UP. How did manage to get such fast transfer rates?

The NFS speeds I see is even further from the speeds you see, but that might be because windows 7 is not very adapt of using NFS,I don't know.

Do you have any suggestions?

One a more positive note, transmission seems to work rather well, maxing out my downlink of 600 KB.

Vadim Plessky комментирует...

Interim testing (data is not ready for FAQ yet) shows that ext4 provides best upload speed.
And it offers excellent download/upload combination.
for upload only - xfs has excellent results.

I would also recommend to but high-speed USB flash.
For latest tests I use Transcend JetFlash 500 (32GB) USB stick.
Transcend 600/620 laso have very good performance, even with lower capacity.

TheBigD комментирует...

So you think it's the external HDD that is the bottle neck? How could that be? Connecting the drive directly to a laptop would yield speeds in excess of 15MB up and down. Doesn't that mean that it must be the router and it's ability or inability to handle the different file systems that is what produces the ultimate speed?

Couldn't it have something to do with the basic router configuration. AP vs Routed Client Mode for example?

What read speed did you manage to get from an ext3 disk using samba, if I may ask?

Vadim Plessky комментирует...

File transfer speed depends not only on router itself (WR1043ND) and its operating system (OpenWRT 10.03.1, Linux 2.6.32), but also on USB controller in this router (built-in into Atheros chipset), CPU, memory input/output, RAM size.
Any of those can be a bottleneck, as this is embedded device with limited functionality and constrained resources.

Another set of variables is: Client hardware (Desktop/Notebook/Server), Client's NIC, CPU, Operating System, client software (ftp client, etc.), protocol (ftp/nfs/samba)

With such client:
-ASUS M51Ta notebook / Windows Vista
-Filezilla Client 3.3.5.1
I get 13075 KB/sec. read and 3600KB/sec. write with EXT3 partition on Transcend 500 (32GB) USB disk.
I used kmod-fs-ext4 driver for this test, which is backward-compatible with ext3 file system.

For ext4 partitionon - I get 13364 KB/sec. read and 5175KB/sec. write, also on Transcend 500 (32GB) USB disk.

Both numbers are for ftp protocol, Filezilla client (Windows Vista).
Numbers are confirmed by Log file from server (vsftpd)

For Samba - I get appx. 9.5MB/sec. read, so it's lower than FTP.

NTFS filesystem is a bottleneck itself.
Some tests other people did demonstrated that it has very low performance (on Linux) comparing to ext2, ext3, ext4, xfs file systems.
This is caused by the fact that NTFS is owned by Microsoft, and it doesn't want to disclosure details of NTFS specification.
I would recommend to you to switch to any of file systems listed above from NTFS, if you want to have good performance with your router.

Vadim Plessky комментирует...

I just did publication on performance comparison of different file systems (ext3, ext4, xfs) with OpenWrt Backfire and WR1043ND.

It covers read/write speed, and methods used to get final numbers.

Andrey комментирует...

Вопрос
Tp-link 1043nd, 3g modem Airplus MCD-650
Все настроил, все работает:
1. как реализовать функцию автодозвона
2. время в Tp-link 1043nd не обновляется

Vadim Plessky комментирует...

root@OpenWrt:~# opkg install luci-app-ntpc
Installing luci-app-ntpc (0.9+svn6512-1) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1-rc4/ar71xx/packages/luci-app-ntpc_0.9+svn6512-1_ar71xx.ipk.
Installing ntpclient (2007_365-4) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1-rc4/ar71xx/packages/ntpclient_2007_365-4_ar71xx.ipk.
Configuring ntpclient.
Configuring luci-app-ntpc.

Далее перезагружаем роутер, чтобы появились меню в веб-интерфейсе, и конфигурируем NTP (Network Time Protocol) клиент.

Vadim Plessky комментирует...

Если нет желания ставить пакет LuCI для конфигурирования NTP - можно поставить только сам ntpclient и поправить руками конфиг-файл /etc/config/ntpclient

Внутри пакета ntpclient есть следующие файлы:
root@OpenWrt:~# opkg files ntpclient
Package ntpclient (2007_365-4) is installed on root and has the following files:
/etc/config/ntpclient
/etc/hotplug.d/iface/20-ntpclient
/usr/sbin/adjtimex
/usr/sbin/rate.awk
/usr/sbin/ntpclient

NTP-сервера выбираются из пулов:
'0.openwrt.pool.ntp.org'
'1.openwrt.pool.ntp.org'
'2.openwrt.pool.ntp.org'
'3.openwrt.pool.ntp.org'

При желании можно заменить на свой собственный NTP-сервер.

Andrey комментирует...

Как настроить dyndns?

Vadim Plessky комментирует...

см. Маршрутизатор TP-Link TL-WR1043ND Atheros, 3x3 MIMO, 2.4GHz, 802.11

Анонимный комментирует...

sir could you email me tutorial for this router in english version.
i wanna know how to install samba,transmission, ftp server. i cant understand the russian version. here is my email
acid.knives@yahoo.com

Стеллс комментирует...

Здравствуйте! У меня TP-Link TL-MR3220. Пытаюсь установить OpenWrt, но прошивка не стартует. Браузер пишет:"ожидание ответа от 192.168.1.1" и остается так все время. что можно сделать?

Vadim Plessky комментирует...

Прошивка для MR3220 отличается от прошивки для WR1043ND.
Необходимо загружать версию с сайта OpenWrt, для данного конкретного устройства.