Friday, April 04, 2008

Setting up a WRT54G as a tftp server

Install SDCard mod
Although this option is not 100% necessary it does make things a lot easier for you in the long run.
-DangerzAU-


Once you have your SDCard modded as per the instructions here, you will need to add a few extra lines to your routers startup configuration.

In the DD-WRT web interface, click on Administration --> Commands
You will need to enter the following into the text box on this page, and then click the Save Startup button.
umount /jffs
mount -o bind /mmc /jffs


Effectivly what these two lines do are quite simple. The first un-mounts the default JFFS2 partition, and the second, well it mounts the sd-card (/mmc) as the /jffs partition.

Install OptWare packages

Now that you have the SDCard functioning, its time to install the OptWare packages. This will be required to allow the installation of Atftpd later in the guide.
The installation is actually quite simple, however most is done via the SSH or TelNet interface of your router.

~ # mkdir /jffs/opt
~ # mount -o bind /jffs/opt /opt


This will first create a new jffs folder for us to use as a virtual mount point, it then uses the bind option of the mount command to "virtual" mount this folder as our new /opt folder. Doing this allows us both read and write access to the /opt folder which is usually marked as read only on the WRT54G's squashFS filesystem.

The next step is to simply use a nice warm and fuzzy script thats been created to setup all the required packages/folders and config files for using OptWare

wget http://pastebin.ca/raw/876251 -O - tr -d '\r' > /tmp/optware-install.sh
sh /tmp/optware-install.sh


Effectively what this does is download the config file to the /tmp folder (Ram) and then runs that file to install optware.

The next step in the process is to add a few extra variables into the routers default path. This can be done with the following line:

export PATH=/opt/bin:/opt/sbin:$PATH
unset LD_LIBRARY_PATH


This needs to be put into the Start-up commands folder of your router via the web interface.

Installing ATFTP

Now that we have OptWare installed, its time to finish up by installing tftp.

this quite simple to do. all thats required is to issue the following command:
~ #/opt/bin/ipkg-opt install atftp


once that completes its just a matter of adding some routing and virtual network interfaces to the router to allow a modem to communicate with the router, hence working as its TFTP Server.

Add the following to your Startup Commands and all should be well..

export IPKG_CONF_DIR=/opt/etc
export PATH=$PATH:/opt/bin:/opt/sbin

ifconfig vlan1:0 192.168.100.10 netmask 255.255.255.0
ip route add default via 192.168.100.1 dev vlan1 table default
iptables -I INPUT -p udp -i vlan1 -d 192.168.100.10 --sport 1024:65535 --dport 69 -j ACCEPT

iptables -I INPUT -p udp -d 192.168.0.1 --dport 69 -j ACCEPT
iptables -t nat -I PREROUTING 1 -p udp --dport 69 -j DNAT --to 192.168.100.10:69

iptables -I INPUT 1 -p udp --dport 53 -j ACCEPT

Thats all it takes.

Save the startup config, and all as the say.. Is DONE!

How-to: Schedule your speakers to automatically mute overnight

The process is fairly simple. We need to use a free third party utility to allow the mute to take place. There are many utilities you could use for this such as NirCmd or Wizmo, but today to keep things simple I am going to use a program called Mute.

The next step is to set up a scheduled task to enable and disable these utilities. All of these utilities unload themselves from memory once they have run. This means that unmuting can still be controlled through your normal muting methods.

The setup for Vista and XP are slightly different, but you will find all the instructions after the jump

Start off by downloading your desired mute program and save it somewhere you can get to easily.

Windows XP:

Open “Scheduled Tasks” (inside accessories of the start menu)
Double Click “Add Scheduled Task”
Click “Next”
Browse to your utility; E.g. C:\mute.exe
Select when you want it to run. (I chose Daily).
Click “Next”
Select what time you want the task to run; E.g. 12:00am
Enter in your username and password
Click “Next”
Tick the Open Advanced Properties tick box
Click “Finish”
In the Run box, make it “C:\mute.exe on”

You will need to follow the steps above to make a second task to unmute your computer in the morning. You will need to change the name of it to unmute so that it does not conflict with the initial task.
This will need to have the off argument instead of on.

That’s it. Your computer should now mute and unmute itself at the times you specified.

Windows Vista:

The Vista setup is similar to the XP setup, but you get a few more options. You can set it to only occur if the computer has been idle for longer than 10 minutes. This means that your computer game or movie won’t be interrupted.

Open “Task Scheduler” (inside accessories of the start menu)
Click “Create New Task” (not basic)
Give it a name “Mute”
Go to the “Triggers” tab
Click “New” (defaults to schedule)
Enter the frequency and time you want the mute to occur
Click “OK”
Go to the “Actions” tab
Click “New” (defaults to run program)
Browse for your program and put in the necessary arguments; E.g. On
Click “OK”
Go to the “Conditions” tab
Here, define how long you want the computer to be idle before activating the mute.
Click “OK”

You will need to follow the steps above to make a second task to unmute your computer in the morning. You will need to change the name of it to unmute so that it does not conflict with the initial task. This will need to have the off argument instead of on.

That’s it. Your computer should now mute and unmute itself at the times you specified.

Conclusion:

As you can see, it is not overly hard to set this up. It is also not very hard to turn your speakers off when you go to bed. I am often forgetful though so this method is ideal for me.

LISTEN77 - Get your free mp3's here.

http://www.listen77.com/


Check it out.. search for a song... click on the song you want... When the popup window opens (I'm assuming your using firefox) simply press the control key + U and this will pop up the page source.

Simply do a search for .mp3 and you will soon see a rather long link... copy this link and paste it into your web browsers address bar... And BOOM.. the download dialogue appears asking where you would like to save your new mp3. Let it download.. you are now the proud owner of an mp3 you really wanted.. all thanks to Listen77.