AsusForum.NET -- WL500g

Вернуться   AsusForum.NET -- WL500g > Asus WL-500g Premium > WL-500gP Tutorials
Логин
Пароль
Регистрация FAQ Участники Поиск Свежие сообщения Пометить все разделы как прочитанные
Firmware Wizard Donate

Ответ
 
Опции темы Рейтинг: Рейтинг темы: Голосов - 45, средняя оценка - 4.76. Опции просмотра
  #1  
Старый 15-08-2007, 09:42
wengi wengi вне форума
bungler
 
Регистрация: Feb 2005
Адрес: Germany - Frankfurt
Сообщения: 1,513
[How To] Install and Configure Olegs firmware

Hier findest Du das originale deutsche HowTo: http://wl500g.info/showthread.php?t=8424

After some people asked me to, this is a translation of my original, german Howto.
00. News

March 2010
Please use, if your hardware is supported, the "enthusiast firmware".
More details later.

This howto is for firmware version 1.9.2.7-9 and newer. Older versions are not supported any more.

Important: I exclude any liability.

This HowTo is for newbies! please contact me if you find any mistakes.

0. Premises
I am working with an Asus WL-HDD. But this HowTo is known to work with other hardware where you can install olegs firmware.
The WL-HDD has a weak CPU and small memory, but it does the job :-)

You also need:
- basic linux knowledge (cd, vi, ps, df, free, top, ...)
- time. I needed about 5 hours for modifying my WL-HDD incl. dinner. So you need time.
- an internet connection for downloading the software.

1. Install firmware

The easiest way is the Asus Firmware Restoration Tool. Download the tool according to your hardware.

ASUS WL-HDD2.5 wireless hard disk drive box utility program in English

It will also work with the Asus Webinterface but be sure to have the restoration tool by hand.
Download olegs firmware: Firmware Wizzard (not allways newest) or directly at http://oleg.wl500g.info
Always use the newest version for your hardware model.

UPDATE:
There is an advanced version of oleg firmware.
This one is compatible to the original and is well maintained.
I recommend using this firmware if your hardware is supported.

This HowTo wil only work with versions 1.9.2.7-9 and newer!

Reset your Asus to factory defaults. (user:admin / pw:admin)
Extract the zip.
Install the Asus tool, start it and select "firmware restoration".
Select the firmware (hardware_version.trx) and click upload.
After the reboot browse to the Webinterface of the router and again reset to factory defaults.
Again a reboot and your router has a default oleg firmware.

remark:
My WL-HDD does NOT act as Router in my network. It is only a client. Because of this i will not handle firewall settings within this howto.

Do the following in the Webinterface:
- enter the Name of the router (mine is "blechbuechse").
- enter you IP settings (IP, gateway, DNS aso.)
- disable FTP, Samba, NFS
- enable telnet
- Change the password
- do any changes as you need them. (DHCP, time zone, WLAN, aso.)
- If used as router: login data, firewall, allow ping from WAN.

If this did NOT work until here you will NOT be able to go on!

2. Telnet

Start telnet. For Windows: Start-Execute - "telnet IPOFASUS"

user:admin / pw:admin

Test your internet connection:
Код:
ping google.de
Should look like this:
Цитата:
[admin@blechbuechse root]$ ping google.de
PING google.de (66.249.93.104): 56 data bytes
64 bytes from 66.249.93.104: icmp_seq=0 ttl=243 time=35.5 ms
64 bytes from 66.249.93.104: icmp_seq=1 ttl=243 time=36.5 ms
64 bytes from 66.249.93.104: icmp_seq=2 ttl=243 time=35.0 ms

--- google.de ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 35.0/35.6/36.5 ms
[admin@blechbuechse root]$
The ping can be interrupted with ctrl-c.

If this is NOT working: Do not ping a name, ping an IP adress.
If you are not able to ping an ip adress: check your network (IP, DNS) settings and cabeling.

telnet is not a secure way to work on your asus. Espacially over internet. This is why you install SSH now:

3. SSH-deamon
TIP: You can copy & paste all commands within telnet and putty. For Windows use ctrl-c and ctrl-v, for putty mark the text and right click.

The name of the ssh daemon is dropbear. It can be activated with the Web Interface (System Setup->Services) if you use the "enthusiast firmware" (1.9.2.7-d-rxxxx). Using the new firmware you only have to generate the keys and startup scripts.
Users of firmwares before 1.9.2.7-d-rxxxx need to execute the whole chapter!

