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 ... 54, 55, 56 ... 66, 67, 68  Next
Author Message
IN7OX
DD-WRT Novice


Joined: 15 Jul 2008
Posts: 19

PostPosted: Wed Feb 18, 2009 9:42    Post subject: Reply with quote
im having the exact same problem
could do with help also
Sponsor
shaad
DD-WRT User


Joined: 19 May 2008
Posts: 78

PostPosted: Wed Feb 18, 2009 14:24    Post subject: Reply with quote
82280zx wrote:
Well I think I have it working... should this combine the bandwidth or is this load balancing? I noticed if I do a bandwidth test it like randomly picks a wan to use and I seem to keep losing my connection with them both running... but I have verified that both VLAN's are pulling a ip and are functioning but I'm just not sure if its working right. Any help would be appreciated.


You are doing load sharing and not bonding, so you wont get twice your bandwidth unless you start multiple downloads.

Can I have outputs of ifconfig and ip route?
Apex-XT
DD-WRT Novice


Joined: 12 Dec 2008
Posts: 23

PostPosted: Wed Feb 18, 2009 16:13    Post subject: Reply with quote
ccbiker wrote:
Apex-XT wrote:
dilosolid wrote:
Guide to get dual wan working with the WRT350n

port settings

nvram set vlan1ports="1 2 3 8*"
nvram set vlan3ports="4 8"
nvram set vlan3hwname=et0
nvram commit
reboot


change this
udhcpc -s /jffs/scripts/udhcpc-wan2.script -i vlan2
to
udhcpc -s /jffs/scripts/udhcpc-wan2.script -i vlan3


everything else is the same to the wrt54g


Thank you for the reply. I'll give this a try. This is for Dual, right? I want to get to Triple. How would I set that up?

Thanks again...


for triple, you'd do this:

nvram set vlan1ports="1 2 8*"
nvram set vlan3ports="4 8"
nvram set vlan3hwname=et0
nvram set vlan4ports="3 8"
nvram set vlan4hwname=et0
nvram commit
reboot

and in startup scripts...
udhcpc -s /jffs/scripts/udhcpc-wan2.script -i vlan3
udhcpc -s /jffs/scripts/udhcpc-wan3.script -i vlan4
/jffs/scrips/routes-triple.firewall

firewall:
/jffs/scripts/firewall-triple.firewall

--I forget where those scripts are found in this thread for triple, but they're in here somewhere

hope this helps


This did help. I have the vlan ports set up and all seems to be working there. However, I'm using static IP. Most of the code snippets I've looked through detail DHCP through scripts. I've found 1 instance in 54 pages that describes static IP, but the listing only provides that section. I'm not sure which of the scripts to delete and which to keep. Can you help there?
Thank you.
betillo33
DD-WRT Novice


Joined: 14 Jan 2009
Posts: 11

PostPosted: Wed Feb 18, 2009 18:22    Post subject: Reply with quote
Im confused. there are so many codes; Could anybody make a tutorial for WRT350N please? . or at least post all codes to make dual wan.

thanks
jbarbieri
DD-WRT Guru


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

PostPosted: Thu Feb 19, 2009 3:39    Post subject: Reply with quote
[quote="ace0174"]
jbarbieri wrote:
iptables --list -nvt mangle
iptables --list -nvt nat

ip route
ip route show table 100
ip route show table 200


edit:

also,

cat /proc/net/ip_conntrack | grep EST


There you go jbarbieri, just got back and situation remains the same. Oh, I'm also getting that cant fork thing after a couple of days of uptime.

Code:
 iptables --list -nvt mangle
Chain PREROUTING (policy ACCEPT 38429 packets, 32M bytes)
 pkts bytes target     prot opt in     out     source               destination

