Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "J. Bakshi" <joydeep@infoservices.in>
To: netfilter@vger.kernel.org
Subject: Re: ip_forwarding in a more restricted way
Date: Mon, 14 Dec 2009 12:28:36 +0530	[thread overview]
Message-ID: <4B25E21C.4020902@infoservices.in> (raw)
In-Reply-To: <4B25DF30.5010607@infoservices.in>

J. Bakshi wrote:
> Dear list,
>
> I have ip_forwarding running well on my gateway since long. The
> configuration is simple to allow a linux box to work as a gateway.
>
> #### my old ip_forwarding rule ########
>
> echo 1 >  /proc/sys/net/ipv4/ip_forward
>
> iptables -A FORWARD -i ${WAN_IFACE} -o ${LAN_IFACE} -s 192.168.1.0/24 -m
> conntrack --ctstate NEW -j ACCEPT
> iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
> iptables -A POSTROUTING -t nat -j MASQUERADE
> ##############
>
> With a 2.6.X series of kernel and 2 NIC cards the box is working as a
> gateway.  But now I like to add some more fine tuned control.  I have
> created a routing table at  /etc/iproute2/rt_tables and I want to
> *force* the traffic to pass within ${WAN_IFACE} and ${LAN_IFACE} or to
> go through the table I have created for routing.
> It might me
>
> 1] ${WAN_IFACE}  <--- ip_forwarding always between these two interfaces
> ---> ${LAN_IFACE}
>
>                                    OR
>
> 2]  ${WAN_IFACE} <--> [routing table]  <--- route  always via these
> table from these two interfaces  ---> ${LAN_IFACE}
>
>
> Could any one kindly suggest any possible modification of the above rule ?
>
> One possible solution can be ( collected from net )
>
> ` ` `
> # iptables --table ${tablename} --append POSTROUTING --out-interface
> ${WAN_IFACE} -j MASQUERADE
> # iptables --append FORWARD --in-interface ${LAN_IFACE} -j ACCEPT
> ` ` `
>
> But I have no idea if it can do the job in right way. Any more robust
> configuration ?
>   

PS:   And the requirement is two implement dual gateway is a single box


-- 
জয়দীপ বক্সী


  reply	other threads:[~2009-12-14  6:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-14  6:46 ip_forwarding in a more restricted way J. Bakshi
2009-12-14  6:58 ` J. Bakshi [this message]
2009-12-14 10:49   ` J. Bakshi

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=4B25E21C.4020902@infoservices.in \
    --to=joydeep@infoservices.in \
    --cc=netfilter@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