create startup scripts:
Код:
mkdir -p /usr/local/sbin/
touch /usr/local/sbin/pre-boot
touch /usr/local/sbin/post-boot
touch /usr/local/sbin/post-firewall 
touch /usr/local/sbin/post-mount
touch /usr/local/sbin/pre-mount
touch /usr/local/sbin/pre-shutdown
chmod +x /usr/local/sbin/*
create a directory: (only firmware older than 1.9.2.7-d-rxxxx)
Код:
mkdir -p /usr/local/etc/dropbear
generate keys:
Код:
dropbearkey -t dss -f /usr/local/etc/dropbear/dropbear_dss_host_key
dropbearkey -t rsa -f /usr/local/etc/dropbear/dropbear_rsa_host_key
To make dropbear start at reboot: (only firmware older than 1.9.2.7-d-rxxxx)
Код:
echo "#!/bin/sh" >> /usr/local/sbin/post-boot
echo "dropbear" >> /usr/local/sbin/post-boot
Start dropbear:
Код:
dropbear
Here is a listing of the active processes. dropbear should be one of them:
Цитата:
[admin@blechbuechse sbin]$ ps
PID Uid VmSize Stat Command
1 admin 580 S /sbin/init
2 admin SW [keventd]
3 admin SWN [ksoftirqd_CPU0]
4 admin SW [kswapd]
5 admin SW [bdflush]
6 admin SW [kupdated]
7 admin SW [mtdblockd]
46 admin 332 S telnetd
51 admin 380 S httpd
54 admin 408 S syslogd -m 0 -O /tmp/syslog.log -S -l 7
56 admin 364 S klogd
57 admin SW [khubd]
72 1 364 S [portmap]
74 admin 504 S /usr/sbin/statd
76 admin SW [nfsd]
77 admin SW [lockd]
78 admin SW [rpciod]
80 admin 484 S /usr/sbin/mountd
83 admin 484 S watchdog
85 admin 344 S ntp
94 admin SW [kjournald]
95 admin SW [kjournald]
99 admin 580 S -sh
128 admin 468 S dropbear
129 admin 392 R ps
save all the stuff and reboot:
Код:
flashfs save && flashfs commit && flashfs enable && reboot
That's it for this part.
__________________
Ьbersicht aller HowTos --- HowTo Overview (mostly german)
WL-HDD mit diesem Setup. --- WL-HDD with this setup.
Kein Support per PM - Frage im jeweiligen Thread! --- No support via pm - ask in the according thread!
Eine wirklich gute Idee erkennt man daran, dass ihre Verwirklichung von vorne herein ausgeschlossen erscheint. (Albert Einstein)

Последний раз редактировалось wengi, 29-04-2010 в 10:14.
Ответить с цитированием
  #1  
Старый 15-08-2007, 09:42
AsusForum wengi вне форума
Member
 
Регистрация: Nov 2003
Адрес: Netherlands
Сообщения: 1,513
  #2  
Старый 15-08-2007, 09:42
wengi wengi вне форума
bungler
 
Регистрация: Feb 2005
Адрес: Germany - Frankfurt
Сообщения: 1,513
4. partition and format HDD
Important for USB Disks: Power on First HDD , second router.

IMPORTANT: You will loose all the data on your HDD. Make a backup if necessary.

From now on you will work with putty.

Start putty, enter the IP adress of your box and select SSH.
Confirm the Key.

My HDD (80GB) is partitioned as follows:
data (part1), IPKG (part2) und swap (part3)
all primary, no extended
Swap 512MB (You can also use 128MB if you want to save some space)
IPKG 1GB
Data the rest (~78GB)

View mountpoints

Цитата:
[admin@blechbuechse root]$ df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/root 3008 3008 0 100% /
/dev/discs/disc0/part1 75398848 683812 70884940 1% /tmp/mnt/disc0_1
[admin@blechbuechse root]$
If there is nothing except / go directly to fdisk.

If you allready partitioned your HDD as you want (incl. swap) go to the next chapter. BUT: i recommend using fdisk because several users reported problems in mounting partitions created with third party software.

You should unmount all mounts except /.
Код:
umount /place/of/mountpoint
/place/of/mountpoint needs to be replaced with the entries from df. E.g. "umount /tmp/mnt/disc0_1".
If there is an error message during umount there is activity on the mount. Did you disable FTP / Samba, ...?

After unmounting all it should look like this:
Цитата:
[admin@blechbuechse root]$ df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/root 3008 3008 0 100% /
There may be a tmpfs mounted on /tmp which depends on the used firmware and does NOT need to be unmounted.
Partition with fdisk:
Код:
fdisk /dev/discs/disc0/disc
fdisk:
m for help.
p for view partitions.
d for delete.
n for new.

Delete all existing partitions, if any. All data will be lost!!! create new partitons after deleting the old ones:

partitions:
part1 Swap 512MB type82
part2 IPKG 1024MB /opt
part3 data rest /tmp/harddisk (This is a point where WL-HDD differs to others..!?!)

Create swap: n -> p -> 1 -> 'return' -> +512M -> t -> 82
Create IPKG: n -> p -> 2 -> 'return' -> +1024M
Create data: n -> p -> 3 -> 'return' -> 'return'

Save settings by pressing w and exit.
"fdisk -l" will show your partitions:
Цитата:
[admin@blechbuechse root]$ fdisk -l

Disk /dev/ide/host0/bus0/target0/lun0/disc: 80.0 GB, 80026361856 bytes
16 heads, 63 sectors/track, 155061 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/ide/host0/bus0/target0/lun0/part1 1 993 500440+ 82 Linux swap
/dev/ide/host0/bus0/target0/lun0/part2 994 2978 1000440 83 Linux
/dev/ide/host0/bus0/target0/lun0/part3 2979 155061 76649832 83 Linux
Now you activate the swap:
This is a 'free' without swap:
Цитата:
[admin@blechbuechse root]$ free
total used free shared buffers
Mem: 13932 11304 2628 0 1388
Swap: 0 0 0
Total: 13932 11304 2628
[admin@blechbuechse root]$
activate swap:
Код:
mkswap /dev/discs/disc0/part1
swapon /dev/discs/disc0/part1
'free' should look like this after activating:
Цитата:
[admin@blechbuechse root]$ free
total used free shared buffers
Mem: 13932 10236 3696 0 1320
Swap: 500432 0 500432
Total: 514364 10236 504128
[admin@blechbuechse root]$
Now you have enough free memory to format the rest of the HDD:
Код:
mke2fs -j /dev/discs/disc0/part2 
mke2fs -j -m 0 /dev/discs/disc0/part3
part3 will take some time, depending on HDD size. The option '-m 0' will set reserved blocks to 0. Do NOT try this on /opt partition!!!
A remark for the newbies: The partitions are ext3 formated. This is what you want!. You do NOT need Fat or NTFS to access your data.

You need to edit the file fstab to automaticaly mount the partitions
a short vi Explanation: vi is an editor.
You enter the insert mode with i, you leave it with ESC.
You can insert the content of the clipboard by right clicking within insert mode.
After leaving the insert mode you quit and save by typing ':wq'. Leaving without saving is ':q!'.
This is all. Search for a vi howto for more.

Edit the file /etc/fstab by typing:
Код:
vi /etc/fstab
and paste this:
Код:
#device                 Mountpoint      FStype  Options         Dump    Pass#
/dev/discs/disc0/part1  none            swap    sw              0       0
/dev/discs/disc0/part2  /opt            ext3    rw,noatime      1       1
/dev/discs/disc0/part3  /tmp/harddisk   ext3    rw,noatime      1       1
Partitions are mounted and swap is activated.
Important: The data partition is mounted to /tmp/hardisk as in fstab. This is handled different in the firmware because of compatibility issues: The Partition is mounted to /tmp/mnt/disc0_3 and a symlink is pointing from /tmp/hardisk to /tmp/mnt/disc0_3
To save fstab for reboot:
Код:
echo "/etc/fstab" >> /usr/local/.files
5. Startup-scripts
The time zone in the firmware is not correct for middle europe. We will correct this:
This issue is fixed from verison wl500g-1.9.2.7-d-r240 (2009-04-11) on.
If you use any newer version you can continue with i /usr/local/sbin/pre-mount.
Код:
vi /usr/local/sbin/pre-boot
content:
Код:
#! /bin/sh
tz="CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00"
nvram set time_zone="$tz"
echo "$tz" > /etc/TZ
Have a look at http://wl500g.info/showpost.php?p=139268&postcount=4 or http://wl500g.info/showthread.php?t=13727 for details.

There is a script to keep the file system clean:
Код:
vi /usr/local/sbin/pre-mount
with this content:
Код:
#! /bin/sh

swapon -a

for i in `awk '/ext3/{print($1)}' /etc/fstab` ; do
  if [ -b $i ] ; then
    grep -q $i /proc/mounts || e2fsck -p $i 2>&1 | logger -t e2fsck
  else
    logger -t fstab "$i is not attached"
  fi
done
pre-mount will start e2fsck if needed. My WL-HDD with its 80GB HDD takes some hours to do this check! It is possible that your router is switched on and the HDD becomes available hours later. You can leave pre-mount empty to prevent this, but your file system will have to be checked from time to time. Your decision. I have this activated.
post-mount is executed after pre-mount
Код:
vi /usr/local/sbin/post-mount
content:
Код:
#! /bin/sh

/opt/etc/init.d/rc.unslung start
And this file is executed before shutting down:
Код:
vi /usr/local/sbin/pre-shutdown
And again content:
Код:
#! /bin/sh

/opt/etc/init.d/rc.unslung stop

sleep 10s

for i in `cat /proc/mounts | awk '/ext3/{print($1)}'` ; do
  mount -oremount,ro $i
done

swapoff -a

sleep 1s
This script is remounting all partitions as read only to prevent loss of data at power off.

The HDD has to be mounted before editing the next file. But the best is to save and reboot:
Код:
flashfs save && flashfs commit && flashfs enable && reboot
check swap and mount of HDD with 'free' and 'df -h'. Everything ok? Next step.

Software and services installed via IPKG write scripts to /opt/etc/init.d.
You need a mechanism to start these scripts. This mechanism (a script) is triggert by post-boot.
Код:
mkdir /opt/etc
mkdir /opt/etc/init.d
vi /opt/etc/init.d/rc.unslung
Remark: If you get a "mkdir: Cannot create directory `/opt/etc': Read-only file system" your HDD (here the IPKG pertition) is NOT mounted.

Content:
Цитата:
#! /bin/sh

# Start/stop all init scripts in /opt/etc/init.d
# starting them in numerical order and
# stopping them in reverse numerical order
#
if [ $# -ne 1 ]; then
printf "Usage: $0 {start|stop}\n" >&2
exit 1
fi

daemons=`echo $(/usr/bin/dirname $0)/S??*`
[ $1 = "stop" ] && daemons=`echo $daemons | /usr/bin/tr " " "\n" | /usr/bin/sort -r`

for i in $daemons; do

# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue

# Write to syslog
logger -t rc.unslung "$1 service $i"

case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set $1
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i $1
;;
esac
done
Make it executable:
Код:
chmod +x /opt/etc/init.d/rc.unslung
And this part is done
__________________
Ьbersicht aller HowTos --- HowTo Overview (mostly german)
WL-HDD mit diesem Setup. --- WL-HDD with this setup.
Kein Support per PM - Frage im jeweiligen Thread! --- No support via pm - ask in the according thread!
Eine wirklich gute Idee erkennt man daran, dass ihre Verwirklichung von vorne herein ausgeschlossen erscheint. (Albert Einstein)

Последний раз редактировалось wengi, 01-06-2010 в 16:06.
Ответить с цитированием
  #3  
Старый 15-08-2007, 09:43
wengi wengi вне форума
bungler
 
Регистрация: Feb 2005
Адрес: Germany - Frankfurt
Сообщения: 1,513
6. IPKG

IPKG is a package management system. You can install additional software with it.
IPKG works on your HDD in /opt. Thats why you created and mounted the IPKG partition in /usr/local/sbin/post-boot.
By the way: The log files are written to /opt/var/log.

The steps to install the package management system are:
create a directory.
Код:
mkdir -p /opt/tmp/ipkg 
cd /opt/tmp/ipkg
Download and install the packages (ignore all errors):
Код:
wget http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/ipkg-opt_0.99.163-10_mipsel.ipk
ipkg.sh install ipkg-opt_0.99.163-10_mipsel.ipk
wget http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/uclibc-opt_0.9.28-13_mipsel.ipk
ipkg.sh install uclibc-opt_0.9.28-13_mipsel.ipk
ipkg update
Use the following command to see which packages are installed:
Код:
ipkg list_installed
It looks like this:
Цитата:
[admin@blechbuechse ipkg]$ ipkg list_installed
ipkg-opt - 0.99.163-10 - The Itsy Package Manager
uclibc-opt - 0.9.28-13 - micro C library for embedded Linux systems
Successfully terminated.
You can keep your installation up to date in future.
Execute regularly:
Код:
ipkg update
ipkg upgrade
7. Midnight Commander (optional)

Install MC
Код:
ipkg install mc
Some settings are necessary for MC to run properly.
Код:
echo "export TERMINFO=/opt/share/terminfo">>/opt/etc/profile
echo "alias mc=\"mc -c\"">>/opt/etc/profile
make profile executable:
Код:
chmod +x /opt/etc/profile
8. Tools (optional)

These tools are very helpful. I recommend installing them even if they are not necessary. 1GB on the HDD is enough space, so:
Код:
ipkg install coreutils
ipkg install findutils
ipkg install diffutils
ipkg install screen
ipkg install nano
ipkg install procps
ipkg install less
ipkg install unzip
ipkg install hdparm
ipkg install man
ipkg install man-pages
ipkg install lynx
ipkg install e2fslibs
ipkg install e2fsprogs
9. CRON

Cron is a task scheduler.
Код:
ipkg install cron
Edit the cron startup script:
Код:
vi /opt/etc/init.d/S10cron
And replace the content with:
Код:
#!/bin/sh
#
# Startup script for cron

PIDFILE=/opt/var/run/cron.pid

case $1 in
 start)
   /opt/sbin/cron
   ;;
 stop)
   [ -f ${PIDFILE} ] && kill `cat ${PIDFILE}`  ;;
   *)
   echo "usage: $0 (start|stop)"
   exit 1
esac
Save and reboot:
Код:
flashfs save && flashfs commit && flashfs enable && reboot
Cron must be in the process list (ps) after a reboot.
Remark: If you installed procps you should execute:
Код:
ps axf
If cron is NOT listed as running process: Check the content of rc.unslung and post-boot.

If you want a task to be executed you have to make an entry to the crontab (/opt/etc/crontab)
Finished with cron
__________________
Ьbersicht aller HowTos --- HowTo Overview (mostly german)
WL-HDD mit diesem Setup. --- WL-HDD with this setup.
Kein Support per PM - Frage im jeweiligen Thread! --- No support via pm - ask in the according thread!
Eine wirklich gute Idee erkennt man daran, dass ihre Verwirklichung von vorne herein ausgeschlossen erscheint. (Albert Einstein)

Последний раз редактировалось wengi, 18-07-2010 в 23:35.
Ответить с цитированием
  #4  
Старый 15-08-2007, 09:43
wengi wengi вне форума
bungler
 
Регистрация: Feb 2005
Адрес: Germany - Frankfurt
Сообщения: 1,513
10. TRANSMISSION (The torrent Client)
You have some routine 'til here. So we start directly:
Код:
ipkg install transmission
ipkg install wget
Create working directories:
Код:
mkdir -p /tmp/harddisk/transmission/download
mkdir -p /tmp/harddisk/transmission/config/blocklists
chmod -R 770 /tmp/harddisk/transmission/
Config file:
Код:
vi /tmp/harddisk/transmission/config/settings.json
With this content:
Код:
{
    "blocklist-enabled": true,
    "dht-enabled": true,
    "download-dir": "/tmp/harddisk/transmission/download", 
    "encryption": 2, 
    "lazy-bitfield-enabled": true, 
    "open-file-limit": 64, 
    "peer-limit-global": 250, 
    "peer-limit-per-torrent": 60, 
    "peer-port": 51413, 
    "peer-port-random-enabled": false, 
    "peer-port-random-high": 65535, 
    "peer-port-random-low": 1024, 
    "peer-socket-tos": 8, 
    "pex-enabled": true, 
    "port-forwarding-enabled": false, 
    "preallocation": 1, 
    "proxy": "", 
    "proxy-auth-enabled": false, 
    "proxy-auth-password": "", 
    "proxy-auth-username": "", 
    "proxy-enabled": false, 
    "proxy-port": 80, 
    "proxy-type": 0, 
    "rpc-authentication-required": false, 
    "rpc-enabled": true, 
    "rpc-password": "", 
    "rpc-port": 9091, 
    "rpc-username": "", 
    "rpc-whitelist": "127.0.0.1,192.168.1.*", 
    "rpc-whitelist-enabled": true,
    "speed-limit-down": 500,
    "speed-limit-down-enabled": false,
    "speed-limit-up": 20,
    "speed-limit-up-enabled": true  
}
More config. These are changeing sometimes...

Create startup script:
Код:
vi /opt/etc/init.d/S90transmission-daemon
Content:
Код:
#!/bin/sh
#
# Startup script for transmission

case $1 in
 start)
        # update blocklist
        echo "updating blocklist"
        cd /tmp/harddisk/transmission/config/blocklists
        if wget -q -N --tries=3 --timeout=10 http://update.transmissionbt.com/level1.gz
          then
          if test -f level1.gz; then
             rm level1
             gunzip level1.gz
             chmod go+r level1
          fi
        else
          echo "Error $?. Blocklist NOT updated."
        fi

        # start transmission
        echo "starting transmission"
        nice /opt/bin/transmission-daemon -g /tmp/harddisk/transmission/config
   ;;

 stop)
        if [ -n "`pidof transmission-daemon`" ]; then
                echo "stopping transmission"
                kill -9 `pidof transmission-daemon`
        fi
   ;;
 restart|force-reload)
        $0 stop
        sleep 1
        $0 start
   ;;

 *)
        echo "usage: $0 (start|stop|restart|force-reload)"
        exit 1
esac
Make it executable and start it
Код:
chmod 755 /opt/etc/init.d/S90transmission-daemon
/opt/etc/init.d/S90transmission-daemon start
Check the transmission process with
Код:
ps axf
and browse (IE not supported) to
Цитата:
http://ASUSIPADRESS:9091
transmission is working
It is a good idea to use ONE widely distributed torrent for testing transmission.
Download the torrent file, click OPEN in the webinterface and select your torrent file.
You will find the download in /tmp/harddisk/transmission/download.

Transmission uses port 51413.
More information on transmission: http://www.nslu2-linux.org/wiki/Optware/Transmission

11. Logrotate for Syslog
Install logrotate
Код:
ipkg install logrotate
Create folder for syslog (not /tmp any more)
Код:
mkdir -p /opt/var/log/
Edit crontab
Код:
vi /opt/etc/crontab
and add the following line
Цитата:
0 0 * * * admin /opt/sbin/logrotate -f /opt/etc/logrotate.conf &>/dev/null
Edit logrotate:
Код:
vi /opt/etc/logrotate.conf
Substitute the complete content with this:
Цитата:
compress

/opt/var/log/syslog.log {
size 1024k
weekly
rotate 9
postrotate
killall -HUP syslogd
endscript
}

include /opt/etc/logrotate.d
Syslog needs to be started:
Код:
vi /opt/etc/init.d/S05syslogd
Content:
Код:
#!/bin/sh
#
# Startup script for syslog
#
PATH=/opt/bin:/opt/sbin:/opt/local/bin:/sbin:/bin:/usr/bin:/usr/sbin

LOGFILE=syslog.log
KERNLOGFILE=kern.log
LOG_OLD=/tmp
LOG_NEW=/opt/var/log

prefix=""
sbindir=${prefix}/sbin

NAME=syslogd
DAEMON=${sbindir}/${NAME}
DESC="syslogd"
OPTIONS="-m 0 -O $LOG_NEW/$LOGFILE -S -l 7 -s 0"

case "$1" in
start0)
printf "Starting ${DESC}: "
# Copy old syslog and create symlink to new
if [ ! -L /tmp/syslog.log ]; then
cat $LOG_OLD/$LOGFILE >> $LOG_NEW/$LOGFILE
mv $LOG_OLD/$LOGFILE $LOG_NEW/$KERNLOGFILE
ln -s $LOG_NEW/$LOGFILE $LOG_OLD/$LOGFILE
fi
${DAEMON} ${OPTIONS}
printf "${NAME}.\n"
logger -t ${NAME} "started."
;;
stop)
if [ -n "`pidof syslogd`" ]; then
printf "Stopping ${DESC}: "
killall "${NAME}"
printf "${NAME}.\n"
fi
;;
start|restart|force-reload)
$0 stop
sleep 1
$0 start0
;;
*)
printf "Usage: $0 {start|stop|restart|force-reload}\n" >&2
exit
;;
esac

exit 0
And must be executable:
Код:
chmod +x /opt/etc/init.d/S05syslogd
To be sure, you know what will come, save and reboot:
Код:
flashfs save && flashfs commit && flashfs enable && reboot
__________________
Ьbersicht aller HowTos --- HowTo Overview (mostly german)
WL-HDD mit diesem Setup. --- WL-HDD with this setup.
Kein Support per PM - Frage im jeweiligen Thread! --- No support via pm - ask in the according thread!
Eine wirklich gute Idee erkennt man daran, dass ihre Verwirklichung von vorne herein ausgeschlossen erscheint. (Albert Einstein)

Последний раз редактировалось wengi, 04-10-2009 в 12:25.
Ответить с цитированием
  #5  
Старый 15-08-2007, 09:44
wengi wengi вне форума
bungler
 
Регистрация: Feb 2005
Адрес: Germany - Frankfurt
Сообщения: 1,513
12a. original SAMBA
Samba will show your local HDD in the windows network.
oleg integrated a good working samba version from firmware -9 on.
You activate it in the web interface USB Application -> Samba.

Simply choose "All partitions" for Samba File Shares and a Default Access Level of "read/write".
Do not forget to enter your hostname and workgroup.

12b. IPKG SAMBA
I recommend using samba as in the chapter above. This chapter is for the advanced users who want more flexibility.
Samba has to be disabled in the webinterface!

Код:
ipkg install xinetd
ipkg install samba2
You have to change /opt/etc/init.d/S10xinetd to work with the start|stop feature of rc.unslung.
Код:
vi /opt/etc/init.d/S10xinetd
content:
Код:
#! /bin/sh
#
# Startup script for xinetd
#
prefix=/opt
sbindir=${prefix}/sbin

NAME=xinetd
DAEMON=${sbindir}/${NAME}
DESC="xinetd"
PIDFILE="/var/run/xinetd.pid"
OPTIONS="-pidfile $PIDFILE"
CONFDIR="/opt/etc/xinetd.d"

# installation check
test -x ${DAEMON} || exit 0

case "$1" in
    start)
        if [ -z "`pidof ${NAME}`" ] ; then
            printf "Starting ${DESC}: "
            ${DAEMON} ${OPTIONS}
            printf "${NAME}.\n"
        fi
    ;;
    stop)
        if [ -n "`pidof ${NAME}`" ]; then
          printf "Stopping ${DESC}: "
          kill -SIGTERM `cat $PIDFILE`
          printf "${NAME}.\n"
          for i in ${CONFDIR}/* ; do
            if [ -n "`grep "^[[:space:]]*disable[[:space:]]*=[[:space:]]*no" ${i}`" ] ; then
              daemon="`basename $(awk -F= '/^[[:space:]]*server[[:space:]]*=[[:space:]]*.*/{print $2}' ${i})`"
              printf "Stopping ${daemon}: "
              kill "`pidof ${daemon}`" > /dev/null 2>&1
              printf "${daemon}.\n"
            fi
          done
        fi
    ;;
    reload|reconfigure)
        if [ -n "`pidof ${NAME}`" ]; then
            printf "Reloading ${DESC}: "
            kill -SIGHUP `cat $PIDFILE`
            printf "${NAME}.\n"
        fi
    ;;
    restart|force-reload)
        $0 stop
        sleep 1
        $0 start
    ;;
    *)
        printf "Usage: $0 {start|stop|reload|reconfigure|restart|force-reload}\n" >&2
        exit
    ;;
esac

exit 0
To make this clear: Stopping xinetd will stop all registered services. Restarting xinetd will stop all services and start only xinetd itself.

Edit the conf for swat:
Код:
vi /opt/etc/xinetd.d/swat
You should cutomize the IP settings as you need them and exchange "user = root" with admin -> "user = admin".

Save... reboot... You know... i do this too often, but to be shure...
Код:
flashfs save && flashfs commit && flashfs enable && reboot
Samba and xinetd are running after the reboot.
But samba still needs to be configured. This is done with a webinterface:
Код:
http://IP.ADRESS.OF.ASUS:901
Goto "Globals":
- Change "workgroup" to your workgroup.
- "netbios name" is the name of your asus (for me again blechbuechse).
- "hosts allow" should be your subnet e.g. "192.168.1." (leave out the last number)
- "guest account" is 'admin'.
Commit changes with "Commit Changes". (You never would have known this )
Changes in globas need a restart to take effect!

goto "Shares":
- Insert "torrent" beside "create share" and press "create share".
- "comment": "torrent files"
- "path": "/tmp/harddisk/torrent"
- "read only" NO
- "guest ok" YES
- "browseable" YES
- Press "commit changes".

The settings take effect immediately. No reboot necessary.
You should see your asus in the windows network now.
__________________
Ьbersicht aller HowTos --- HowTo Overview (mostly german)
WL-HDD mit diesem Setup. --- WL-HDD with this setup.
Kein Support per PM - Frage im jeweiligen Thread! --- No support via pm - ask in the according thread!
Eine wirklich gute Idee erkennt man daran, dass ihre Verwirklichung von vorne herein ausgeschlossen erscheint. (Albert Einstein)

