Update for Oleg 1.9.2.7-7f with Samba2 and Transmission
This guide is written supposing that your PC runs Windows, and you want to use your router as file server and Torrent client. My objective was to setup Oleg 1.9.2.7-7f with Transmission and Samba2.
Step 1 - Install required HW and SW
1) Connect your PC to the wl-500gP using an ethernet cable (you should not use wireless during Step 1), and make sure that you can connect to the Ethernet
2) Download and install putty and ASUS fw restoration utility
3) Download Oleg 1.9.2.7-7f firmware
4) Unplug all USB devices from the router, and disconnect the modem cable
5) Using the web interface, reset the router to factory settings
6) Put the router in restoration mode
7) Start ASUS firmware restoration utility and load Oleg fw into the router. Do not interrupt this step, the router may have to be repaired or replaced if you interrupt the load. The router will reboot automatically
8) Connect modem to router, and parametrize it using web interface (at this stage userid/password is admin/admin). Here are some of my parameters:
- Maintain 192.168.1.1 as the router's IP address, and limit DHCP to 192.168.1.2/24
- Activate Telnet and DDNS
- Deactivate ftp and samba
- Allow ping from WAN side
- If you use wireless, select 32mW as the transmission power and activate the maximum possible security supported by your PC's (in my case WEP128 + mac access + hide SSID)
- In LAN IP Setting / Host name specify a hostname of your choice (mine is MyASUS)
9) Reboot the router (using web interface)
You may have to calibrate the wireless part (it took me about 2 weeks to reach an acceptable setup). You can use NetStumbler to help you.
Step 2 - Prepare disk
1) Connect disk to router
2) Start putty in Windows (all the remaining actions should be performed in line mode, not web interface). Point it to 192.168.1.1, telnet, keyboard with Linux function keys. You can save 3 profiles in putty, one for Telnet (from LAN), and two for SSH (from LAN and WAN). Paste lines in putty with right click on mouse.
3) Format the disk with 3 primary partitions, first with +512M for swap (select type 82), second with +1G (for /opt), and 3rd with the rest. Use fdisk help to guide you.
Code:
insmod scsi_mod && insmod sd_mod && insmod usb-storage && sleep 5s
fdisk /dev/discs/disc0/disc
4) Reboot
5) Format and mount the disk
Code:
insmod scsi_mod && insmod sd_mod && insmod usb-storage && sleep 5s
mkswap /dev/discs/disc0/part1
swapon /dev/discs/disc0/part1
mke2fs -j /dev/discs/disc0/part2
mount /dev/discs/disc0/part2 /opt
mke2fs -j /dev/discs/disc0/part3
6) Install base packages (ignore errors regarding wl500g):
Code:
cd /opt/
mkdir /opt/tmp
mkdir /opt/tmp/ipkg
wget http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/ipkg-opt_0.99.163-9_mipsel.ipk
ipkg.sh install ipkg-opt_0.99.163-9_mipsel.ipk
wget http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/uclibc-opt_0.9.28-12_mipsel.ipk
ipkg.sh install uclibc-opt_0.9.28-12_mipsel.ipk
ipkg update
ipkg install nano
rm *.ipk
7) Create startup scripts and install dropbear
Code:
mkdir -p /usr/local/etc/dropbear
dropbearkey -t dss -f /usr/local/etc/dropbear/dropbear_dss_host_key
dropbearkey -t rsa -f /usr/local/etc/dropbear/dropbear_rsa_host_key
mkdir -p /usr/local/sbin
nano /usr/local/sbin/post-boot
Here is my post-boot file:
Code:
#!/bin/sh
# Start SSH service
dropbear
# test if USB disc has been attached
# if not - then insert needed modules
if [ ! -d /dev/discs ]
then
insmod scsi_mod && insmod sd_mod && insmod usb-storage && sleep 5s
fi
# Wait for /opt to mount
mount /dev/discs/disc0/part2 /opt
mount /dev/discs/disc0/part3 /tmp/harddisk
i=0
while [ $i -le 30 ]
do
if [ -d /opt/etc ]
then
break
fi
sleep 1
i=`expr $i + 1`
done
# Activate swap
swapon /dev/discs/disc0/part1
#to let midnight commander run on terminals, make alias for colored mc
echo "export TERMINFO=/opt/share/terminfo">>/etc/profile
echo "alias mc=\"mc -c\"">>/etc/profile
# Run all active services - active means starts with S
/opt/etc/init.d/rc.unslung
Next let's create the post-firewall file
Code:
nano /usr/local/sbin/post-firewall
Here is my post-firewall
Code:
#!/bin/sh
## FIREWALL
## set default policy
iptables -P INPUT DROP
## deny ftp access from WAN
iptables -I INPUT 1 -p tcp -i "$1" --syn --dport 21 -j DROP
## Allow access to various router services from WAN
## Ports 22 and 65534 are required by dropbear and transmission
for P in 65534 22; do
iptables -I INPUT 1 -p tcp --syn -i "$1" --dport $P -j ACCEPT
done
Create remaining files:
Code:
touch /usr/local/sbin/post-mount
touch /usr/local/sbin/pre-shutdown
chmod +x /usr/local/sbin/*
8) Save to flash and reboot
Code:
flashfs save && flashfs commit && flashfs enable && reboot
At the end of this Step2 the router should be able to boot, mount the disk, and use the swap. You can verify this with
This should produce an output similar to
Code:
[xxxx@MyASUS root]$ mount
/dev/root on / type squashfs (ro)
none on /dev type devfs (rw)
proc on /proc type proc (rw)
ramfs on /tmp type ramfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/discs/disc0/part2 on /opt type ext3 (rw)
/dev/discs/disc0/part3 on /tmp/harddisk type ext3 (rw)
[xxxx@MyASUS root]$ free
total used free shared buffers
Mem: 30140 13744 16396 0 4148
Swap: 500712 0 500712
Total: 530852 13744 517108
Step3 - Install samba2
Samba2 comes with a web interface from where you can parametrize and restart the service without rebooting the router.
Code:
ipkg install mc
ipkg install xinetd
ipkg install samba2
Create folder for samba shares
Code:
mkdir /tmp/harddisk/share
chmod ugoa+w /tmp/harddisk/share
Create rc.unslung (to start all your services automatically after each reboot)
Code:
nano /opt/etc/init.d/rc.unslung
Here is my rc.unslung file:
Code:
# Start all init scripts in /opt/etc/init.d
# executing them in numerical order.
#
for i in /opt/etc/init.d/S??* ;do
# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue
case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i start
;;
esac
done
Edit /opt/etc/xinetd.d/swat file (with nano or mc) to update the "user = root" line with your userid (such as "user = admin").
Make rc.unslung executable, and execute it to start xinetd and samba2
Code:
chmod +x /opt/etc/init.d/rc.unslung
/opt/etc/init.d/rc.unslung
Open your browser to http://192.168.1.1:901 and parametrize samba at your will. I have removed all shares and created two new ones:
- Share (pointing to /tmp/harddisk/share)
- Torrent (pointing to /tmp/harddisk/torrent)
Step4 - Install Tranmission
This was my choice for torrent client. It's easy to use. You can either store .torrent files in //myasus/torrent/source or use Transmission's fetch button. At the moment transmission is going through changes, so what follows may not apply in the near future.
Code:
ipkg install cron
ipkg install gnuplot
ipkg install logrotate
ipkg install transmission
Create torrent directories
Code:
cd /tmp/harddisk
mkdir torrent
mkdir torrent/source
mkdir torrent/target
mkdir torrent/work
chmod ugoa+w torrent
chmod ugoa+w torrent/source
chmod ugoa+w torrent/target
If your administration userid has been renamed from admin to something else, use mc to replace admin in /opt/etc/transmission.conf and /opt/share/www/cgi-bin/transmission.cgi.
Using mc, edit /opt/etc/transmission.conf to update TIMEZONE.
Edit opt/etc/crontab file. Mine is (replace xxxx with your admin userid):
Code:
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/bin:/opt/sbin:/opt/usr/bin:/opt/usr/sbin
MAILTO=""
HOME=/
# ---------- ---------- Default is Empty ---------- ---------- #
*/30 * * * * xxxx nice /opt/sbin/transmission_watchdog
0 0 * * * xxxx /opt/sbin/logrotate -f /opt/etc/logrotate.conf &>/dev/null
Create S05syslogd, this is necessary to replace logging on memory by logging on disk, and make it available for gnuplot.
Code:
nano /opt/etc/init.d/S05syslogd
Here is mine:
Code:
#!/bin/sh
#
# Startup script for syslogd
#
# Stop myself if running
if [ -n "`pidof syslogd`" ]; then
killall syslogd 2>/dev/null
fi
/sbin/syslogd -m 0 -O /opt/var/log/messages -S -l 7
Make it executable:
Code:
chmod +x /opt/etc/init.d/S05syslogd
Go to web interface, deactivate telnet and reboot. After that, you can access Transmission from Windows pointing your browser to http://192.168.1.1:8008/cgi-bin/transmission.cgi
Next Steps (optional)
1) Here are some suggestions
2) Activate ftp in web interface (to share /tmp/harddisk)
Web interface for SAMBA 2 not active ...
Hi there ...
Thanks a lot for the excellent tutorials ... for a linux beginner as me is this perfect. :p
I followed MoodyBlue's tutorial but can not get SAMBA working.
I can not connect to 192.168.1.1:901 for the web interface. The router webinterface 192.168.1.1 is working and accessible.
The services are started and running, did not get any error messages.
Does any one know how to solve this.
Thanks in advance!
Got Samba Webinterface working ...
I've found my problem by my self ... finally :)
Quote:
Originally Posted by
ant9
Hi there ...
Thanks a lot for the excellent tutorials ... for a linux beginner as me is this perfect. :p
I followed MoodyBlue's tutorial but can not get SAMBA working.
I can not connect to 192.168.1.1:901 for the web interface. The router webinterface 192.168.1.1 is working and accessible.
The services are started and running, did not get any error messages.
Does any one know how to solve this.
Thanks in advance!
MoodyBlue's Tutorial states ...
Edit /opt/etc/xinetd.d/swat file (with nano or mc) to update the "user = root" line with your userid."
I've changed this to "user = admin" and the process starts up normally :D
Bye
Ant9
Prepare USB-HDD - new mounting script
I modyfied the orginal HDD mounting script because it not work correct.
This is my post-boot file:
Code:
#!/bin/sh
#loop for /opt to mount
i=0
while [ $i -le 30 ]
do
# waiting to detect hdd
if [ -b /dev/scsi/host0/bus0/target0/lun0/part1 ]
then
break
fi
sleep 1
echo "${i}" >> /tmp/mount_ticks
i=$((i + 1))
done
# Mount partition 1 as /opt
mount /dev/scsi/host0/bus0/target0/lun0/part1 /opt 2>/tmp/mount_opt
# # Mount partition 5 as swap
swapon /dev/scsi/host0/bus0/target0/lun0/part5 2>/tmp/mount_swap
In /tmp directory are created additionally logs files
yet another samba problem
Hello,
New to forum, linux-type things, etc.
Problem:
I set up Oleg, HDD, Samba - everything OK
Then I set up ctorrent -> I suddenly lost access to "muzik"-folder on my HDD. RW-rights just vanished, and the strangest thing, I can still access my "video"-folder. I've tried to regain the rights but folder stays in "permission denied"-mode. I tried searching & googling, but no real results since I'm new to linux.
Could someone show me some pointers as I'm getting desperate: that USB-HDD is the only place I have that music!
Thanks in advance,
Tor
Post files only work manualy! Why??
Hello
My post-boot and post-mount only work manualy. Writing is names in the console.:(
Help please
Pedro Bernardino