Linux Netfilter discussions
 help / color / mirror / Atom feed
From: leolistas@solucoesip.net
To: "Jeppe Sørensen" <smed@tdcadsl.dk>
Cc: "netfilter@lists.netfilter.org" <netfilter@lists.netfilter.org>
Subject: Re: iptables with alias?
Date: Sat,  5 Oct 2002 17:59:23 -0300	[thread overview]
Message-ID: <1033851563.3d9f52ab0fa9d@webmail.solucoesip.net> (raw)
In-Reply-To: <000a01c26cb0$309bdc80$1801a8c0@CBOOK>



   I think you'll have to tweak your firewall scripts and build your own 
customized SNAT rules. I mean ..... your firewall script can easily get 
the IP address of the interface ( even alias one ) with something similar 
to:

ifconfig "eth0 " | grep inet | cut -d":" -f 2 | cut -d" " -f 1


   Then, in POSTROUTING you could build your rules, just like:

iptables -t nat -A POSTROUTING -s 192.168.1.5 -j SNAT --to-source $IP_ETH0
iptables -t nat -A POSTROUTING -s 192.168.1.6 -j SNAT --to-source 
$IP_ETH00
iptables -t nat -A POSTROUTING -s 192.168.1.8/29 -j SNAT --to-source 
$IP_ETH01 ( 192.168.1.8/29 matches 7-15 )
... and go on ....

   Note that this script can be only executed after ALL interfaces get 
their IP addresses ....


   Hope this helps,
   Leonardo Rodrigues


Quoting Jeppe Sørensen <smed@tdcadsl.dk>:

> Hello
> 
> I have a little question that perhaps someone can help me with
> 
> I have a interface to the inet with 4 dynamic ip addr
> eth0 = first dynamic ip addr
> eth0:0 = second dynmaic ip addr
> and so on
> 
> I want to make 1 on 1 nat on the frist 2 aliass and the last 2 alias are
> for
> the rest of the network
> 192.168.1.5 nat to eth0
> 192.168.1.6 nat to eth0:0
> 192.168.1.7-to-15 nat to eth0:1
> 192.168.1.16-to-30 nat to eth0:2
> 
> but iptables wan't take alias
> 
> What do I do / what can I do ?
> 
> I have looked in the The netfilter user mailinglist Archives and found
> the
> following solution
> 
> ip addr add w.x.y.z/bits dev eth0 label eth00
> 
> but how does I get it to work with dynamic address?


  reply	other threads:[~2002-10-05 20:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-05 20:45 iptables with alias? Jeppe Sørensen
2002-10-05 20:59 ` leolistas [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-10-05 20:37 Jeppe Sørensen
2002-10-05 20:53 ` Antony Stone
2002-10-05 21:52   ` Stewart Thompson

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=1033851563.3d9f52ab0fa9d@webmail.solucoesip.net \
    --to=leolistas@solucoesip.net \
    --cc=netfilter@lists.netfilter.org \
    --cc=smed@tdcadsl.dk \
    /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