Последний раз редактировалось wengi, 16-12-2008 в 11:01.
Ответить с цитированием
  #6  
Старый 15-08-2007, 09:45
wengi wengi вне форума
bungler
 
Регистрация: Feb 2005
Адрес: Germany - Frankfurt
Сообщения: 1,513
13. NLOAD
You can see your network load with nload.

Код:
ipkg install nload
This is for a DSL 2000 (2000kbit/sec down- 256kbit/sec upstream):
Код:
nload -t 200 -s 7 -i 2048 -o 256 -u H eth1
14. Adjust profile
To make life easier at the command promt you will add some alias.
Код:
vi /opt/etc/profile
The file should be executable (chmod ...).
The content (Edit the nload settings!):
Цитата:
# Some alias for making life easier

# To start nload with DSL 6000 settings: 'nld'
alias nld="nload -t 200 -s 7 -i 6656 -o 640 -u H eth1"

# Make ls default -la with color coding
alias ls="ls --color=auto -la"

# Make pss a grep ps function
alias pss="ps axf | grep"

# df human readable (Only works with coreutils installed!)
# alias df="df -h"
There is one more line if you installed midnight commander.

Make it executable:
Код:
chmod +x /opt/etc/profile
Save, reboot:
Код:
flashfs save && flashfs commit && flashfs enable && reboot
You can verify your modification by entering 'alias':
Цитата:
[admin@blechbuechse root]$ alias
ls='ls --color=auto -la'
nld='nload -t 200 -s 7 -i 6656 -o 640 -u H eth1'
pss='ps axf | grep'
15. Automate SSH login
Until now you need to insert user and password for every ssh login. I assume you are as lazy as i am. So we will do this with keys.
First you need to create a pair of keys. For Windows this is done with PuttyGen.
Start, press generate and move your mouse until the key is generated.
The field "Key comment" is used to identify the keys, if there are more than one. Insert your name here.

