public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: thegeezer <thegeezer@thegeezer.net>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] IP Load Sharing - Per Packet Load Balancing (Linux router)
Date: Mon, 27 May 2013 15:31:53 +0100	[thread overview]
Message-ID: <51A36E59.4020406@thegeezer.net> (raw)
In-Reply-To: <CAGWRaZbx9PymrWh81Y-Xztc1_duYhwasYCE1N1459Qx35fgZVQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2323 bytes --]

On 05/27/2013 02:53 PM, Nick Khamis wrote:
> And who says you can't teach an old man new tricks huh geezer ;)?
> Thank you so much for your response!!! That sorts out outgoing
> traffic, have you had to setup rules for incoming traffic? I mean
> from the outside world to a server for example?
>
> Kind Regards,
>
> Nick.
in this instance for me there is no need for incoming NAT
however, all you need in the mangle table is for each incoming connection:
# iptables -t mangle -I redirection 2 -i eth1 -j WAN1
to ensure that packet marking happens for incoming packets too, but
after the RELATED connections are marked.
in my example of 2 connections on each interface it gets messy and so I
would suggest doing this for only one Internet connect per interface --
otherwise the return packets will be forced out one direction resulting
in TCP handshakes failing.

once you are flagging incoming packets, then normal iptables NAT rules
can be used,
if you have e.g.
iptables -t nat -I PREROUTING -p tcp -m tcp --dport 80 -j DNAT
--to-destination 10.0.0.69
then this would apply for *all* external IP addresses.

in this instance you could have DNS like this
webserver1.domain.tld  A  externalIP-WAN1
                                        A externalIP-WAN2
that would then allow you to to have some resiliency if you were hosting
a web server behind two adsl connections and wanted to ensure a level of
load balancing / robustness


altenatively you can have
iptables -t nat -I PREROUTING -i eth1 -p tcp -m tcp --dport 80 -j DNAT
--to-destination 10.0.0.69
iptables -t nat -I PREROUTING -i eth3 -p tcp -m tcp --dport 80 -j DNAT
--to-destination 10.0.0.70

which would allow you to have a different web server on each adsl
connection.

hope this helps,


PS one thing i've just remembered is to be wary of
/proc/sys/net/ipv4/conf/<interfaces>/rp_filter
as the way it detects reverse paths seemingly is to ignore everything above

/etc/sysctl.conf

net.ipv4.conf.default.rp_filter 

rp_filter - BOOLEAN
	1 - do source validation by reversed path, as specified in RFC1812
	    Recommended option for single homed hosts and stub network
	    routers. Could cause troubles for complicated (not loop free)
	    networks running a slow unreliable protocol (sort of RIP),
	    or using static routes.

	0 - No source validation.




[-- Attachment #2: Type: text/html, Size: 3871 bytes --]

      reply	other threads:[~2013-05-27 14:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-25 20:48 [gentoo-user] IP Load Sharing - Per Packet Load Balancing (Linux router) Nick Khamis
2013-05-25 21:26 ` [gentoo-user] " Nick Khamis
2013-05-26 13:17   ` Nick Khamis
2013-05-26 15:47   ` [gentoo-user] " Stroller
2013-05-26 21:35     ` J. Roeleveld
2013-05-26 22:51       ` Mick
2013-05-26 23:40         ` Nick Khamis
2013-05-26 23:40           ` Nick Khamis
2013-05-27  0:16             ` Nick Khamis
2013-05-27  8:14               ` Mick
2013-05-27 13:07 ` thegeezer
2013-05-27 13:53   ` Nick Khamis
2013-05-27 14:31     ` thegeezer [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=51A36E59.4020406@thegeezer.net \
    --to=thegeezer@thegeezer.net \
    --cc=gentoo-user@lists.gentoo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox