This step by step procedure was written specially for those who's just started command line jorney.
- Have WL-500g flashed with 1.9.2.7-CR4 firmware.
- Run telnet command and connect to the WL-500g.
> open my.router - Type in regular login and password.
- Check if directory /usr/local/sbin exists.
$ ls -l /usr/local/ - If not create such directory.
$ mkdir -p /usr/local/sbin - Create the post-boot, post-firewall or any other post processing scripts.
$ touch /usr/local/sbin/post-boot
$ touch /usr/local/sbin/post-firewall - Make them executable.
$ chmod +x /usr/local/sbin/post-boot
$ chmod +x /usr/local/sbin/post-firewall - Open one of above scripts with vi editor.
$ vi /usr/local/sbin/post-boot - In vi press i to enter simple insert mode. Type or paste in lines with commands you want (see examples).
Verify first line is like:
#!/bin/sh - Press ESC to leave insert mode of vi editor. Type :wq! and press ENTER to write changes and quit vi.
- Print file contents to screen and double check all lines.
$ cat /usr/local/sbin/post-boot
$ cat /usr/local/sbin/post-firewall - Launch vi editor again if corrections should be made.
- Store changes in flash memory.
$ flashfs save
$ flashfs commit
$ flashfs enable - Reboot your router.
Important! This does not mean reset of any type. - During next firmware upgrade all changes will be disabled but not erased. Activate them with command
$ flashfs enable
Post-boot script example:
#!/bin/sh route add -host [ftp.server.IP.address] gw [ISP.gateway.IP.address] dev eth1 iptables -t nat -A POSTROUTING -o eth1 -s 192.168.1.0/24 -j MASQUERADE
Post-firewall script example:
#!/bin/sh iptables -t nat -A POSTROUTING -o eth1 -s 192.168.1.0/24 -j MASQUERADE
