Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So..i had this argument with my networks teacher. He said that some people complains about router crashes due to many entrys on NAT tables on a router.

I didnt understand and i asked: "If the application uses the same port, why does the router crash?. It should have only one entry (pc-ip,pcport;public-ip,public-port)". And he said: "it doesnt matter its using the same port".

I got the idea that NAT creates an entry for every packet that passes trought it. Iam assuming NAT with overloading as you might have guessed.

So the questions are:

  1. How does nat entrys are created? On a packet basis or connection basis? I mean: suppose i send a udp packet..does the router create an entry?

  2. When i start a TCP connection, does the router create a persistant nat entry until the connection closes?

  3. Was my teacher right? The NAT table can overload assuming an aplication on the same port sending packets?

Thanks in advance.

share|improve this question
    
Running nmap against a large subnet can easily overflow the state table on cheap routers. –  Zoredache Nov 3 '12 at 9:44

1 Answer 1

up vote 1 down vote accepted
  1. Per connection (or per UDP stream)
  2. Yes
  3. Yes. For example, your web-browser on one internal PC can have multiple simultaneous TCP connections open concurrently to each of several different external web servers. For each connection the source-port will vary (chosen randomly) but the destination port and destination IP-address may be identical for several connections. A router designed to serve the needs of two or three computers in a home might be unable to cope with the number of simultaneous connections needed in (for example) a school with perhaps hundreds of very busy computers. Routers have to be sized for the expected load.

If you look at example C source for TCP client described in Howto, you will see that the "sockets" API does not provide any means for the client initiating a connection to specify a source-port.

share|improve this answer
    
You can't open 100 connections with the same source-port if the destination address and port are the same. A typical web server only listens on port 80 so all HTTP connections to that server will have destination-port=80. Each connection must have a unique combination of source-address x source port x destination address x destination port. When you initiate a connection, the operating chooses a random, unused, source-port for you. –  RedGrittyBrick Nov 3 '12 at 11:23
    
So, if my browser starts 100 hundred connections from port 1300 to the same web server, the NAT table will create 100 entrys with(source-ip,1300;public-source, externalport) where external port will vary 100 times while the the rest of the fields are exactly the same? –  returnFromException Nov 3 '12 at 11:28
    
As I said, your browser cannot do that. –  RedGrittyBrick Nov 3 '12 at 11:29
    
Sorry, i was correcting one thing. Ok what if my browser starts 100 connections to 100 different ips, will the NAT table fill 100 entrys with (source-ip,1300;public-source, externalport) –  returnFromException Nov 3 '12 at 11:34
    
whre source-ip, public-source are the same but the external port varies? –  returnFromException Nov 3 '12 at 11:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.