Thursday, 9 May 2013

How college or company computer networks work ?

My college or company has LAN and each computer should be having an IP ,but is this the same IP seen by others in the internet ? How is this happening ? what is that which is making this changes ? How exactly is this network working ? All these are the common questions that would have been haunting you.
   Well,This post is to explain in detail how this works and what are the flaws in it and a detailed explanation of how it works.

All this is done through a simpler approach to address allocation by "NAT"[network address translation ].considering a fact that there are hundreds of computers connected and all are using some same address space example : 10.0.0.0/24 . computers within that network can send packets to each other using 10.0.0.0/24 addressing. However, packets forwarded beyond the home network into large global Internet clearly cannot use these addresses(as either source or a destination address) because there are different other companies or colleges using this block of addresses.That is, the 10.0.0.0/24 addresses only have meaning within the given  home network.But if private addresses only have meaning within a given network,how is addressing handled when packets are sent to or received from the global internet,where addresses are necessarily unique ? the answer lies in understanding NAT.

The NAT enabled router doesn't look like a router to the outside world.Instead the NAT router behaves to the outside world as a single device with a single IP address.In figure, all traffic leaving the home router for the larger Internet has a source IP address of 138.76.29.7, and all traffic entering the home router must have a destination address of 138.76.29.7 . In essence, the NAT-enabled router is hiding the details of the home network from the outside world.(As an inside, you might wonder where the home network computers get their addresses and where the router gets its single IP address..often, the answer is the same - DHCP aka dynamic host configuration protocol , The router gets its addresses to computers within the NAT-DHCP-router -controlled home network's address space. )

If all datagrams arriving at the NAT router from the WAN have the same destination IP address, then how does the router know the internal host to which it should forward a given datagram ? the trick used is NAT translation table at the NAT router, and to include port numbers as well as IP addresses in the table entries.
   Consider the example in figure, Suppose  a user sitting in a home network behind host 10.0.0.1 requests a Web page on some web server (port 80) with IP address 128.119.40.186. The host 10.0.0.1 assigns the (arbitrary) source port number 3345 and sends the datagram into the LAN. The NAT router receives the datagram,generates a new source port number 5001 for the datagram, replaces the original source port number 3345 with the new source port number 5001. When generating a new source port number, the NAT router can select any source port number that is not currently in the NAT translation table. NAT in the router also adds an entry to its NAT translation table.The web server, blissfully not aware that the arriving datagram containing the HTTP request has been manipulated by the NAT router,responds with the datagram whose destination address is the IP address of the NAT router,and whose destination port number is 5001. When this datagram arrives at the NAT router,the router indexes the NAT translation table using the destination IP address and destination port number to obtain the appropriate IP address (10.0.0.1) and port number(3345)  for the browser in the home network. The router then rewrites the datagram's destination address and destination port number, and forwards the datagram into the home network.

The only problem with NAT is a method of hack called "connection reversal".Hope you loved the post.

0 comments:

Post a Comment