Joined: 07 Mar 2010 Posts: 14 Location: Fullerton, CA. USA & Florianopolis, SC Brazil
Posted: Tue Mar 01, 2011 16:02 Post subject: Going from Tomato to DD-WRT
I am trying to get familiar with DD-WRT, so I loaded v24-sp2 (11/02/09) std on my WRT54G v3 router that has been running Tomato v1.28. All went well until I got to the issue of Scripts. I currently have several scripts loading in Tomato and I would like to continue to have those run in DD-WRT. But I noted there is a different way of handling scripts in DD-WRT, so I thought I would ask for help.
Can I run the same scripts in DD-WRT that I run in Tomato, is the syntax the same?
There are minor differences in the syntax of scripts but it should be trivial to fix. I switched from Tomato to dd-wrt and adapted my scripts. _________________ WHR-HP-G54 running DD-WRT v24 VPN build 14896
Joined: 07 Mar 2010 Posts: 14 Location: Fullerton, CA. USA & Florianopolis, SC Brazil
Posted: Fri Apr 08, 2011 14:13 Post subject:
LLigetfa, thanks for replying. Since DD-WRT handles scripts in a different manor my first problem was trying to figure out where and how to install them.
My scripts in Tomato are placed in the following locations:
Init - two scripts (one for one setting up a vlan so I can view my modem that is on a different subnet and the second for establishing a way for me to use WOL)
Firewall - one script (used for access to my modem on the vlan)
WAN Up - one script (used to setup ad blocking)
I was not sure how and even where to enter those scripts and whether the syntax was the same.
Joined: 07 Mar 2010 Posts: 14 Location: Fullerton, CA. USA & Florianopolis, SC Brazil
Posted: Fri Apr 08, 2011 14:43 Post subject:
Here are my Init scripts:
#Assign an address to vlan1 port in different subnet
sleep 10
ip addr add 192.168.0.13/24 dev vlan1 brd +
#Setup WOL Broadcast Address
ip neigh change 192.168.122.254 lladdr ff:ff:ff:ff:ff:ff nud permanent dev br0
ip neigh add 192.168.122.254 lladdr ff:ff:ff:ff:ff:ff nud permanent dev br0
My Firewall script:
#Route anything for this subnet via vlan1
#and access the modem at 192.168.0.1 on vlan1
iptables -I POSTROUTING -t nat -o vlan1 -d 192.168.0.1/24 -j MASQUERADE
My WAN Up script:
#logger WAN UP Script Executing
sleep 5
test -s /tmp/dlhosts
if [ $? == 1 ] ; then
echo -e "#!/bin/sh\nwget -O - http://www.mvps.org/winhelp2002/hosts.txt | grep 127.0.0.1 | sed -e '2,\$s/127.0.0.1/0.0.0.0/g' -e 's/[[:space:]]*#.*$//' > /etc/hosts\nlogger DOWNLOADED http://www.mvps.org/winhelp2002/hosts.txt\nkillall -1 dnsmasq" > /tmp/dlhosts
chmod 777 /tmp/dlhosts
/tmp/dlhosts
fi
cru a Gethosts "30 03 * * 3 /tmp/dlhosts"