netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: "Niels Möller" <nisse@southpole.se>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"Jonas Bonn" <jonas@southpole.se>
Subject: Re: What's the right way to use a *large* number of source addresses?
Date: Sat, 24 May 2014 18:02:23 +0200	[thread overview]
Message-ID: <5380C28F.2050508@nod.at> (raw)
In-Reply-To: <5380B729.5080101@mojatatu.com>

Am 24.05.2014 17:13, schrieb Jamal Hadi Salim:
> On 05/24/14 10:44, Richard Weinberger wrote:
> 
>> How to use this?
>> My tc's manpage does not know anything about nat.
>>
> 
> Start writing one and i will help.

*grml* yet another awesome and undocumented feature buried in the network stack.

>> Maybe I'm mistaken but IIRC all non-netfilter nat code has been removed.
>>
> 
> This is stateless nat nothing to do with netfilter (much more efficient). Here's some documentation for you ;->

Digging through the code shows that this feature is rather new.
I had the old nat functionality of the routing subsystem in mind.

> ----
> hadi@jhs-1:~$ $TC filter add $DEV parent ffff: protocol ip u32 match ip dport 8080 0xffff flowid 1:1 action nat help
> Illegal nat construct (help)
> Usage: ... nat NAT
> NAT := DIRECTION OLD NEW
> DIRECTION := { ingress | egress }
> OLD := PREFIX
> NEW := ADDRESS
> bad action parsing
> parse_action: bad value (2:nat)!
> Illegal "action"
> -----
> 
> Google will give you more examples, but here's one:
> 
> Lets add a rule on the public facing bridge:
> 
> hadi@jhs-1:~$ $TC filter add dev virb0 parent ffff: protocol ip u32 match ip dport 8080 0xffff flowid 1:1 action nat ingress 192.168.10.15/32 10.0.0.15/32
> 
> 
> now display it:
> hadi@jhs-1:~$ $TC -s filter ls dev virbr0 parent ffff: protocol ip
> filter pref 49152 u32
> filter pref 49152 u32 fh 800: ht divisor 1
> filter pref 49152 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1
>   match 00001f90/0000ffff at 20
>     action order 1:  nat ingress 192.168.10.15/32 10.0.0.15 pass
>         installed 96 sec used 96 sec    Action statistics:
>       Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
>       backlog 0b 0p requeues 0
> 
> You will need to add a reverse translation for internal->external

Thanks for the howto.

Thanks,
//richard

  reply	other threads:[~2014-05-24 16:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-23  9:38 What's the right way to use a *large* number of source addresses? Niels Möller
2014-05-23 10:11 ` Florian Westphal
2014-05-23 10:49   ` Lukas Tribus
2014-05-23 12:26   ` Niels Möller
2014-05-23 14:12   ` Niels Möller
2014-05-23 12:53 ` sowmini varadhan
2014-05-23 14:14   ` Eric Dumazet
2014-05-24 12:06     ` Jamal Hadi Salim
2014-05-23 22:39 ` Cong Wang
2014-05-26  6:39   ` Niels Möller
2014-05-24 11:58 ` Jamal Hadi Salim
2014-05-24 14:44   ` Richard Weinberger
2014-05-24 15:13     ` Jamal Hadi Salim
2014-05-24 16:02       ` Richard Weinberger [this message]
2014-05-24 17:54         ` David Miller
2014-05-24 18:30         ` Jamal Hadi Salim

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=5380C28F.2050508@nod.at \
    --to=richard@nod.at \
    --cc=jhs@mojatatu.com \
    --cc=jonas@southpole.se \
    --cc=netdev@vger.kernel.org \
    --cc=nisse@southpole.se \
    /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;
as well as URLs for NNTP newsgroup(s).