terça-feira, junho 28, 2011

DD-WRT Dual / Triple WAN HowTo 3g/hsdpa connection

Here are steps a follow
nvram set vlan0ports="3 2 1 5*"
nvram set vlan1ports="4 5"
nvram set vlan2ports="0 5"
nvram set vlan2hwname=et0
nvram set wan_ifname=ppp0
nvram commit

change from web console

script this is for fixed ip, to dhcp change to use udhcpc with the script bellow...



if [ "$(nvram get wan2_ipaddr)" != "$WAN2_IPADDR" ]; then
nvram set wan2_ifname=$WAN2_IFNAME
nvram set wan2_ipaddr=$WAN2_IPADDR
nvram set wan2_gateway=$WAN2_GATEWAY
nvram set wan2_netmask=$WAN2_NETMASK
nvram set wan2_broadcast=$WAN2_BROADCAST
nvram commit

ifconfig $(nvram get wan2_ifname) $(nvram get wan2_ipaddr) netmask $(nvram get wan2_netmask) broadcast $(nvram get wan2_broadcast) up


cd /jffs/
wget http://www.jbarbieri.net/dd-wrt/scripts/iptables
cd /jffs/scripts/
wget http://www.jbarbieri.net/dd-wrt/scripts/firewall.firewall
wget http://www.jbarbieri.net/dd-wrt/scripts/routes.firewall
wget http://www.jbarbieri.net/dd-wrt/scripts/udhcpc-wan2.script

chmod 755 /jffs/iptables
chmod 755 /jffs/scripts/*

nvram set rc_startup='udhcpc -i vlan2 -p /var/run/udhcpc.pid -s /jffs/scripts/udhcpc-wan2.script

nvram set rc_firewall='/jffs/scripts/routes.firewall
nvram commit
The steps bellow is a work arround for routers (like mine) that cant mount any volume and do not have jffs support.

Using web dd-wrt go to Administration -> Commands
Paste de code bellow

echo "if [ ! -f /tmp/init.sh ]; then" > /tmp/get_init.sh
echo " echo \"get file init.sh on http://www.rc1.com.br/dd-wrt-scripts/init.sh\"" >> /tmp/get_init.sh
echo " /usr/bin/wget -O /tmp/init.sh http://www.rc1.com.br/dd-wrt-scripts/init.sh" >> /tmp/get_init.sh
echo "#else" >> /tmp/get_init.sh
echo "# echo \"file init.sh exist\"" >> /tmp/get_init.sh
echo "fi" >> /tmp/get_init.sh

click Save Startup

go to Administration -> Management
Enable Cron
Paste de code bellow to cron box
*/2 * * * * root /bin/sh /tmp/get_init.sh >> /var/log/messages 2>>/var/log/messages
*/3 * * * * root /bin/sh /tmp/init.sh >> /var/log/messages 2>>/var/log/messages

What is does is download all files from web and run them every 3 minutes

Nenhum comentário: