4
5
I need to install a program on a linux router. Can this also be done on a linksys router that has ddwrt installed on it? How?
4
5
I need to install a program on a linux router. Can this also be done on a linksys router that has ddwrt installed on it? How?
3
To install things on a router with DD-WRT, you must enable a few things in the router administration interface. First, enable JFFS2 on the Management tab of the Administration section. Second, enable SSHd on the Services tab of the Services section. If you need to access files from another computer, the easiest way is to share them via Windows File Sharing/SMB, and then mount it via the CIFS Automount section of the Management tab of the Administration section. You can also use SCP if you desire.
Once you've done that, you can access your router via SSH. To do so on Linux and Mac OS X, just run ssh [router IP address]
. To do so on Windows, you'll need PuTTY or another SSH client.
Once you're on, you have access to a full Linux BusyBox shell. But, that's only half the battle. Routers don't come with x86-based processors, so you can't just copy a binary from a Linux machine and have it work. It has to be compiled for the processor included with your particular router and designed to work on BusyBox.
However, there are many packages compiled for routers, that can be installed with the package manager created by the OpenWRT project and included with DD-WRT, called ipkg
(as another user indicated while I was writing this answer). The ipkg
documentation has instructions for using the ipkg
command and several sources of packages for DD-WRT.
2
You can use the ipkg package tool from openwrt: http://www.dd-wrt.com/wiki/index.php/Ipkg
0
if it's one of the micro
versions of dd-wrt, your options are limited, since ssh and scp are not available. I've found one way that's fairly reliable if you have access to a machine you can use as a webserver; copy the file to the webserver, and wget
it from the dd-wrt box:
jcomeau@aspire:~/rentacoder/jcomeau/ddwrt$ dd if=/dev/urandom bs=256 count=1 of=/tmp/test.dat
1+0 records in
1+0 records out
256 bytes (256 B) copied, 0.0012205 s, 210 kB/s
jcomeau@aspire:~/rentacoder/jcomeau/ddwrt$ scp /tmp/test.dat unixshell.jcomeau.com:/var/www/jcomeau/
test.dat 100% 256 0.3KB/s 00:00
jcomeau@aspire:~/rentacoder/jcomeau/ddwrt$ telnet 192.168.151.1
Trying 192.168.151.1...
Connected to 192.168.151.1.
Escape character is '^]'.
DD-WRT v24-sp2 micro (c) 2009 NewMedia-NET GmbH
Release: 10/10/09 (SVN revision: 13064)
plinksys login: root
Password:
==========================================================
____ ___ __ ______ _____ ____ _ _
| _ \| _ \ \ \ / / _ \_ _| __ _|___ \| || |
|| | || ||____\ \ /\ / /| |_) || | \ \ / / __) | || |_
||_| ||_||_____\ V V / | _ < | | \ V / / __/|__ _|
|___/|___/ \_/\_/ |_| \_\|_| \_/ |_____| |_|
DD-WRT v24-sp2
http://www.dd-wrt.com
==========================================================
BusyBox v1.13.4 (2009-10-10 04:23:29 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
\u@\h:\w\$ cd /tmp
\u@\h:\w\$ wget http://unixshell.jcomeau.com/test.dat
Connecting to unixshell.jcomeau.com (207.210.74.124:80)
\u@\h:\w\$ wc test.dat
0 6 256 test.dat
\u@\h:\w\$
to do the opposite, i.e., download a binary from the router, one may make use of the /tmp/www directory, which is mapped to /user by the dd-wrt httpd
daemon. use a .gif
extension to ensure that httpd doesn't make any attempt to modify it (as it would with an .asp
extension).
jcomeau@aspire:~/rentacoder/jcomeau/ddwrt$ telnet 192.168.151.1
Trying 192.168.151.1...
Connected to 192.168.151.1.
Escape character is '^]'.
DD-WRT v24-sp2 micro (c) 2009 NewMedia-NET GmbH
Release: 10/10/09 (SVN revision: 13064)
plinksys login: root
Password:
==========================================================
____ ___ __ ______ _____ ____ _ _
| _ \| _ \ \ \ / / _ \_ _| __ _|___ \| || |
|| | || ||____\ \ /\ / /| |_) || | \ \ / / __) | || |_
||_| ||_||_____\ V V / | _ < | | \ V / / __/|__ _|
|___/|___/ \_/\_/ |_| \_\|_| \_/ |_____| |_|
DD-WRT v24-sp2
http://www.dd-wrt.com
==========================================================
BusyBox v1.13.4 (2009-10-10 04:23:29 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
\u@\h:\w\$ wc /dev/mtd/*
751 12148 262144 /dev/mtd/0
751 12148 262144 /dev/mtd/0ro
11671 68047 3866624 /dev/mtd/1
11671 68047 3866624 /dev/mtd/1ro
4306 24098 1098752 /dev/mtd/2
4306 24098 1098752 /dev/mtd/2ro
0 551 65536 /dev/mtd/3
0 551 65536 /dev/mtd/3ro
4640 29046 2097152 /dev/mtd/4
4640 29046 2097152 /dev/mtd/4ro
42736 267780 14780416 total
\u@\h:\w\$ cp /dev/mtd/0ro /tmp/www/cfe.gif
\u@\h:\w\$ Connection closed by foreign host. [after typing Ctrl-D]
jcomeau@aspire:~/rentacoder/jcomeau/ddwrt$ wget -O/tmp/cfe.bin http://192.168.151.1/user/cfe.gif
--2014-06-15 23:53:54-- http://192.168.151.1/user/cfe.gif
Connecting to 192.168.151.1:80... connected.
HTTP request sent, awaiting response... 200 Ok
Length: 262144 (256K) [image/gif]
Saving to: ‘/tmp/cfe.bin’
100%[======================================>] 262,144 963KB/s in 0.3s
2014-06-15 23:53:54 (963 KB/s) - ‘/tmp/cfe.bin’ saved [262144/262144]
1This is exactly right. Unfortunately, even if you manage to get JFFS2 on your router and can log in to it via SSH, you may still be unable to put any additional packages on the router if you don't have enough free flash memory space. – Big McLargeHuge – 2012-09-17T16:40:38.187