[Click] IPAddrRewriter Element Usage

Eddie Kohler kohler at cs.ucla.edu
Mon Aug 27 18:20:02 EDT 2007


Hi David,

Our paper has a bit more about the IPRewriter elements:
http://pdos.csail.mit.edu/papers/rewriter-openarch02.pdf

In fact IPAddrRewriter can only be used to rewrite SOURCE addresses, 
since this is what's useful for NAT.  You want IPAddrPairRewriter. 
Here's an example config fragment, which will rewrite to destination 
address 1.0.0.2:

...your packets... -> IPAddrPairRewriter(pattern - 1.0.0.2 0 0) -> ...

But IPAddrPairRewriter may do more than you want.  The Rewriter family 
remembers packet address mappings, so that reply packets can be 
rewritten back to the original addresses.   For example, say a packet 
with addresses "9.9.9.9 > 8.8.8.8" goes through that config fragment. 
Then the IPAddrPairRewriter will rewrite the addresses to "9.9.9.9 > 
1.0.0.2".  Furthermore, it will remember this mapping.  All future 
packets from "9.9.9.9 > 8.8.8.8" will be rewritten to "9.9.9.9 > 
1.0.0.2", AND all future packets from "1.0.0.2 > 9.9.9.9" will be 
rewritten to "8.8.8.8 > 9.9.9.9".

This is usually useful, but if you just want to update the destination 
address, period, check out StoreIPAddress.  I just updated it so that 
the special "src" and "dst" offset values will update checksums, as you 
might want.

Eddie


dmoore7 at nd.edu wrote:
> Hello All,
> I'm doing some work rerouting packets, and am uncertain about the usage of the
> IPAddrRewriter element.  I've been rereading the element's documentation, and
> tried looking for examples, but how to actual utilize it is still unclear to
> me.
> 
> What I would like to do with it is take all incoming packets (which will have
> the same destination IP) and change that destination IP to another defined IP
> address.
> 
> Any input is appreciated, thanks,
>  - David Moore
> 
> 
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click


More information about the click mailing list