Save the private key as file:
You can save your private key with a passphrase. This is for security reasons. Enter a passphrase.
Press "Save private Key" and save your private key to a file. (e.g. C:\keys\mykey.ppk)

Save the public key on the Asus:
Copy the content of the upper, grey field to the clipboard. The key shold look like this:
Цитата:
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAn+NorNZlb9xhogR2DfNq6R qRg04KKXm2t4WIxj/0NWxjOVUAg4fFl2diA+3+f7gjIPdyEJnGUhkfgckYqhfMoZswr TjtvjP00p5O/LPcvGxzpy0XOBty1NQjcYOrOMC6BFrp6Rh0cVThF+sdAYXogn6 w49GOoSvKdgcTLCDubyM= testkey
YOUR KEY SHOULD LOOK DIFFERENT! THIS IS ONLY AN EXAMPLE.

You need a special directory to store your public key in. This is in the root/admin home directory:
Код:
mkdir /usr/local/root/.ssh
Edit the file
Код:
vi /usr/local/root/.ssh/authorized_keys
and insert the content of your clipboard. One line per key, no line feeds!
Multiple keys can be inserted here and are seperated by a new line. One line for each key.

This part of the filesystem is in the flash so you have to save it:
Код:
flashfs save && flashfs commit && flashfs enable && reboot
Next step is to tell putty to use the key:
Configure putty:
"Connection - Data" bei "Auto-login username" enter the username: admin
"Connection - SSH - Auth" at "Private key file for authentication" Enter the file saved in the above step (e.g. C:\keys\mykey.ppk)
Do not forget to save (Session - Save)

