Dual / Triple WAN HowTo | DHCP scripts on Page 5!!!!

Post new topic   This topic is locked: you cannot edit posts or make replies.    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page Previous  1, 2, 3 ... 62, 63, 64 ... 66, 67, 68  Next
Author Message
jbarbieri
DD-WRT Guru


Joined: 06 Apr 2007
Posts: 545
Location: New Hampshire

PostPosted: Tue Oct 27, 2009 20:14    Post subject: Re: Static DNS; Buffalo WHR-HP-G54; Dual & Triple ADSL Reply with quote
Rizwiz wrote:
clearview wrote:
In reply to Speedy2K ... yes I just added the DNS IP through the Web GUI and my second WAN started working. (under Setup/Basic settings)

I have now just got triple ADSL WAN working as well (2 ISPs,3 lines). I'm using v24SP2 throughout. My config below. Thanks all.

***These port settings work on my BUFFALO WHR-HP-G54***

nvram set vlan0ports="2 1 5*"
nvram set vlan1ports="0 5"
nvram set vlan2ports="4 5"
nvram set vlan3ports="3 5"
nvram set vlan2hwname=et0
nvram commit
reboot

====================================================

(my dd-wrt router has IP 192.168.1.1)
(my WAN1 ADSL router has IP 192.168.3.1)

=====================================================

wan2.firewall script (my WAN2 ADSL router has IP 192.168.4.1)

#!/bin/sh

WAN2_IFNAME=vlan2
WAN2_IPADDR=192.168.4.20
WAN2_BROADCAST=192.168.4.255
WAN2_GATEWAY=192.168.4.1
WAN2_NETMASK=255.255.255.0

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
fi

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

=====================================================

wan3.firewall script (my WAN3 ADSL router has IP 192.168.2.1)

#!/bin/sh

WAN3_IFNAME=vlan3
WAN3_IPADDR=192.168.2.20
WAN3_BROADCAST=192.168.2.255
WAN3_GATEWAY=192.168.2.1
WAN3_NETMASK=255.255.255.0

if [ "$(nvram get wan3_ipaddr)" != "$WAN3_IPADDR" ]; then
nvram set wan3_ifname=$WAN3_IFNAME
nvram set wan3_ipaddr=$WAN3_IPADDR
nvram set wan3_gateway=$WAN3_GATEWAY
nvram set wan3_netmask=$WAN3_NETMASK
nvram set wan3_broadcast=$WAN3_BROADCAST
nvram commit
fi

ifconfig $(nvram get wan3_ifname) $(nvram get wan3_ipaddr) netmask $(nvram get wan3_netmask) broadcast $(nvram get wan3_broadcast) up

=====================================================
For DUAL WAN:

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='/jffs/scripts/wan2.firewall
/jffs/scripts/routes.firewall'

nvram set rc_firewall='/jffs/scripts/routes.firewall
/jffs/scripts/firewall.firewall'
nvram commit
reboot
=====================================================
For TRIPLE WAN:
(uses jbarbieri's v23 triple script, but runs on dd-wrt v24SP2 because I'm using his iptables in /jffs)
(check firewall.firewall contains IPTABLES=/jffs/iptables)

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

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

nvram set rc_startup='/jffs/scripts/wan2.firewall
sleep 15
/jffs/scripts/wan3.firewall
sleep 15
/jffs/scripts/routes.firewall
echo "`date` rc_startup is now completed" >> /var/log/messages'

nvram set rc_firewall='/jffs/scripts/routes.firewall
/jffs/scripts/firewall.firewall'
nvram commit
reboot

=====================================================


Ok I have a BUFFALO WHR-HP-G54 and have tried the above with this error.

\u@\h:\w\$ cd /jffs/
\u@\h:\w\$ wget http://jbarbieri.net/dd-wrt/scripts/iptables
Connecting to jbarbieri.net (65.175.134.126:80)
\u@\h:\w\$ cd /jffs/scripts/
-sh: cd: can't cd to /jffs/scripts/

I'm using DD-WRT v24-sp2 (07/21/09) micro
SVN revision 12533 for the firmware.

Could I get some help on this error.

Riz


You would have to

mkdir scripts

before you could cd into it.

_________________


Linksys EA6500v2 | 5GHz 1st Floor AP | Advanced Tomato 1.28.0000 -2.9-131 K26ARM USB AIO-64K
Netgear WNR2000v3 | 2nd Floor AP | DD-WRT v3.0-r27805 std

Behind a Raspberry Pi Dual WAN router
Sponsor
dadoors
DD-WRT Novice


Joined: 12 May 2008
Posts: 38
Location: Central Florida

PostPosted: Thu Nov 05, 2009 18:24    Post subject: updated dual wan guides Reply with quote
i noticed there was some typos in the previous guides i had put together causing the dual wan not to work but hopefully that has now been corrected. currently only wrtgl, 310n, and the 610n are supported. so for those who couldnt get dual wan to work let me know if the corrections help. u can check here:

roadrunnerguide.com/dualwan.html


Last edited by dadoors on Thu Nov 05, 2009 21:44; edited 1 time in total
new_bember
DD-WRT User


Joined: 01 Aug 2008
Posts: 79

PostPosted: Thu Nov 05, 2009 21:43    Post subject: Reply with quote
powerfull thread.. thanks to all. But seems I didn`t get two answers.. maybe I`m wrong:
1. Is D-Link DIR-400 support this method (none JFFS, only nvram)?
2. If supported, then another question: I have 2 ISP, first is ADSL (PPPOE 1mbit/1mbit), second called as Russian DualAccsess PPPOE, is it possible to use it together, or put autoswitch when one of them is fall down?

Thank you for reply.
ak4d7
DD-WRT User


Joined: 12 May 2009
Posts: 90

PostPosted: Mon Nov 09, 2009 19:32    Post subject: Reply with quote
using the dual wan scripts on dd-wrt Eko-NEWD on a wrt600n wired directly to the router. i can't hit a higher DL speed of around 5MB/s i am wondering if this could be the limitation of the router (wrt600n) since it is an older model, because i had the wrt610n set up as previously posted getting around 8MB/s down. It could also be a number of other things including the cable modems config,gateway,frequency. or possibly the dd-wrt firmware version although i have tried many.(newd-2 was slower)or a number of other factors.
Maletor
DD-WRT Novice


Joined: 17 Nov 2009
Posts: 3

PostPosted: Thu Nov 19, 2009 19:22    Post subject: Reply with quote
Hey, I have a DDWRT54GL v1.1 with the latest std dd-wrt firmware.

I set up everything according to the roadrunnerguide.com and used their scripts exactly for the NVRAM setup.

When I reboot with just my startup commands it works fine and I seem to have dual WAN?

When I reboot router with startup and firewall commands it won't connect to google.com, but I am still able to connect to the router.

What's going on?
Here is what vlan0 and vlan1 look like. Let me know if there is any other information you would like.

