[Click] Simple IP Map

Riyaz rmoh6630 at uni.sydney.edu.au
Wed Oct 7 18:56:00 EDT 2009


Hi Harald,

    Thank you very much for your assistance. It worked perfectly. I had to make a few modifications seeing as I wasnt directly swapping out the destination IP Address. I am acutally modelling Mobile IP using GRE Encapsulation. Basically any packet that comes in needs its destination address (x.x.x.x) checked, encapsulated in a GRE Header and forwarded to an external corresponding y.y.y.y address. Heres what I did:

FromDevice(...) -> Strip(14) -> GREEncap(0x0800) -> IPEncap(47, SRC, Bogus DST)
-> GetIPAddress(40/*to set the dst annotation to the destination address within the gre packet*/)
->StoreIPAddress(dst) -> RadixIPLookup(x.x.x.x/32 y.y.y.y 0/*to do the lookup*/)
-> StoreIPAddress(dst) -> EtherEncap(.....) -> ToDevice(...)

Thank you also Beyers for your quick response.

Kind regards,

Riyaz

________________________________________
From: Harald Schiöberg [harald at net.t-labs.tu-berlin.de]
Sent: Tuesday, 6 October 2009 6:21 PM
To: Riyaz
Cc: click at pdos.csail.mit.edu
Subject: Re: [Click]  Simple IP Map

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Riyaz wrote:
> Hi guys,
>
>     Does anyone know of a simple IP-to-IP Mapping element that also has a write handler to allow changes during runtime?
>
>     Basically what I want to do is re-write the destination IP Address based on a simple mapping in a table (similar to NAT but just IP to IP).
>
> For example,
>
> Table:
>
> 10.1.1.1    123.123.123.123
> 10.1.1.2    254.254.254.254


RadixIPLookup(
        10.1.1.1/32 123.123.123.123 0,
        10.1.1.2/32 254.254.254.254 0
        )
        ->
        StoreIPAddr(dst)

should do the trick

(IPRouteTable elements set the dst_anno to the nexthop, StoreIPAddr puts
it in the packet)

check the docs of StoreIPAddr for checksum recalculations....

        harald



>
> For a packet arriving destined for 10.1.1.1, rewrite the destination to 123.123.123.123.
>
> I dont have much experience writing C++ code nor the confidence trying to write a new element, so any help would be greatly appreciated. I am considering forwarding these packets out a tap device and allowing a user-level java program to do the mapping, but this might greatly affect performance.
>
> Kind regards,
>
> Riyaz
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click


- --
Harald Schiöberg
Technische Universität Berlin | T-Laboratories | FG INET
www: http://www.net.t-labs.tu-berlin.de
Phone: +49-(0)30-8353-58476 | Fax: +49-(0)391 534 783 47
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFKyvAFy8wrZ9OvkU0RAutIAKDztMrWIaC9C8IjgZ4UH15PsE8eMQCeIhkM
vi9iKuN+M77zHu65EuIa16k=
=KYaQ
-----END PGP SIGNATURE-----



More information about the click mailing list