12 August 2008

Routers for Newbies

Router, as that left symbol you see depicted, is the device of choice if you want to share your internet connection to other users in your home/office.

Here's the picture, if you subscribe to the ISP (Internet Service Provider) in your area, the ISP will give you a public IP address. This public address is your identity in the internet. It's like your home address, if you want to send a letter to your friend you will send the letter to the local post office (ISP's router) then the local post office send it to other post office (another router). Last the letter shall be sent to your friend's address.

When your friend received the letter, he/she will know where to send back the reply letter, your address should be written on your letter right?
Same thing goes with the routing world. That's what routers do, they route your packets to a known destination. Therefore the routers need to introduce themselves with their neighbors.

Once a router receive a packet they will send the packet to other router which knows the receiver address or knows the other router that might know the address.
Now don't get confused, the router doesn't know every address in the internet, but they work together with other routers to form the internet.

Now why do you need router to share your internet connection? Well, the ISP will usually give you only 1 public IP address which should only be used by only one device.
What routers do also is NAT (Network Address Translation). NAT will translate your public IP address into private IP address.
Private IP address only significant to your local network, meaning everybody else in the internet don't know the IP addresses in your local network, they only know your public address.

The NAT will divide the public IP address for your private IP address, they do that by assigning "ports" for every packet that the computers in your local network send to get to the internet.
Now this is not physical ports as in your computer ports, but more as logical ports, ports like port 80 for your HTTP connection, etc.
For example, computer A send a request to google.com, then the router will assign a port to the request, and when computer B send other request they will be assign other port.
This is how routers know who send the packet.

You need to remember that routers communicate with other routers using the logical address which is IP address, in contrast with switches that communicate using the physical address which is the MAC address of your NIC (Network Interface Card).

Don't worry you don't need to get in depth about this unless you want to take some network certifications. This is the basic concept that you need to know.
Most low end routers have simple configuration to let you set up your network in no time.

Inside of a router is typically same with PC, router has a CPU, RAM, storage media, etc. That's why router and PC are at the same layer of OSI layer.
I'm working on writing about OSI layer, so I'll talk about it later.
For this reason, that's why you have to use crossover cable to connect PC directly to router. Same thing goes when you want to connect 2 switches together.
But if you use low end routers such as from linksys, D-Link you don't need to do this because they have a built-in switch ports - not router ports. You can use the straight-through cable instead.

For the above reason also, you can transform your PC into a router, cool.