edit: by the way, my router IP is 10.0.50 and my start address is 10.0.0.100
I was looking at the firewall scripts and it mentions 192.168.1.1 I tried changing it to 10.0.0.50, but it still failed to load internet.
What gives? (It also had a 192.168.1.0/24 - what's that?)



Screen shot 2009-11-19 at 2.18.57 PM.png
 Description:
 Filesize:  353.09 KB
 Viewed:  31263 Time(s)

Screen shot 2009-11-19 at 2.18.57 PM.png


hotpants
DD-WRT Novice


Joined: 10 Sep 2008
Posts: 32

PostPosted: Wed Dec 09, 2009 21:48    Post subject: DSL up/cable down? Reply with quote
Is it possible to create a multi WAN setup where one connection would be favored for upload purposes and the other for download purposes? Obviously, this will only work for bittorrent and similar protocols.

I have access to both DSL and cable connections, hence the question. DSL can often do twice the upstream of cable, while cable can do 4x the downstream of DSL, in my case.
killaDUALwans
DD-WRT Novice


Joined: 08 Jan 2010
Posts: 2

PostPosted: Fri Jan 08, 2010 13:41    Post subject: DUAL WANS VIA WLAN (WIFI) ! Reply with quote
Hey boys, so I think I figured this one out! I have spent hours tracing through the scripts and discovered the culprit that enables the Dual Wan Router to talk over the internal wifi repeater connection on BOTH WANS!

My setup:

1st router: WRT54-GL 1.1 - DD-WRT v24-sp2 (01/02/10) std-nokaid-nohot-nostore
(SVN revision 13577M NEWD Eko)

IP: 192.168.60.1
wireless mode: repeater (ssid: abc)
wan IPL 206.65.123.123
wan gateway: 206.65.123.1
This is the router acting as the DUAL WAN interface


2nd router: WRT-160n V3 - DD-WRT v24-sp2 (01/02/10) mini
(SVN revision 13575M NEWD-2 K2.6 Eko)
This router is connected via a cat 5 from any port (1-4) to Port 4(0) on the 1st router (this was configured using on the 1st router:

nvram set vlan0ports="3 2 1 5*"
nvram set vlan2ports="0 5" << this is port 4 on GL
nvram set vlan2hwname=et0
nvram commit
reboot

IP address (which is the gateway): 192.168.70.1
wireless mode: repeater (ssid: xyz)
wan IP: 99.206.123.123
wan Gateway 99.206.123.1

So the reason why this is not working for you guys is because the wan_ifname is routing through vlan1 which is assigned to the hardwired WAN (internet) port(4). When you create a repeater the interface created is called 'eth1' so, just replace all references from vlan1 and wan_ifname to eth1 and BAM! traffic destined for the first interface goes through the repeater of the 1st router. Now because the first router does not care what is on the second router (hence as long as it has the IP, gateway, netmask) the second router can also be created as a repeater (with DHCP on or off) for my case I did not want to run the DHCP on the second router so I statically assigned the wan2 ifconfig specs in the 1st router and deleted the DHCP logic from the script udhcpc-wan2.script:

nvram set wan2_ifname=vlan2
nvram set wan2_gateway=192.168.70.1
nvram set wan2_ipaddr=192.168.70.10
nvram set wan2_netmask=255.255.255.0
nvram set wan2_broadcast=192.168.70.255
nvram commit
ifconfig $(nvram get wan2_ifname) $(nvram get wan2_ipaddr) netmask $(nvram get wan2_netmask) up

Now, I have tested with different flavours of the iptables and found the one that comes with this firmware seems to work so I left it, and made sure that in the script firewall.firewall I was using the /usr/sbin/iptables:

ALSO NOTICE HERE THAT I REPLACED ALL REFERENCES TO WAN_IFNAME and VLAN1 with 'eth1' this allows the traffic to pass through the wirless interface! I cannot verify if eth1 is the standard across models/manf, so just use 'nvram get wan_ifname' from the telnet to get yours! \\ THIS IS NOT A TYPO - DO NOT CHANGE WAN2_IFNAME as that is OK because you want the traffic to flow through the second router as well.

#!/bin/sh
insmod ipt_CONNMARK
insmod ipt_mark
echo "`date` Flushing and adding new firewall rules" >> /var/log/messages
IPTABLES="/usr/sbin/iptables"
#IPTABLES="/jffs/scripts/iptables"

for RULE in $(nvram get forward_spec)
do
FROM=`echo $RULE | cut -d '>' -f 1`
TO=`echo $RULE | cut -d '>' -f 2`
STATE=`echo $FROM | cut -d ':' -f 2`
PROTO=`echo $FROM | cut -d ':' -f 3`
SPORT=`echo $FROM | cut -d ':' -f 4`
DEST=`echo $TO | cut -d ':' -f 1`
DPORT=`echo $TO | cut -d ':' -f 2`

if [ "$STATE" = "on" ]; then
if [ "$PROTO" = "both" ]; then
iptables -A PREROUTING -t nat -p udp -d $(nvram get wan2_ipaddr) --dport $SPORT -j DNAT --to $DEST:$DPORT
iptables -A PREROUTING -t nat -p tcp -d $(nvram get wan2_ipaddr) --dport $SPORT -j DNAT --to $DEST:$DPORT
else
iptables -A PREROUTING -t nat -p $PROTO -d $(nvram get wan2_ipaddr) --dport $SPORT -j DNAT --to $DEST:$DPORT
fi
fi
done

for RULE in $(nvram get forward_port)
do
FROM=`echo $RULE | cut -d '>' -f 1`
TO=`echo $RULE | cut -d '>' -f 2`
STATE=`echo $FROM | cut -d ':' -f 2`
PROTO=`echo $FROM | cut -d ':' -f 3`
SPORT=`echo $FROM | cut -d ':' -f 4`
EPORT=`echo $FROM | cut -d ':' -f 5`

if [ "$STATE" = "on" ]; then
if [ "$PROTO" = "both" ]; then
iptables -A PREROUTING -t nat -p udp -d $(nvram get wan2_ipaddr) --dport $SPORT:$EPORT -j DNAT --to $TO
iptables -A PREROUTING -t nat -p tcp -d $(nvram get wan2_ipaddr) --dport $SPORT:$EPORT -j DNAT --to $TO
else
iptables -A PREROUTING -t nat -p $PROTO -d $(nvram get wan2_ipaddr) --dport $SPORT:$EPORT -j DNAT --to $TO
fi
fi
done

iptables -A PREROUTING -t nat -p icmp -d $(nvram get wan2_ipaddr) -j DNAT --to $(nvram get lan_ipaddr)

if [ $(nvram get remote_management) -eq 1 ]; then
iptables -A PREROUTING -t nat -p tcp -d $(nvram get wan2_ipaddr) --dport $(nvram get http_wanport) -j DNAT --to $(nvram get lan_ipaddr):$(nvram get http_lanport)
fi

if [ $(nvram get dmz_enable) -eq 1 ]; then
DMZ_IP=$(nvram get lan_ipaddr | sed -r 's/[0-9]+$//')$(nvram get dmz_ipaddr)
iptables -A PREROUTING -t nat -d $(nvram get wan2_ipaddr) -j DNAT --to $DMZ_IP
fi

iptables -A PREROUTING -t nat --dest $(nvram get wan2_ipaddr) -j TRIGGER --trigger-type dnat
iptables -A FORWARD -i $(nvram get wan2_ifname) -o $(nvram get lan_ifname) -j TRIGGER --trigger-type in

$IPTABLES -t mangle -F PREROUTING
$IPTABLES -t mangle -F OUTPUT

$IPTABLES -F POSTROUTING -t nat

$IPTABLES -t mangle -N ETH1
$IPTABLES -t mangle -F ETH1
$IPTABLES -t mangle -A ETH1 -j MARK --set-mark 0x100
$IPTABLES -t mangle -A ETH1 -j CONNMARK --save-mark

$IPTABLES -t mangle -N ETH2
$IPTABLES -t mangle -F ETH2
$IPTABLES -t mangle -A ETH2 -j MARK --set-mark 0x200
$IPTABLES -t mangle -A ETH2 -j CONNMARK --save-mark

$IPTABLES -t mangle -N RANDOM
$IPTABLES -t mangle -F RANDOM
$IPTABLES -t mangle -A RANDOM -m random --average 50 -j ETH1
$IPTABLES -t mangle -A RANDOM -m random --average 50 -j ETH2

$IPTABLES -t nat -N SPOOF_ETH1
$IPTABLES -t nat -F SPOOF_ETH1
$IPTABLES -t nat -A SPOOF_ETH1 -j SNAT --to $(nvram get wan_ipaddr)

$IPTABLES -t nat -N SPOOF_ETH2
$IPTABLES -t nat -F SPOOF_ETH2
$IPTABLES -t nat -A SPOOF_ETH2 -j SNAT --to $(nvram get wan2_ipaddr)

$IPTABLES -t filter -N keep_state
$IPTABLES -t filter -A keep_state -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPTABLES -t filter -A keep_state -j RETURN

$IPTABLES -t nat -N keep_state
$IPTABLES -t nat -A keep_state -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPTABLES -t nat -A keep_state -j RETURN

$IPTABLES -t nat -I PREROUTING -j keep_state
$IPTABLES -t nat -I OUTPUT -j keep_state
$IPTABLES -t filter -I INPUT -j keep_state
$IPTABLES -t filter -I FORWARD -j keep_state
$IPTABLES -t filter -I OUTPUT -j keep_state

$IPTABLES -t nat -I POSTROUTING -j keep_state
$IPTABLES -t nat -A POSTROUTING -o eth1 -j SPOOF_ETH1
$IPTABLES -t nat -A POSTROUTING -o $(nvram get wan2_ifname) -j SPOOF_ETH2

$IPTABLES -t mangle -A FORWARD -j CONNMARK --restore-mark
$IPTABLES -t mangle -A FORWARD -i eth1 -j ETH1
$IPTABLES -t mangle -A FORWARD -i vlan2 -j ETH2

$IPTABLES -t mangle -A PREROUTING -i br0 -p tcp -m state --state ESTABLISHED -j CONNMARK --restore-mark
$IPTABLES -t mangle -A PREROUTING -i br0 -m state --state NEW -j RANDOM
$IPTABLES -t mangle -A PREROUTING -m mark --mark 0x100 -j ACCEPT
$IPTABLES -t mangle -A PREROUTING -m mark --mark 0x200 -j ACCEPT
$IPTABLES -t mangle -A PREROUTING -i eth1 -j ETH1
$IPTABLES -t mangle -A PREROUTING -i vlan2 -j ETH2

# Rate Limit
$IPTABLES -N rate_limit
$IPTABLES -F rate_limit
$IPTABLES -A rate_limit -p tcp --dport 22 -m limit --limit 3/min --limit-burst 3 -j ACCEPT
$IPTABLES -A rate_limit -p udp --dport 1194 -m limit --limit 3/min --limit-burst 3 -j ACCEPT
$IPTABLES -A rate_limit -p ICMP --icmp-type echo-request -m limit --limit 3/sec -j ACCEPT
$IPTABLES -A rate_limit -p ! ICMP -j LOG --log-prefix " Connection dropped!! "
$IPTABLES -A rate_limit -p tcp -j REJECT --reject-with tcp-reset
$IPTABLES -A rate_limit -p udp -j REJECT --reject-with icmp-port-unreachable
$IPTABLES -A rate_limit -j DROP

# Add Limits
$IPTABLES -I INPUT -p ICMP --icmp-type echo-request -j rate_limit
$IPTABLES -I INPUT -p tcp --dport 22 -m state --state NEW -j rate_limit

RP_PATH=/proc/sys/net/ipv4/conf
for IFACE in `ls $RP_PATH`; do
echo 0 > $RP_PATH/$IFACE/rp_filter
done

echo "`date` firewall.firewall is now completed" >> /var/log/messages

#---end firewall.firewall---

And just for sanctity here is the routes.firewall

NOTE HERE AS WELL there was a reference to the wan_ifname which I just replaced with eth1 ! Razz

#!/bin/sh

echo "Flushing rules" >> /var/log/messages

ip rule flush

echo "Rebuilding rules and tables" >> /var/log/messages

ip rule add lookup main prio 32766
ip rule add lookup default prio 32767

ip rule add from $(nvram get wan_ipaddr) table 100 prio 100
ip rule add fwmark 0x100 table 100 prio 101

ip rule add from $(nvram get wan2_ipaddr) table 200 prio 200
ip rule add fwmark 0x200 table 200 prio 201

ip route flush table 100
ip route flush table 200

for TABLE in 100 200
do
ip route | grep link | while read ROUTE
do
ip route add table $TABLE to $ROUTE
done
done

ip route add table 100 default via $(nvram get wan_gateway)
ip route add table 200 default via $(nvram get wan2_gateway)
echo "Deleting default route" >> /var/log/messages
ip route delete default
echo "Adding in equalized route" >> /var/log/messages

ip route add default scope global equalize nexthop via $(nvram get wan_gateway) dev eth1 nexthop via $(nvram get wan2_gateway) dev $(nvram get wan2_ifname)

echo "routes.firewall completed" >> /var/log/messages

#---END routes.firewall---

Now remember that I am not using the DHCP from the second router so in your startup script you do not need to call and pass the interface to the startup script so I removed it:

Startup

/jffs/scripts/udhcpc-wan2.script
/jffs/scripts/routes.firewall

And now I have two wireless wan connections equalized through 1 WRT54GL ($30) router!

After 3 years, its finally here! Have a great new year and enjoy

Oh and use a bittorrent and check the bandwidth monitor on both wl0 devices in each router and you will see traffic flowing across both wireless repeaters!!!

killaDualWans
ZeroXD
DD-WRT Novice


Joined: 13 Jan 2010
Posts: 2

PostPosted: Wed Jan 13, 2010 3:20    Post subject: Reply with quote
Hi, i'm relatively new to the Dual/triple wan aspect of DD-WRT and i'm trying to get it to work.

I've tried reading through this thread, but its a monster and I haven't quite found even though it seems to be more simple then things already being achieved.

Before I go on I'll outline my situation:
3 dsl connections from the same ISP.
Approximately 7 static IPs per connection.
I need assign at least 3 Static IPs per connection as a form of pseudo-load balance, but each of these should be able to see other computers on our local intranet.

No real need or interest in failover or round-robin load balacing.

Hardware: WRT54GL v1.0 with 16-port Linksys switch.
Firmware: DD-WRT v24-sp2 (10/10/09) mini

Any help is appreciated.
DHC_DarkShadow
DD-WRT Guru


Joined: 22 Jun 2008
Posts: 2440
Location: Am now Dark_Shadow

PostPosted: Wed Jan 13, 2010 3:24    Post subject: Reply with quote
Did you check the Wiki for Dual Wan?
_________________
The New Me
ZeroXD
DD-WRT Novice


Joined: 13 Jan 2010
Posts: 2

PostPosted: Wed Jan 13, 2010 5:47    Post subject: Reply with quote
I've looked at the results and all i could find was dual wan with round robin and dual wan with failover.
I've read people referring to a triple wan config with static ip setup, but I can't seem to locate it.
jones11
DD-WRT Novice


Joined: 12 Dec 2008
Posts: 20

PostPosted: Sun Jan 17, 2010 17:10    Post subject: Re: DUAL WANS VIA WLAN (WIFI) ! Reply with quote
killaDUALwans wrote:
Hey boys, so I think I figured this one out! I have spent hours tracing through the scripts and discovered the culprit that enables the Dual Wan Router to talk over the internal wifi repeater connection on BOTH WANS!


killaDualWans


Does this configuration work with 1 DSL connection and having a wireless connection as a back up or round robin?
haiishq
DD-WRT Novice


Joined: 06 Feb 2010
Posts: 2

PostPosted: Sat Feb 06, 2010 11:55    Post subject: Dual Wan on WRT54Gv4 Reply with quote
ok guys i really need help i been trying this so much but with no result so someone please help me out

i did these steps
1. use a mini version of latest ddwrt.
2. port 4 on vlan2, save changes and reboot
3. "Run Commands"
nvram set vlan0ports="1 2 3 5*"
nvram set vlan2ports="0 5"
nvram set vlan2hwname=et0
nvram commit
reboot
4. Set As Startup
udhcpc -i vlan2 -s /jffs/scripts/udhcpc-wan2.script
/jffs/scripts/routes.firewall
5. Set As Firewall
/jffs/scripts/routes.firewall
/jffs/scripts/firewall.firewall
6. in the "services" tab enable sshd, & password login. click save
7. in admin tab. enable jffs2 & clean jffs2. click apply
8. disable clean jffs2, reboot
9. make a new folder called "scripts" in the "jffs" folder. transfer the scripts into the "scripts" folder
9. transfer the iptables file into the jffs folder using "binary" transfer method
10. chmod jffs to 777
reboot
(i also chmod all the scripts and the folder scripts to 777 including the iptables file)
my default wan is working just fine , but when i plug my internet connection to port 4 i get no internet, internet light in front of the router is not blinking either
please advise thankx
and i been following the instructions on http://roadrunnerguide.com/dualwan.html with no success



Scripts.rar
 Description:
Scripts

Download
 Filename:  Scripts.rar
 Filesize:  51.95 KB
 Downloaded:  1110 Time(s)

cartervt2k
DD-WRT Novice


Joined: 02 Sep 2006
Posts: 10

PostPosted: Sun Feb 21, 2010 4:01    Post subject: Re: Dual Wan on WRT54Gv4 Reply with quote
haiishq wrote:
ok guys i really need help i been trying this so much but with no result so someone please help me out

i did these steps
1. use a mini version of latest ddwrt.
2. port 4 on vlan2, save changes and reboot
3. "Run Commands"
nvram set vlan0ports="1 2 3 5*"
nvram set vlan2ports="0 5"
nvram set vlan2hwname=et0
nvram commit
reboot
4. Set As Startup
udhcpc -i vlan2 -s /jffs/scripts/udhcpc-wan2.script
/jffs/scripts/routes.firewall
5. Set As Firewall
/jffs/scripts/routes.firewall
/jffs/scripts/firewall.firewall
6. in the "services" tab enable sshd, & password login. click save
7. in admin tab. enable jffs2 & clean jffs2. click apply
8. disable clean jffs2, reboot
9. make a new folder called "scripts" in the "jffs" folder. transfer the scripts into the "scripts" folder
9. transfer the iptables file into the jffs folder using "binary" transfer method
10. chmod jffs to 777
reboot
(i also chmod all the scripts and the folder scripts to 777 including the iptables file)
my default wan is working just fine , but when i plug my internet connection to port 4 i get no internet, internet light in front of the router is not blinking either
please advise thankx
and i been following the instructions on http://roadrunnerguide.com/dualwan.html with no success


I followed the same instructions from the same site and had the same results on my WRT54GL v1.1. I'd really like to get this working if someone smarter than me can figure it out.
wayland
DD-WRT User


Joined: 17 Jun 2006
Posts: 184
Location: Essex, England

PostPosted: Mon Feb 22, 2010 12:54    Post subject: Reply with quote
There is great potential for dual and triple WAN but it's not easy to do.

One route is two different routes to the Internet, say Wireless Client to someones WiFi as well as your own ADSL line on the normal WAN port. Or perhaps a 3G stick as a WAN.

The other route is faster speed vis two or more phone lines and an ISP that supports bonding. Bonded lines mean effectively a single Internet connection with twice the performance. The routers to do this usually cost hundreds.

One reason for bonding could be that you have long line issues and need extra speed. This would not stress the Linksys too much. Another reason could be that you already have a very fast connection but you are such a speed freak you want even faster. This could take the Linksys beyond it's limits.

_________________
Buffalo
WRT54G
Psychosis
DD-WRT Novice


Joined: 21 Feb 2009
Posts: 12

PostPosted: Fri Feb 26, 2010 6:14    Post subject: Reply with quote
Just got it running on my WRT54G-TM with DD-WRT v24-sp2 (07/22/09) mega - build 12548M NEWD Eko firmware. Seems to be working pretty good according to a torrent I just downloaded. Will work on mtrg graphs later.

My setup:

2 Cable modems each at 8mb/1mb.
1st plugged into WAN port and 2nd plugged into port 4 on the router.

nvram set vlan0ports="3 2 1 5*"
nvram set vlan2ports="4 5"
nvram set vlan2hwname=et0
nvram set rc_startup="udhcpc -s /jffs/scripts/udhcpc-wan2.scripts -i vlan2 /jffs/scripts/routes.firewall"

nvram set rc_firewall="/jffs/scripts/routes.firewall /jffs/scripts/firewall.firewall"
nvram commit
reboot

For the files I just pulled them off of JB's server but had to change udhcpc-wan2.script and firewall.firewall a bit because of errors.

My udhcpc-wan2.script:

Code:
#!/bin/sh
# udhcpc script edited by Tim Riker <Tim@Rikers.org>
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1

ifconfig $interface up

RESOLV_CONF="/etc/resolv.conf"
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet"

case "$1" in
   deconfig)
     /sbin/ifconfig $interface 0.0.0.0
     ;;
               
  renew|bound)
    # /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
    echo "$ip $BROADCAST $NETMASK"
                       
#  if [ -n "$router" ] ; then
#   echo "deleting routers"
    # while route del default gw 0.0.0.0 dev $interface ; do
    #  :
    # done
                                                                     
    # for i in $router ; do
    #   route add default gw $i dev $interface
    # done
#   echo "$router"
#  fi
                                                                                                         
  echo -n > $RESOLV_CONF
  [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
  for i in $dns ; do
#    echo adding dns $i
#    echo nameserver $i >> $RESOLV_CONF
  nvram set wan2_ifname=$interface
  nvram set wan2_gateway=$router
  nvram set wan2_ipaddr=$ip
  nvram set wan2_netmask=$subnet
  nvram set wan2_broadcast=$broadcast
  nvram commit
  ifconfig $(nvram get wan2_ifname) $(nvram get wan2_ipaddr) netmask $(nvram get wan2_netmask) up
  done
  ;;
esac
                                                                                                                                       
exit 0


Had to comment out the if and fi in the $routers part and move done from above nvram to the bottom.

My routes.firewall:

Code:
#!/bin/sh

echo "Flushing rules" >> /var/log/messages

ip rule flush

echo "Rebuilding rules and tables" >> /var/log/messages

ip rule add lookup main prio 32766
ip rule add lookup default prio 32767

ip rule add from $(nvram get wan_ipaddr) table 100 prio 100
ip rule add fwmark 0x100 table 100 prio 101

ip rule add from $(nvram get wan2_ipaddr) table 200 prio 200
ip rule add fwmark 0x200 table 200 prio 201

ip route flush table 100
ip route flush table 200

for TABLE in 100 200
do
   ip route | grep link | while read ROUTE
   do
     ip route add table $TABLE to $ROUTE
   done
done

ip route add table 100 default via $(nvram get wan_gateway)
ip route add table 200 default via $(nvram get wan2_gateway)
echo "Deleting default route" >> /var/log/messages
ip route delete default
echo "Adding in equalized route" >> /var/log/messages
ip route add default scope global equalize nexthop via $(nvram get wan_gateway) dev  $(nvram get wan_ifname) nexthop via $(nvram get wan2_gateway) dev $(nvram get wan2_ifname)
echo "routes.firewall completed" >> /var/log/messages


Had to change nothing in routes.firewall

My firewall.firewall:

Code:
#!/bin/sh
insmod ipt_CONNMARK
insmod ipt_mark
echo "`date` Flushing and adding new firewall rules" >> /var/log/messages
IPTABLES="/usr/sbin/iptables"

for RULE in $(nvram get forward_spec)
do
   FROM=`echo $RULE | cut -d '>' -f 1`
   TO=`echo $RULE | cut -d '>' -f 2`
   STATE=`echo $FROM | cut -d ':' -f 2`
   PROTO=`echo $FROM | cut -d ':' -f 3`
   SPORT=`echo $FROM | cut -d ':' -f 4`
   DEST=`echo $TO | cut -d ':' -f 1`
   DPORT=`echo $TO | cut -d ':' -f 2`
   
   if [ "$STATE" = "on" ]; then
      if [ "$PROTO" = "both" ]; then
        iptables -A PREROUTING -t nat -p udp -d $(nvram get wan2_ipaddr) --dport $SPORT -j DNAT --to $DEST:$DPORT
        iptables -A PREROUTING -t nat -p tcp -d $(nvram get wan2_ipaddr) --dport $SPORT -j DNAT --to $DEST:$DPORT
      else
        iptables -A PREROUTING -t nat -p $PROTO -d $(nvram get wan2_ipaddr) --dport $SPORT -j DNAT --to $DEST:$DPORT
      fi
   fi
done

for RULE in $(nvram get forward_port)
do
  FROM=`echo $RULE | cut -d '>' -f 1`
  TO=`echo $RULE | cut -d '>' -f 2`
  STATE=`echo $FROM | cut -d ':' -f 2`
  PROTO=`echo $FROM | cut -d ':' -f 3`
  SPORT=`echo $FROM | cut -d ':' -f 4`
  EPORT=`echo $FROM | cut -d ':' -f 5`

  if [ "$STATE" = "on" ]; then
    if [ "$PROTO" = "both" ]; then
      iptables -A PREROUTING -t nat -p udp -d $(nvram get wan2_ipaddr) --dport $SPORT:$EPORT -j DNAT --to $TO
      iptables -A PREROUTING -t nat -p tcp -d $(nvram get wan2_ipaddr) --dport $SPORT:$EPORT -j DNAT --to $TO
    else
      iptables -A PREROUTING -t nat -p $PROTO -d $(nvram get wan2_ipaddr) --dport $SPORT:$EPORT -j DNAT --to $TO
    fi
  fi
done

iptables -A PREROUTING -t nat -p icmp -d $(nvram get wan2_ipaddr) -j DNAT --to $(nvram get lan_ipaddr)

if [ $(nvram get remote_management) -eq 1 ]; then
   iptables -A PREROUTING -t nat -p tcp -d $(nvram get wan2_ipaddr) --dport $(nvram get http_wanport) -j DNAT --to $(nvram get lan_ipaddr):$(nvram get http_lanport)
fi

if [ $(nvram get dmz_enable) -eq 1 ]; then
   DMZ_IP=$(nvram get lan_ipaddr | sed -r 's/[0-9]+$//')$(nvram get dmz_ipaddr)
   iptables -A PREROUTING -t nat -d $(nvram get wan2_ipaddr) -j DNAT --to $DMZ_IP
fi

iptables -A PREROUTING -t nat --dest $(nvram get wan2_ipaddr) -j TRIGGER --trigger-type dnat
iptables -A FORWARD -i $(nvram get wan2_ifname) -o $(nvram get lan_ifname) -j TRIGGER --trigger-type in

$IPTABLES -t mangle -F PREROUTING
$IPTABLES -t mangle -F OUTPUT

$IPTABLES -F POSTROUTING -t nat

$IPTABLES -t mangle -N ETH1
$IPTABLES -t mangle -F ETH1
$IPTABLES -t mangle -A ETH1 -j MARK --set-mark 0x100
$IPTABLES -t mangle -A ETH1 -j CONNMARK --save-mark

$IPTABLES -t mangle -N ETH2
$IPTABLES -t mangle -F ETH2
$IPTABLES -t mangle -A ETH2 -j MARK --set-mark 0x200
$IPTABLES -t mangle -A ETH2 -j CONNMARK --save-mark

$IPTABLES -t mangle -N RANDOM
$IPTABLES -t mangle -F RANDOM
$IPTABLES -t mangle -A RANDOM -m random --average 50 -j ETH1
$IPTABLES -t mangle -A RANDOM -m random --average 50 -j ETH2

$IPTABLES -t nat -N SPOOF_ETH1
$IPTABLES -t nat -F SPOOF_ETH1
$IPTABLES -t nat -A SPOOF_ETH1 -j SNAT --to $(nvram get wan_ipaddr)

$IPTABLES -t nat -N SPOOF_ETH2
$IPTABLES -t nat -F SPOOF_ETH2
$IPTABLES -t nat -A SPOOF_ETH2 -j SNAT --to $(nvram get wan2_ipaddr)

$IPTABLES -t filter -N keep_state
$IPTABLES -t filter -A keep_state -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPTABLES -t filter -A keep_state -j RETURN

$IPTABLES -t nat -N keep_state
$IPTABLES -t nat -A keep_state -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPTABLES -t nat -A keep_state -j RETURN

$IPTABLES -t nat -I PREROUTING -j keep_state
$IPTABLES -t nat -I OUTPUT -j keep_state
$IPTABLES -t filter -I INPUT -j keep_state
$IPTABLES -t filter -I FORWARD -j keep_state
$IPTABLES -t filter -I OUTPUT -j keep_state

$IPTABLES -t nat -I POSTROUTING -j keep_state
$IPTABLES -t nat -A POSTROUTING -o $(nvram get wan_ifname) -j SPOOF_ETH1
$IPTABLES -t nat -A POSTROUTING -o $(nvram get wan2_ifname) -j SPOOF_ETH2

$IPTABLES -t mangle -A FORWARD -j CONNMARK --restore-mark
$IPTABLES -t mangle -A FORWARD -i vlan1 -j ETH1
$IPTABLES -t mangle -A FORWARD -i vlan2 -j ETH2

$IPTABLES -t mangle -A PREROUTING -i br0 -p tcp -m state --state ESTABLISHED -j CONNMARK --restore-mark
$IPTABLES -t mangle -A PREROUTING -i br0 -m state --state NEW -j RANDOM
$IPTABLES -t mangle -A PREROUTING -m mark --mark 0x100 -j ACCEPT
$IPTABLES -t mangle -A PREROUTING -m mark --mark 0x200 -j ACCEPT
$IPTABLES -t mangle -A PREROUTING -i vlan1 -j ETH1
$IPTABLES -t mangle -A PREROUTING -i vlan2 -j ETH2

# Rate Limit
$IPTABLES -N rate_limit
$IPTABLES -F rate_limit
$IPTABLES -A rate_limit -p tcp --dport 22 -m limit --limit 3/min --limit-burst 3 -j ACCEPT
$IPTABLES -A rate_limit -p udp --dport 1194 -m limit --limit 3/min --limit-burst 3 -j ACCEPT
$IPTABLES -A rate_limit -p ICMP --icmp-type echo-request -m limit --limit 3/sec -j ACCEPT
$IPTABLES -A rate_limit -p ! ICMP -j LOG --log-prefix " Connection dropped!! "
$IPTABLES -A rate_limit -p tcp -j REJECT --reject-with tcp-reset
$IPTABLES -A rate_limit -p udp -j REJECT --reject-with icmp-port-unreachable
$IPTABLES -A rate_limit -j DROP

# Add Limits
$IPTABLES -I INPUT -p ICMP --icmp-type echo-request -j rate_limit
$IPTABLES -I INPUT -p tcp --dport 22 -m state --state NEW -j rate_limit

RP_PATH=/proc/sys/net/ipv4/conf
for IFACE in `ls $RP_PATH`; do
    echo 0 > $RP_PATH/$IFACE/rp_filter
done

echo "`date` firewall.firewall is now completed" >> /var/log/messages


Had to change /jffs/iptables back to /usr/sbin/iptables since I didn't need the custom iptables. haven't tried it with the custom one yet to see if it helps. May do that later. Right now it seems fine. Was downloading a torrent at over 1.5MB/sec and the ip changes on the different ipchicken or mywanip sites.

JB do you think the custom iptables would help randomize it even better or not?

BTW, Thanks goes out to JB for putting a lot of hard work into this and helping others along. Now if we could just get that fork build of dual-wan so we wouldn't have to do all this mess. Very Happy
Goto page Previous  1, 2, 3 ... 62, 63, 64 ... 66, 67, 68  Next Display posts from previous:    Page 63 of 68
Post new topic   This topic is locked: you cannot edit posts or make replies.    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum