Accéder au contenu principal

Home network, IP adress behind a router, how it works?

If you're using a router to access the Internet, then, maybe, you have noticed that your computer IP address is not the same seen from a computer or server outside your local network. Your router is hiding your local adress and permit the sharing of one single access to the Internet.

How is it working?

The router uses a technique named NAPT (Network Address Port Translator).
NAP ... What?
Typically, several computers are linked to one router in a Small or Home Office (SOHO). This router has only one IP address and is providing this single access to the SOHO computers.
Let's say that, in fact, SOHO is Pr. John Doe's local network. Pr. John Doe has one nice black and silver brand new laptop featuring a huge hard drive disk and the latest processor. He owns as well, one slow and an old dusty computer he uses from time to time to browse the net. Let call the first computer, computer B like Brilliant and the second one, computer C like Crappy.
A is the name of the router. Computers B and C are linked to the router A. A,B,C constitute a local network. In this network, Pr. Doe's choose the following addresses:
A: 255.168.1.1
B: 255.168.1.2
C: 255.168.1.3

The address seen by an external device: 23.45.67.86. This address has been given by John Doe's ISP (Internet Service Provider).
John Doe is now connecting to the Internet using his powerful laptop. His home page is google.com (IP : 64.233.169.99).
The router A has already assigned "identification numbers" to B and C, named ports.
So, every communication initiated by B will be stamped "port 1".
And as well, every communication initiated by C will be stamped "port 2".
B requests a connection to google.com (IP : 64.233.169.99).
IP datagram contains (unit of information on the Internet)
  • IP address source
  • Port source (after the colon in the example)
  • IP address destination
  • Port destination (after the colon in the example)

the message
{src: 255.168.1.2 : 80 | dest: 64.233.169.99 : 80 | HTTP/1.0 GET} is sent to the router A.
Then, router A replaces the IP address source and the Port source by his external adress. And, in order to trace the communication, A replaces the source port by 1. The message emitted is then:
{src: 23.45.67.86 : 1 | dest: 64.233.169.99 : 80 | HTTP/1.0 GET}
When the reply comes from google, the router knows that the response must be sent to A because the message contains destination port 1.

This is how Pr. Doe's brand new computer communication is not mixed up with old and crappy computer's messages. This is how we are all able to share only one IP adress with a router.

source : http://www.faqs.org/rfcs/rfc3022.html

Commentaires

Posts les plus consultés de ce blog

Setting up Rust on Windows 10 with MSYS2 without installing Visual Studio

Setting up Rust on Windows 10 with MSYS2 without installing Visual Studio  1. Install MSYS2 2. Update MSYS2 and run : pacman -Sy && pacman -Syu  and install git and gcc: pacman -S git &&  pacman -S mingw-w64-x86_64-toolchain 3. Open the MSYS2 terminal and install the rust compiler with :  pacman -S mingw-w64-x86_64-rust You may stop here but you will miss the rustup package (which is not part of MSYS2) to manage the Rust compiler environment. To install rustup , follow the next steps. 4. Clone the rustup git repository :  git clone git@github.com:rust-lang/rustup.git --depth=1 5. Compile and run rustup: cd rustup cargo run --release 6. Once rustup detects the previously installed rust compiler and asks to uninstall it before you can continue. So, open a new MSYS2 terminal and uninstall rust :  pacman -R mingw-w64-x86_64-rust 7. Now back to the rustup terminal, choose yes to continue the installation. On the next question choose : custom ins...

Installing Ubuntu 16.04 on an Alienware Aurora R5

Installing Ubuntu 16.04 LTS on an Alienware Aurora R5 with NVIDIA GPU support (Dual boot Windows) I have compiled these instructions from my succesful installation on Nov 25. Would you be happy to live without Windows? If not use Dual Boot. This procedure is inspired from this DELL support page : http://www.dell.com/support/article/uk/en/ukbsdt1/SLN301754/en You can refer to the link above for additional steps and to see useful screenshots. However, please, make sure to take care about the GPU-related  steps below. Re-installing Windows 10 with BIOS Secure Boot to OFF First, check that have only one disk installed in your machine. I have found that having one disk only makes it easier to re-install Windows. Secondly, an important step is to create two USB Recovery disks. Use two USB memory sticks bigger than 16 GB supporting the USB 3.0 standard (file copy will be much faster). Use the first one to create a recovery disk for Windows 10, as a backup if the instal...

How to create an executable from a Scala project

I started to have fun with scala and I wanted to be able to package and launch a Scala executable. It is an eclipse project and it is already using Maven for dependency resolution. I found the following solutions (to confirm) 1. Use SBT as a build tool. SBT seems to support the Maven pom.xml files for dependency resolution. 2. Use Gary Boone's solution by wrapping the Scala project entry point into a Java static main function 3. Use mvn assembly : single plugin as described on stackoverflow