[Ns-developers] GSOC 2012 NAT model implementation

Tommaso Pecorella tpecorella at mac.com
Sun Mar 25 07:31:16 PDT 2012

Hi Anush,

can you point me to the files you're mentioning ?

I'm pretty sure there's not this kind of functionality in ns-3, even if (of course) there are the relevant IP layers.

In order to successfully implement a NAT, you'll need IP and port mangling.

There is an old repository (http://code.nsnam.org/tomh/ns-3-netfilter/) where a simple netfilter was implemented, but lacking the NAT features.

Now, since Linux does the NAT inside netfilter (well, not exactly, but close to), I'd start by looking at that code and checking where it's the best place to handle the NAT thing. Mind that the repository is *really* old, so you'll need to take the code in thee and adapt it to run on the newest ns-3-dev, and that's not a simple copy-paste. Anyway, it's a start.

Best regards,


On 25 Mar 2012, at 15:49, anush vishwanath wrote:

> Hello Lalith,
> The problem statement to this project says "to be able to mimic the Linux
> NAT behaviour"..
> so what i did was i went and read about the complete implementation details
> on how connections are maintained and NAT is used in Linux..
> I had downloaded the ns3 source code like i mentioned earlier.I saw that
> the ns 3 code had the same files which Linux uses for NAT
> implementation..so if these files already exist in ns 3 what exactly needs
> to be done???what does the project require to be done??
> Reagrds,
> Anush V
> On Sun, Mar 25, 2012 at 12:53 PM, Lalith Suresh <suresh.lalith at gmail.com>wrote:
>> Hi Anush,
>> On Wed, Mar 21, 2012 at 5:53 PM, anush vishwanath
>> <anush.pasteface at gmail.com> wrote:
>>> Hello ns-developers,
>>> I had mailed you a couple of days back regarding my interest to work for
>>> ns3 organisation in the upcoming GSOC 2012.
>>> I understand the need to have the NAT functionality to be built into ns3
>> as
>>> this is being widely used by a lot of people in the world even today.
>> IPv6
>>> might make NAT redundant but untill the time when the entire world
>> switches
>>> to IPv6 we must live with NAT and simulations incvolving NAT become
>>> important to incorporate into ns3.
>>> Tasks already completed:
>>>  - downloaded and built the source code of latest ns3 version
>>>  - read the recommended books on the ideas page for GSOC 2012 with
>>>  respect to this project
>>>  - read the ns3 tutorial and understood the structuring of the varioius
>>>  modules under ns3
>>> I would be happy if someone could guide me as to what exactly should i do
>>> to be able to come out with a good proposal for this project.
>> I'm pretty sure you will need to look at [1] and take it from there
>> for this project. Look at the Ipv4L3Protocol class
>> (src/internet/model/ipv4-l3-protocol.cc), and you'll find a bunch of
>> netfilter 'hooks' in the code.
>> I suggest having a look at our application template and begin filling
>> it up. It would be easier to start from a draft.
>> [1] http://code.nsnam.org/tomh/ns-3-netfilter/
>>> Regards,
>>> Anush V
>>> 3rd Year student,
>>> PES Institute of Technology,
>>> Bangalore, India
>> --
>> Lalith Suresh
>> www.lalith.in
> -- 
> *Science is the poetry of reality.........*


The nice thing about standards is that there are so many to choose from.
And if you really don't like all the standards you just have to wait another year until the one arises you are looking for.
-- A. Tanenbaum, "Introduction to Computer Networks"


Tommaso Pecorella - Ph.D.

Assistant professor
Dpt. Elettronica e Telecomunicazioni
Università di Firenze

CNIT - Università di Firenze Unit

via di S. Marta 3
50139, Firenze

email: tommaso.pecorella at unifi.it
       tommaso.pecorella at cnit.it

phone : +39-055-4796412
mobile: +39-320-4379803
fax   : +39-055-494569

More information about the Ns-developers mailing list