HIGHLIGHTS

In a previous post I described TCP/IP. In this post I'll focus more on the lower layers of the protocol stack: the IP layer and below. One key thing to understand is that the Internet is built on a single simple idea: the IP Packet.

So what is it?

An IP Packet is lot like a letter you send via the post office. In the case of IP Packets of course, we're really talking about an array of bytes in your computer memory, not a physical piece of mail. But there really are many similarities. In both case you have a From Address, a To Address, and inside it carries some contents that you want delivered at the other end.

With both IP Packets and letters, once you send it you no longer have any control over it - it's out of your hands. It goes into the delivery system and you depend on that delivery system to get it where it's supposed to go. There is a small chance it could get delivered to the wrong place, or lost completely.

The Internet is a series of tubes -US Senator Ted Stevens

The contents could be examined by some third party, damaged so that they are unreadable, or even intentionally altered by some unscrupulous party before being delivered. There are protections against each of these bad outcomes, which I'll talk about in a later post.

A B/W Adobe Posterized Image of Capitol Hill

In the case of a letter, you write the from and to addresses on the outside of the envelope and place the contents inside the envelope. IP Packets have a similar idea. An IP Packet starts life as just a sequence of bytes in your computer memory. Typically the first 20 bytes or so are used like the outside of an envelope. This part of the packet is called the "IP Header".

This is where the from and to IP Addresses are placed. IP Addresses are 4 bytes each(*), so those take up 8 of the 20 bytes. Some of the other bytes in the header are used by the delivery system for housekeeping. As an analogy, recall that the outside of an envelope has a stamp, and the postal service adds a post mark. Similar idea.

After the IP header, we place the bytes of the payload - the thing we want to get delivered to the recipient. Once we've got the payload, and the header constructed, we need to send it. With letters we need to get them to the post office. The equivalent in the IP World is your local Router. The router is responsible for looking at the destination IP address and figuring out where to send the packet next.

That next hop is likely another router that is one step closer to the recipient - just as your local post office might send the letter to another postal facility to be sorted and forwarded on towards the destination address.

The internet is built on a single simple idea: the IP Packet -CSSBakery.com

The way we get the packet from your computer to your local router is over your local area network (WiFi or Ethernet). If you are hooked up directly to a DSL/Cable Modem, then your "local" router is really a router located at your Internet Sevice Provider. The main idea here is that you can send the IP Packet to the router directly over the underlying networking media, whether that is Ethernet, WiFi, DSL, or Dial-up.

There is a whole other story on how the packet gets delivered over this media to the router, but for now just think of this media as your local mailman who picks up the letter and carries it to the post office (i.e. to the local Router). I can go into more details on Ethernet, WiFi, DSL etc. in a future post.

After an IP packet has been constructed in your computer memory, and carried to your local router via your local networking media, the router gets to work. It looks at the destination IP address, and matches this against a set of configured rules in a table. The rules are called "IP Routes", and the table is called the "IP Routing Table". By matching the destination IP address against the IP Routes, the router figures out the next place to send the packet. We call this the "next hop".

The next hop is going to be another router that will repeat the same process-CSSBakery.com

Your IP packet might hop through a dozen routers. Finally it reaches a router that can talk directly to the recipient, and that becomes the final "next hop". The packet is sent from that final router to the destination over the local networking media, just like the mailman delivering mail.

The recipient (destination computer) opens up the packet. It can see the senders IP address, and it can read the contents. It's at this point that IP will hand the contents off to some higher layer protocol like TCP or UDP. IP has done it's job which is to get the contents of the packet from the sender to receiver. Any replies that go back to the sender will be determined by a higher layer protocol.