:SNIP:
[/quote


I don't know where you got the firewall, but try this one:



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



You can download it here:

http://www.jbarbieri.net/dd-wrt/scripts/firewall.firewall

_________________


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
82280zx
DD-WRT Novice


Joined: 13 Feb 2009
Posts: 5

PostPosted: Thu Feb 19, 2009 11:01    Post subject: Reply with quote
shaad wrote:
82280zx wrote:
Well I think I have it working... should this combine the bandwidth or is this load balancing? I noticed if I do a bandwidth test it like randomly picks a wan to use and I seem to keep losing my connection with them both running... but I have verified that both VLAN's are pulling a ip and are functioning but I'm just not sure if its working right. Any help would be appreciated.


You are doing load sharing and not bonding, so you wont get twice your bandwidth unless you start multiple downloads.

Can I have outputs of ifconfig and ip route?


Where there are x's are an ip but I don't want to give it out to the public =P, I have a cable modem with a 5meg down 2 meg up in one input and my dsl which is only 1.5 meg down and 768kbps up in my second input. My question is if I'm playing a game if I'm doing this will it disconnect me constantly? Or should it grab one wan and stay stable? Thanks for the help btw I really appreciate it. Do you need the scripts I'm using?

Here is my ip route

192.168.2.0/24 dev br0 proto kernel scope link src 192.168.2.1
192.168.0.0/24 dev vlan2 proto kernel scope link src 192.168.0.2
xx.xxx.32.0/22 dev vlan1 proto kernel scope link src x.x.34.129
169.254.0.0/16 dev br0 proto kernel scope link src x.x.255.1
127.0.0.0/8 dev lo scope link
default equalize
nexthop via x.x.32.1 dev vlan1 weight 1
nexthop via 192.168.0.1 dev vlan2 weight 1

Heres my ifconfig

br0

Link encap:Ethernet HWaddr 00:40:10:20:00:01
inet addr:192.168.2.1 Bcast:192.168.2.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10283 errors:0 dropped:0 overruns:0 frame:0
TX packets:8968 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5344244 (5.0 MiB) TX bytes:9176194 (8.7 MiB)

br0:0

Link encap:Ethernet HWaddr 00:40:10:20:00:01
inet addr:169.254.255.1 Bcast:169.254.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

eth0

Link encap:Ethernet HWaddr 00:40:10:20:00:01
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:17881 errors:0 dropped:0 overruns:0 frame:0
TX packets:18459 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:13699224 (13.0 MiB) TX bytes:14694313 (14.0 MiB)
Interrupt:4

eth1

Link encap:Ethernet HWaddr 00:40:10:20:00:03
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:1817 errors:0 dropped:0 overruns:0 frame:8203
TX packets:1709 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:452132 (441.5 KiB) TX bytes:421822 (411.9 KiB)
Interrupt:2 Base address:0x5000

lo

Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MULTICAST MTU:16436 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:152 (152.0 B) TX bytes:152 (152.0 B)

vlan0

Link encap:Ethernet HWaddr 00:40:10:20:00:01
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:8465 errors:0 dropped:0 overruns:0 frame:0
TX packets:9726 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4951404 (4.7 MiB) TX bytes:9444639 (9.0 MiB)

vlan1

Link encap:Ethernet HWaddr 00:40:10:20:00:02
inet addr:xxx.xxx.34.129 Bcast:xx.xxx.35.255 Mask:255.255.252.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6059 errors:0 dropped:0 overruns:0 frame:0
TX packets:5051 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5189503 (4.9 MiB) TX bytes:2953820 (2.8 MiB)

vlan2

Link encap:Ethernet HWaddr 00:40:10:20:00:01
inet addr:192.168.0.2 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3364 errors:0 dropped:0 overruns:0 frame:0
TX packets:3687 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0

RX bytes:3237779 (3.0 MiB) TX bytes:2210964 (2.1 MiB)
ace0174
DD-WRT Novice


Joined: 07 Feb 2009
Posts: 6

PostPosted: Thu Feb 19, 2009 18:42    Post subject: Reply with quote
jbarbieri

Thanks again for the reply.
Tried the scripts on your site, intead of the forum's ones.

wget them to the router:
http://www.jbarbieri.net/dd-wrt/scripts/udhcpc-wan2.script
routes.firewall and firewall.firewall

startup has udhcp and firewall has both firewall scripts.

It turns out it worked, however, system load went to the roof when downloading torrents, and the result is that I couldn't get any speed bumps.
Its two 10mbit cable lines.

I'm using the following firmware, maybe this is the cause:
Firmware: EzPlanet v24.1 (build 132 23/07/07) ipvs
Time: 16:32:53 up 16 min, load average: 1.36, 1.22, 0.65

I probably should update to a newer ddwrt version however I'm confused with that activation thing. Any information would be welcome.

Thanks again for the good work and support.
phuzi0n
DD-WRT Guru


Joined: 10 Oct 2006
Posts: 10141

PostPosted: Fri Feb 20, 2009 1:27    Post subject: Reply with quote
ace0174 wrote:

I'm using the following firmware, maybe this is the cause:
Firmware: EzPlanet v24.1 (build 132 23/07/07) ipvs
Time: 16:32:53 up 16 min, load average: 1.36, 1.22, 0.65

I probably should update to a newer ddwrt version however I'm confused with that activation thing. Any information would be welcome.

Thanks again for the good work and support.

You're not using DD-WRT, you're using a fork of a very old build.

You should telnet in and run "top" to check what is using all the cpu/mem.
jbarbieri
DD-WRT Guru


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

PostPosted: Fri Feb 20, 2009 4:14    Post subject: Reply with quote
ezplanet is for inbound load balancing is it not? i remember finding that download.

try v24 at least, bs builds, from january works good.

_________________


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
phuzi0n
DD-WRT Guru


Joined: 10 Oct 2006
Posts: 10141

PostPosted: Fri Feb 20, 2009 4:58    Post subject: Reply with quote
jbarbieri wrote:
ezplanet is for inbound load balancing is it not? i remember finding that download.

try v24 at least, bs builds, from january works good.

"Inbound load balancing" requires a routing protocol between you and your ISP's. It seems that the ezplanet firmware was an attempt to make a gui for load balancing that was abandoned. There's a post in their news that states they use the firmware to load balance their servers but whatever their setup is, they can't be load balancing incoming data without a routing protocol which is not what the scripts do although DD-WRT is capable of it.

I'd stick to a firmware that has active development, like the one who's forums you're asking for help on.
IN7OX
DD-WRT Novice


Joined: 15 Jul 2008
Posts: 19

PostPosted: Sun Feb 22, 2009 14:02    Post subject: Reply with quote
got mine workin now on v24sp2
i had too set it up as i would with v23sp2 with jffs
also you can just update fw from v23sp2 too v24sp2 without resetting defaults
now dl at max speed on 2 cable modems which i couldnt achieve on v23sp2
Sipper
DD-WRT Novice


Joined: 21 Aug 2007
Posts: 24

PostPosted: Mon Feb 23, 2009 17:43    Post subject: Reply with quote
IN7OX wrote:
got mine workin now on v24sp2
i had too set it up as i would with v23sp2 with jffs
also you can just update fw from v23sp2 too v24sp2 without resetting defaults
now dl at max speed on 2 cable modems which i couldnt achieve on v23sp2


How did you manage to get round the same network problem with the 2 cable modems?

Sipper
1clicc
DD-WRT Novice


Joined: 15 Feb 2009
Posts: 2

PostPosted: Tue Feb 24, 2009 16:12    Post subject: Reply with quote
I was just wondering if anyone experience the router freezen up or crashes on you and have to unplug the router to startup again? I'm experience that kind of problem maybe approximately 2-3 times a day. I'm running dual wan configuration on dd-wrt v23 sp2 nokiad generic std firmware on a WRT54G-TM router. I have follow the process on how to setup dual wan on the first post and flash my router with the mini than follow up with the stand nokiad std version. Any suggestion or fix i can take to fix the crashes of the router? Thanks a lot fellas.
f0rbez
DD-WRT Novice


Joined: 18 Nov 2008
Posts: 9

PostPosted: Sun Mar 01, 2009 3:49    Post subject: Reply with quote
I followed everything down to the T with the current scripts on your site and can't get the 2nd friggin modem an IP. Can't figure out why.

Heres my ifconfig for the problem port:

Quote:
vlan2 Link encap:Ethernet HWaddr 00:1C:10:5A:C3:2F
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5958 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:308494 (301.2 KiB) TX bytes:666 (666.0 B)


No IP :(

The fact that I'm using an eko build shouldn't matter should it?
Sipper
DD-WRT Novice


Joined: 21 Aug 2007
Posts: 24

PostPosted: Sun Mar 01, 2009 14:09    Post subject: Reply with quote
FWIW I had the same problem until I realised I had modem 2 plugged into the wrong lan port. I was using port 1 instead of port 4.

S
Goto page Previous  1, 2, 3 ... 54, 55, 56 ... 66, 67, 68  Next Display posts from previous:    Page 55 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