Your login should look like this now:
Цитата:
Using username "admin".
Authenticating with public key "testkey"
[admin@blechbuechse root]$
Optional: Disable login with passwort
The option "dropbear -s" disables login with password. Only login with keys will be possible!
Edit /usr/local/sbin/post-boot to modify the option for start.
Insert a "-s" directly behind dropbear.
ATTENTION: If you loose your key you are locked out! Use this with care!

Do not forget to save and reboot.

16. Open SSH port to Internet (if directly connected)
You have to open port 22 in your firewall to connect to your router over internet. If your Asus is directly connected to the internet and in home gateway mode you can do this directly. The firewall is iptables.
Remark: This is a security risk! Be sure to set at least a strong password for your users!!! Have a look at THIS for a secure sshd config.

Edit your /usr/local/sbin/post-firewall and insert:
Код:
#!/bin/sh
# this opens the ssh port to internet! Be sure to have strong passwords!
iptables -I INPUT -m tcp -p tcp --dport 22 -j ACCEPT
And don't forget to save!
Hint: The iptables command above can also be used to open other ports.
__________________
Ьbersicht aller HowTos --- HowTo Overview (mostly german)
WL-HDD mit diesem Setup. --- WL-HDD with this setup.
Kein Support per PM - Frage im jeweiligen Thread! --- No support via pm - ask in the according thread!
Eine wirklich gute Idee erkennt man daran, dass ihre Verwirklichung von vorne herein ausgeschlossen erscheint. (Albert Einstein)

Последний раз редактировалось wengi, 04-10-2009 в 12:29.
Ответить с цитированием
  #7  
Старый 15-08-2007, 09:45
wengi wengi вне форума
bungler
 
Регистрация: Feb 2005
Адрес: Germany - Frankfurt
Сообщения: 1,513
17. Optimize performance
This chapter is for advanced users. You should not do this if you are a newbie.

Your Asus is completely setup now. Only some optimization regarding the performance is to be done.
This is to keep as much processor and memory free as possible. Even the WL-HDD only has 16MB RAM and a 125MHz CPU. Not that much...
The goal is to start services only if they are needed.
This works with xinetd. Here is a description.

A) Start samba with xinetd

This chapter is using the original samba of the firmware. If you installed the IPKG samba you will have to change the path /usr/sbin/ to /opt/...

I only need samba for moving my torrent files. So this is rather seldom.
This is why i atart samba with xinetd. To keep system resources free for transmission.
Your samba must work for 100% before making this step!

If xinetd is not installed until now:
Код:
ipkg install xinetd
You have to change /opt/etc/init.d/S10xinetd to work with the start|stop feature of rc.unslung.
Do this as it is described in chapter 12b). Only the part with the content of S10xinetd!

