Linux Advanced Routing and Traffic Control list
 help / color / mirror / Atom feed
From: "Brian J. Murrell" <brian@interlinx.bc.ca>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] simple dual Internet connection setup not sending
Date: Fri, 26 Nov 2004 16:44:18 +0000	[thread overview]
Message-ID: <1101487458.8287.133.camel@pc> (raw)
In-Reply-To: <1101398346.8287.66.camel@pc>

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

On Fri, 2004-11-26 at 17:17 +0100, diab wrote:

> iirc, to have two working internet connections on one (nat'ing)
> computer you basically need two things (in my example its eth0 and
> eth1)
> 
> 1) SNAT to the right source address, like
> iptables -A POSTROUTING -j nat -t SNAT [-s from.where or -d to.where]\
>          --to-source source.addr.of.eth0

Surely you mean -t nat -j SNAT?

> iptables -A POSTROUTING -j nat -t SNAT [-s from.where or -d to.where]\
>          --to-source source.addr.of.eth1

Ditto on the transposition of -j and -t.

But these two iptables rules conflict with each other.  If -s
"from.where" is my internal lan and the same in both rules, they are
both trying to do the SNATting of the same packets.  In my two rules, I
added a -o <iface> (where <iface> is the interface matching the
source.addr.of.<iface>).

> 
> 2) two routing tables, like
>  ip route add default via eth0.gateway.ip.address dev eth0 table 1

got it:
ip route add 0/0 via 66.11.190.1 dev ppp0 table 1

>  ip route add default via eth1.gateway.ip.address dev eth1 table 2
got it:
ip route add 0/0 via 24.235.240.1 dev eth1 table 2


> maybe you dont even need the "via xx" thing, the dev xxx is enough.
> 
> then you can classify packets to use the connection you want using
>  ip rule add WHATEVER lookup N (whatever could be "to x.x.x.x" or "from
>  x.x.x.x", same as in the SNAT example, N could be 1 or 2)
> 
> if you want the router to respond to packets correcty (ie. to answer
> ping on both interfaces) you need to
>  ip rule add iif eth0 lookup 1
>  ip rule add iif eth1 lookup 2

I have:
ip rule add from 66.11.173.224 lookup 1
ip rule add from 24.235.240.15 lookup 2

what is "iif" in your above examples?  I don't see an "iif" syntax when
I do "ip rule help".  I get:

Usage: ip rule [ list | add | del ] SELECTOR ACTION
SELECTOR := [ from PREFIX ] [ to PREFIX ] [ tos TOS ] [ fwmark FWMARK ]
            [ dev STRING ] [ pref NUMBER ]
ACTION := [ table TABLE_ID ] [ nat ADDRESS ]
          [ prohibit | reject | unreachable ]
          [ realms [SRCREALM/]DSTREALM ]
TABLE_ID := [ local | main | default | NUMBER ]

Thanx much for your input!

b.


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2004-11-26 16:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-25 15:59 [LARTC] simple dual Internet connection setup not sending return packets Brian J. Murrell
2004-11-26  5:40 ` [LARTC] simple dual Internet connection setup not sending return gypsy
2004-11-26 13:19 ` [LARTC] simple dual Internet connection setup not sending Brian J. Murrell
2004-11-26 14:39 ` Brian J. Murrell
2004-11-26 15:21 ` Brian J. Murrell
2004-11-26 16:44 ` Brian J. Murrell [this message]
2004-11-26 17:45 ` Brian J. Murrell
2004-11-26 21:27 ` [LARTC] simple dual Internet connection setup not sendingreturn gypsy

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=1101487458.8287.133.camel@pc \
    --to=brian@interlinx.bc.ca \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox