All of lore.kernel.org
 help / color / mirror / Atom feed
From: ro0ot <ro0ot@phreaker.net>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] failover works - but balancing does not
Date: Tue, 18 Jan 2005 14:34:06 +0000	[thread overview]
Message-ID: <41ED1E5E.3080707@phreaker.net> (raw)
In-Reply-To: <be7468bb0501172320480bff51@mail.gmail.com>

Hi,

Can I know how is your failover works?  Any additional scripts?

Regards,
ro0ot


roderick tapang wrote:

>here's the setup (two dsl - same provider)
>
>                                +-----> link1
>LAN----- linux box  --|             |----------internet
>                                +-----> link2
>
>the setup is ok in terms of the failover requirement. the other link
>takes over when one is down. however, there is a very noticeable lag
>when both lines are up. i've tried changing the weight value to a
>higher one but the links are still under utilized and some client machines
>playing games or mostly disconnected. taking down one link makes the
>connection ok.
>any suggestions? do i need to patch the kernel?
>
>below is the script i'm  using on a mandrake 10.1 box.
>
>thanks.
>erik
>
><start of script>
>#!/bin/sh
># Iptables userspace executable
>IPTABLES="/sbin/iptables"
># Internal Interface
>NET_INT_INT=eth1
># Internal IP
>NET_INT_IP\x192.168.0.101
># Internal Subnet
>NET_INT_SUB=/24
># Internal Network
>NET_INT_NET\x192.168.0.0
># First external interface
>NET_EXT_INT1=eth0
># First external IP
>NET_EXT_IP1\x192.168.1.7
># First external interface's gateway
>NET_EXT_GW1\x192.168.1.1
># Second external interface
>NET_EXT_INT2=eth2
># Second external IP
>NET_EXT_IP2\x192.168.1.3
># Second external interface's gateway
>NET_EXT_GW2\x192.168.1.1
>echo "Flushing All Tables"
>$IPTABLES -F
>$IPTABLES -F -t nat
>$IPTABLES -F -t mangle
>$IPTABLES -X -t nat
>$IPTABLES -X -t mangle
>$IPTABLES -X
>
>$IPTABLES -t mangle -N ETH0
>$IPTABLES -t mangle -F ETH0
>$IPTABLES -t mangle -A ETH0 -j MARK --set-mark 1
>
>$IPTABLES -t mangle -N ETH2
>$IPTABLES -t mangle -F ETH2
>$IPTABLES -t mangle -A ETH2 -j MARK --set-mark 2
>
>$IPTABLES -t nat -N SPOOF_ETH0
>$IPTABLES -t nat -F SPOOF_ETH0"
>$IPTABLES -t nat -A SPOOF_ETH0 -j SNAT --to ${NET_EXT_IP1}
>
>$IPTABLES -t nat -N SPOOF_ETH2
>$IPTABLES -t nat -F SPOOF_ETH2H2 "
>$IPTABLES -t nat -A SPOOF_ETH2 -j SNAT --to ${NET_EXT_IP2}
>
>echo "Setting some local network rules..."
>$IPTABLES -A INPUT -p icmp -s ${NET_INT_NET}/24 -d ${NET_INT_IP} -j ACCEPT
>
>echo "Setting Mangle rules for eth0..."
>$IPTABLES -t mangle -A OUTPUT -o ! ${NET_INT_INT} -m random --average 50 -j ETH0
>$IPTABLES -t mangle -A PREROUTING -i ${NET_INT_INT} -m random
>--average 50 -j ETH0
>ip ro add table 10 default via ${NET_EXT_GW1} dev ${NET_EXT_INT1}
>ip ru add fwmark 1 table 10
>ip ro fl ca
>
>echo "Setting Mangle rules for eth2..."
>$IPTABLES -t mangle -A OUTPUT -o ! ${NET_INT_INT} -m random --average 50 -j ETH2
>$IPTABLES -t mangle -A PREROUTING -i ${NET_INT_INT} -m random
>--average 50 -j ETH2
>ip ro add table 20 default via ${NET_EXT_GW2} dev ${NET_EXT_INT2}
>ip ru add fwmark 2 table 20
>ip ro fl ca
>
>echo "Setting up spoofing rules..."
>$IPTABLES -t nat -A POSTROUTING -o ${NET_EXT_INT1} -j SPOOF_ETH0
>$IPTABLES -t nat -A POSTROUTING -o ${NET_EXT_INT2} -j SPOOF_ETH2
>
>echo "Adding default route..."
>ip ro add default nexthop via ${NET_EXT_GW1} dev ${NET_EXT_INT1}
>weight 1 nexthop via ${NET_EXT_GW2} dev ${NET_EXT_INT2} weight 1
>
>echo "Disabling Reverse Path Filtering..."
>echo 0> /proc/sys/net/ipv4/conf/eth0/rp_filter
>echo 0> /proc/sys/net/ipv4/conf/eth2/rp_filter
>
>echo "Enabling IPv4 Packet forwarding..."
>echo "1"> /proc/sys/net/ipv4/ip_forward
><end of script>
>
>  
>



_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

      parent reply	other threads:[~2005-01-18 14:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-18  7:20 [LARTC] failover works - but balancing does not roderick tapang
2005-01-18  8:30 ` Tóth Nándor
2005-01-18 14:34 ` ro0ot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41ED1E5E.3080707@phreaker.net \
    --to=ro0ot@phreaker.net \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.