samba comprises two daemons:
Код:
vi /opt/etc/xinetd.d/netbios-ssn
Content:
Цитата:
service netbios-ssn
{
disable = no
socket_type = stream
protocol = tcp
port = 139
user = admin
wait = no
only_from = localhost 192.168.XXX.1/24
server = /usr/sbin/smbd
}
And the second:
Код:
vi /opt/etc/xinetd.d/netbios-ns
Content:
Цитата:
service netbios-ns
{
disable = no
socket_type = dgram
protocol = udp
port = 137
user = admin
wait = yes
only_from = localhost 192.168.XXX.1/24
server = /usr/sbin/nmbd
}
You have to fit the IP Settings for your own needs!

There should already be a /etc/smb.conf. If not you will have to create it. This one shares the data partition with read/write for everyone.
Код:
[global]
        interfaces = br0
        bind interfaces only = yes
        workgroup = YOURWORKGROUP
        server string = YOURHOSTNAME
        guest account = nobody
        security = share
        browseable = yes
        guest ok = yes
        guest only = yes
        log level = 1
        max log size = 100
        encrypt passwords = no
        preserve case = yes
        short preserve case = yes
        client code page = 850

[disc0_3]
        path = /tmp/mnt/disc0_3
        writable = yes
        force user = admin
You have to edit Name and workgroup in this file too!

Now you have to make shure that the /etc/smb.conf is stored before a reboot:
Код:
echo "/etc/smb.conf" >> /usr/local/.files && flashfs save && flashfs commit && flashfs enable
Samba must not run as daemon. You have to disable it in the webinterface and accept the restart now.

and if you installed samba with IPKG you have to delete the startup file:
Код:
rm /opt/etc/init.d/S80samba
B) Unload unnecessary kernel modules

Attention: You should know which modules you need, before unloading them in post-boot.

List all running modules:
Код:
lsmod
It is looking like this:
Цитата:
[admin@blechbuechse root]$ lsmod
Module Size Used by
nfsd 93016 1
lockd 64236 1 [nfsd]
sunrpc 83480 1 [nfsd lockd]
usb-storage 62184 0 (unused)
sd_mod 13292 0 (unused)
scsi_mod 70216 1 [usb-storage sd_mod]
printer 12676 0 (unused)
usb-ohci 21940 0 (unused)
usbcore 77264 1 [usb-storage usb-ohci]
ipt_NETMAP 992 0 (unused)
ip_nat_starcraft 2224 0 (unused)
wl 423856 0 (unused)
et 34912 0 (unused)
ide-disk 13524 3
ide-probe-mod 11468 0
ide-mod 109608 3 [ide-disk ide-probe-mod]
You have to know which modules are unnecessary. 'Unused' is (sometimes) a good advice.

This is how you unload a module:
Код:
rmmod MODULNAME
Unloading the module 'et'is not a good idea because network will not work anymore. (Happend to me at this moment )

Try this modules:

printer - printer support
usb-storage - USB mass storage
usb-ohci - USB host
usbcore - USB main component
wl - WLAN

It would be nice to have a complete list of all modules here. contact me if you can provide information.

Unload a module and check if all the services are still working.
If there is something wrong: Do a reboot!
After knowing the possible modules you can edit the post-boot and paste the unload commands.

18. Firmwareupdate
If oleg releases a new firmware you should update:

1) In webinterface 'System Setup' -> 'Setting Management' click "HERE", to save your settings.
2) In webinterface 'System Setup' -> 'Flashfs Management' click "HERE", to seve the flash file system.
3) Download and extract the new firmware. You need the .trx file.
Important: Wait for the reboot after every following step.
4) In webinterface 'System Setup' -> 'Firmware Upgrade' select the .trx file and click 'Upload'.
5) In webinterface 'System Setup' -> 'Setting Management' select your saved settings and click 'Upload'.
6) In webinterface 'System Setup' -> 'Flashfs Management' select your saved flashfs and click 'Upload'.

The update is finished and all services should be accessible.
There will be no data lost.

General
I try to keep this HowTo up to date.
Contact me if you have some improvement or you found a mistake.

There are several HowTos following this one.
Soundcards, webserver, mysql and so on.
FIND IT HERE: http://wl500g.info/showpost.php?p=160532&postcount=1

Known problems:

- a 'find' in / results in an error "./proc/7/fd: No such file or directory". Thats normal.

Thanks to:

Oleg (for the firmware)
marcnesium (for his premium How To)
Oleo (for transmission and good help)
My wife (for the patience)

Martin1802 (for finding a mistake in step 4a / 4b and supporting me with the profile)
hanseugen (for USB HDD und Cron-Tips)
And all others who helped me improving this howto.

Important links:
http://www.nslu2-linux.org/wiki/Optware/Transmission (Step-by-Step Howto for transmission)
http://wl500g.info/showthread.php?t=6823 (Controlling torrent downloads thru webpage)
http://wl500g.info/showthread.php?t=5909 (Premium HowTo)
http://www.macsat.com/macsat/content/category/3/13/29/ (MacSat Tutorials)
http://wl500g.info/showthread.php?t=8010 (How to connect to dbox2)
http://www.sprayfly.com/wiki/Sprayfly (Sprayfly WL-HDD Wiki)
http://wl500g.info/showpost.php?p=25037&postcount=1 (summary of Olegs firmware versions)
http://wl500g.info/showthread.php?t=6826 (Autocopy funktion for the photographer of you)
http://wl500g.info/showthread.php?t=13785 (Information on boot files and fstab in firmwares -9 and newer)

For those of you who want to be up to date with the development:
http://trac.nslu2-linux.org/optware/timeline Shows all changes.
__________________
Ьbersicht aller HowTos --- HowTo Overview (mostly german)
WL-HDD mit diesem Setup. --- WL-HDD with this setup.
Kein Support per PM - Frage im jeweiligen Thread! --- No support via pm - ask in the according thread!
Eine wirklich gute Idee erkennt man daran, dass ihre Verwirklichung von vorne herein ausgeschlossen erscheint. (Albert Einstein)

Последний раз редактировалось wengi, 12-07-2010 в 14:10.
Ответить с цитированием
  #8  
Старый 15-08-2007, 09:46
wengi wengi вне форума
bungler
 
