Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Alexander Samad <alex@samad.com.au>
To: netfilter@lists.netfilter.org
Subject: Re: Multiple gateways problem
Date: Fri, 1 Apr 2005 09:52:11 +1000	[thread overview]
Message-ID: <20050331235211.GE8639@samad.com.au> (raw)
In-Reply-To: 20050331133823.6562.qmail@flock1.newmail.ru

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

On Thu, Mar 31, 2005 at 06:37:50PM +0200, Rub?n Cardenal wrote:
>  
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi,
> 
>   I have a quite simple setup in ony of my servers but I can't make
> the conditional routing using iptables to work.
> 
>   The server has:
> 
>   eth0: 192.168.2.0/23
>   eth1/eth2: reserved for future use
>   eth3: 10.10.100.0/24
> 
>   The eth3 is connected to a separate switch where 30 AP's are
> connected to and a dhcp server running on the server gives IP's to
> clients connected to the wireless lan. In the same way, eth0 is
> connected to another set of switchs (isolated from the switch where
> eth3 is connected to) where all LAN clients (192.168.2.0/23) are
> connected to.
> 
>   I can use two gateways, both of them are accessed via eth0:
> 192.168.3.250 and 192.16.3.254. The default gateway for all the LAN
> clients (192.168.2.0/23) is (and must be) 192.168.3.254 and just a
> few people is allowed to use the other gateway.
> 
>   The desired configuration is that I want to be able to route
> certain clients from eth3 (10.10.100.0/24) via 192.168.3.250 instead
> of the default gw of the server (192.168.3.254).
> 
>   All the configurations I've tried, doesn't work or make LAN clients
> loose connectivity with the server. How should I setup routes/rules?
if you can group your users to specific networks then you can use

ip ru for something like this

0:      from all lookup local 
200:    from 10.10.100.0/24 lookup wireless 
201:    from 192.168.2.0/24 lookup plana 
201:    from 192.168.3.0/24 lookup planb 
32766:  from all lookup main 
32767:  from all lookup default 

or in using iptables -t mangle and PREROUTING you can mark your packets
with -m mark --set-mark 0x01

iptables -t mangle -I PREROUTING -s 10.100.100.0/24 -m mark --set-mark
0x01
iptables -t mangle -I PREROUTING -s 192.168.2.0/24 -m mark --set-mark
0x02
iptables -t mangle -I PREROUTING -s 192.168.3.0/24 -m mark --set-mark
0x03

and then use ip ru sort of like

0:      from all lookup local 
200:    fwmark 0x01 lookup wireless 
200:    fwmark 0x02 lookup plana
200:    fwmark 0x03 lookup planb 
32766:  from all lookup main 
32767:  from all lookup default 



and then fill the tables with the appropiate routing rules

note - I split your 192.168.2.0/23 back into 2 /24 just for example, you
might need to check the syntax of the -m mark target as well.

Alex

> 
>   Regards,
> 
> - - Ruben.
> 
> -----BEGIN PGP SIGNATURE-----
> Version: PGP 8.1
> 
> iQA/AwUBQkwnXQcpyqBKAkY5EQLdOwCg/rIS18MM5mKYfXjEhvSiCPgOV1QAmwZ7
> TG3o6vj9sH7NQXoVkgUsBcvS
> =BTkL
> -----END PGP SIGNATURE-----
> 
> 
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

      parent reply	other threads:[~2005-03-31 23:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-31 13:38 simple method to set tos Попов Игорь Николаевич 
2005-03-31 14:25 ` George Alexandru Dragoi
2005-03-31 16:37 ` Multiple gateways problem Rubén Cardenal
2005-03-31 23:52 ` Alexander Samad [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=20050331235211.GE8639@samad.com.au \
    --to=alex@samad.com.au \
    --cc=netfilter@lists.netfilter.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