How does a router work?

That is an excellent question, I will be happy to assist you with your router.

In a previous blog post we discussed IP addresses and how they work. A quick summary is that they allow your computer to separate itself from all the other computers on the Internet and give the requested information a destination to go to.

Now we also discussed that most of the connections out there are using DHCP (Dynamic Host Configuration Protocol) which means that the router/modem assigns the IP address to the computer automatically. So as an end user, you connect to the router and you are online with no other work needed from you. It works like magic. Of course, like all things on computers nothing is magic, there are a hundred things happening in a split second to make the computer able to connect to the Internet. Your computer getting an IP address happens because of a process called ARP (Address Resolution Protocol).

How does an ARP request work? The first thing to know is that every device that uses the Internet has an identifying number called a MAC (Media Access Control) address. Basically every electronic device has a unique MAC address. That is how we can determine one cell phone from the million of other cell phones, or computers, or tablets in the world. They all have a unique identifying number. When a device connects to the router it sends out a broadcast packet with a request with it’s MAC address saying I need an IP address. The router then takes that MAC address, assigns an IP address to it, then adds that information into it’s routing table so it knows which devices is assigned to which IP address. It then sends back a packet saying hey (device), here is your IP address. Then the device and the router are connected and can start communicating.

arp-eg

That is the basics of routing in a home network. Device asks for IP address from the router using it’s unique MAC address the router assigns the address and then anytime that device requests information the router knows which IP address to send it to.

Nerd Alert: Technical Information to follow!

So now we can dig a little deeper into IP addresses and the type that the router assigns. Again, this is for home network using DHCP. If you are using Static IP or a corporate set up the configuration is different and may not follow the same rules.

Let’s say you wanted to know what IP address your computer has. Well, there are two answers to that. There is the private IP address that only exists inside your home, private network, then there is the public out to the Internet IP address. What do I mean by that?

If you were to open your computer and go to a “command prompt” that would be the black box where you can perform commands on the computer. It looks like this:

windows8-desktop-ipconfig-renew

If you were to type into the command prompt ipconfig you would get back an IP address that says 192.168.1.[number]. That is the private IP address. All devices connected to a router using DHCP will return with that IP address. That is a class C private IP address. All devices on the same network will have the beginning of that IP address and then the last number will be unique to identify all the devices to each other. For example, a network can have multiple devices connected, the first device will be assigned 192.168.1.2, the next device will be 192.168.1.3 and so on for all the devices connected to the router.

Now if you were to open the Internet and go to whatismyip.com or ipchicken.com or any IP address website it will return a different IP address. That is your public Internet IP address. If you were to check all the devices on the network they will all return the exact same IP address.

How is that possible when I told you that all devices need their own IP address to be able to use the Internet? This gets us into a router function known as NAT (Network Address Translation). If you do the math it would be impossible for every device in the world to have a unique IP address there are just not enough combinations of number for that. So to save some addresses when you see the public internet IP address you are really seeing the router’s IP address. When your computer connects to the Internet it uses the IP address that the router provided to connect to the router. The router then translates that IP address into the router’s public IP address and sends the information out into the Internet. The reverse is true. When the data returns it comes in on the router’s public address and the router checks it’s routing table to see what device requested that information, then changes the IP to the private 192.168.1. address and sends the data to the correct device.

my-ip-address

How do we troubleshoot routing issues? Mainly there is one thing to check with IP address routing issues. What is your IP address? Like I said all devices on a private home network will see a 192.168.1. IP address. If the computer is not connecting to the router and you check the IP address on the computer by doing the command prompt ipconfig command you may see an in the range 168.254.0.1 through 169.254.255.254. This is called APIPA or Automatic Private Internet Protocol Addressing. So basically a computer requires an IP address to network with other devices. So if it requests an IP address from the router and does not get a response packet with an IP address it assigns itself one.

apipa-diagram

How would I know this might be happening? If you have ever tried to get online and can’t and when you look down at the wireless or Ethernet symbol on the task bar on the computer and it has that yellow triangle with the ! in it and an error that says “local network only” or “no internet access”. This means that the computer can not get out onto the internet and does not have a proper IP address. You will need to release the stored IP address and get an new one from the router to be able to connect. You can do this by releasing and renewing the address in the command prompt or the easier way is to reboot the device. When the device is accessing the network again it will send out a new ARP request to the router and get a new IP address.

ff_van_04

If you have a technology question you would like answered, please E-mail speakslowerblog@gmail.com and I will be happy to look into it for you.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s