Регистрация: Feb 2005
Адрес: Germany - Frankfurt
Сообщения: 1,513
Happy working with your "new" Asus.
May the force be with you.

wengi
__________________
Ьbersicht aller HowTos --- HowTo Overview (mostly german)
WL-HDD mit diesem Setup. --- WL-HDD with this setup.
Kein Support per PM - Frage im jeweiligen Thread! --- No support via pm - ask in the according thread!
Eine wirklich gute Idee erkennt man daran, dass ihre Verwirklichung von vorne herein ausgeschlossen erscheint. (Albert Einstein)
Ответить с цитированием
  #9  
Старый 24-08-2007, 16:26
super101 super101 вне форума
Registered User
 
Регистрация: Aug 2007
Сообщения: 4
Thumbs up

Thanks so much, it spent me more than a week now, I couldn't finish everything without your great tutorial. Great tutorial!
Ответить с цитированием
  #10  
Старый 24-08-2007, 19:44
wengi wengi вне форума
bungler
 
Регистрация: Feb 2005
Адрес: Germany - Frankfurt
Сообщения: 1,513
Happy to hear it was helpfull for you.

wengi
__________________
Ьbersicht aller HowTos --- HowTo Overview (mostly german)
WL-HDD mit diesem Setup. --- WL-HDD with this setup.
Kein Support per PM - Frage im jeweiligen Thread! --- No support via pm - ask in the according thread!
Eine wirklich gute Idee erkennt man daran, dass ihre Verwirklichung von vorne herein ausgeschlossen erscheint. (Albert Einstein)
Ответить с цитированием
  #11  
Старый 25-08-2007, 15:38
TinyRK TinyRK вне форума
Member
 
Регистрация: Jul 2005
Сообщения: 31
Awesome! Good work guys.

One question, there is possibility to just provide us with a config;file which has already everything integrated?

Последний раз редактировалось TinyRK, 31-08-2007 в 19:42.
Ответить с цитированием
  #12  
Старый 26-08-2007, 06:46
wengi wengi вне форума
bungler
 
Регистрация: Feb 2005
Адрес: Germany - Frankfurt
Сообщения: 1,513
Hi,

1) I am not the guy to build firmware. So i am not your man.
2) There will never be a firmware with "everything integrated" because you never know who need which comonents and some components will never work together.
3) (And the important one) If anybody over here will provide a "all-in-one firmware" you would install it and have no idea how to use it. So the questions would start again. And there would be howtos for using the things. In my eyes its better you learn by modifying your own firmware.

Learning by doing!

wengi
__________________
Ьbersicht aller HowTos --- HowTo Overview (mostly german)
WL-HDD mit diesem Setup. --- WL-HDD with this setup.
Kein Support per PM - Frage im jeweiligen Thread! --- No support via pm - ask in the according thread!
Eine wirklich gute Idee erkennt man daran, dass ihre Verwirklichung von vorne herein ausgeschlossen erscheint. (Albert Einstein)
Ответить с цитированием
  #13  
Старый 10-09-2007, 14:31
wengi wengi вне форума
bungler
 
Регистрация: Feb 2005
Адрес: Germany - Frankfurt
Сообщения: 1,513
From PM:
Цитата:
Сообщение от carry
hi,wengi
got a problem

putty connect to WL-HDD
network error:connection refused.

how to

thanks.
Цитата:
Сообщение от wengi
More input! From LAN or internet?
Firewall? What are you doing EXACTLY?

wengi
Цитата:
Сообщение от carry
From LAN ,no Firewall

AT 4b. Startup-scripts

APPEND the following line:
Quote:
echo "nameserver IP.OF.DNS.SERVER" > /etc/resolv.conf

when save and reboot then putty connection refused
You only need this line if your Asus is NOT configured as Router to connect to the internet. If you are NOT using it as router try to use DHCP (If you have a DHCP Server in your LAN) for the first step.

You can ping your Asus and connect to the Webinterface?

wengi
__________________
Ьbersicht aller HowTos --- HowTo Overview (mostly german)
WL-HDD mit diesem Setup. --- WL-HDD with this setup.
Kein Support per PM - Frage im jeweiligen Thread! --- No support via pm - ask in the according thread!
Eine wirklich gute Idee erkennt man daran, dass ihre Verwirklichung von vorne herein ausgeschlossen erscheint. (Albert Einstein)
Ответить с цитированием
  #14  
Старый 11-09-2007, 04:23
carry carry вне форума
Registered User
 
Регистрация: Sep 2007
Сообщения: 1
Yes, I can ping,telnet and connect to the Asus Webinterface.
also can set IP Address and Gateway...
my Asus is as a client in the network.

the point is when i add this line:
echo "nameserver IP.OF.DNS.SERVER" > /etc/resolv.conf
save and reboot

then use putty program SSH connect to Asus

PuTTY Fatal Error
network error:connection refused
Ответить с цитированием
  #14  
Старый 11-09-2007, 04:23
AsusForum carry вне форума
Member
 
Регистрация: Nov 2003
Адрес: Netherlands
Сообщения: 1
  #15  
Старый 11-09-2007, 07:55
wengi wengi вне форума
bungler
 
Регистрация: Feb 2005
Адрес: Germany - Frankfurt
Сообщения: 1,513
Just to be sure: You replaced the "IP.OF.DNS.SERVER" with the IP adress of your DNS server?
This line for _my_ network looks like this:
Код:
echo "nameserver 192.168.201.1" > /etc/resolv.conf
wengi
__________________
Ьbersicht aller HowTos --- HowTo Overview (mostly german)
WL-HDD mit diesem Setup. --- WL-HDD with this setup.
Kein Support per PM - Frage im jeweiligen Thread! --- No support via pm - ask in the according thread!
Eine wirklich gute Idee erkennt man daran, dass ihre Verwirklichung von vorne herein ausgeschlossen erscheint. (Albert Einstein)
Ответить с цитированием
Ответ

Tags
howto, install soft

Опции темы
Опции просмотра Оценка этой теме
Оценка этой теме:

Ваши права в разделе
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Вкл.
[IMG] код Вкл.
HTML код Выкл.

Быстрый переход


Часовой пояс GMT +1, время: 22:23.


Copyright ©2003 - 2008, van Boekel Networks
Вы оценили эту тему: