Updated: May 18, 2019
I recently re-watched the HBO series "Silicone Valley" and one of my favorite quotes from the whole show stuck out to me. For those of you who have not watched the show, this quote comes from one of the main characters when asked about what he does/brings to the table for the team.
"What do I do? System Architecture. Networking and Security. No one in this house can touch me on that. But does anyone appreciate that? While you were busy minoring in gender studies and singing acapella at Sarah Lawrence, I was getting root access to NSA servers. I was a click away from starting a second Iranian revolution. I prevent cross site scripting, I monitor for DDoS attacks, emergency database rollbacks, and faulty transaction handlings. The internet, heard of it? Transfers half a petabyte of data a minute, do you have any idea how that happens? All of those YouPorn ones and zeros streaming directly to your shitty little smart phone day after day. Every dipshit who shits his pants if he can't get the new dubstep Skrillex remix in under 12 seconds. It's not magic, it's talent and sweat. People like me ensuring your packets get delivered unsniffed. So what do I do? I make sure that one bad config on one key component doesn't bankrupt the entire fucking company. That's what the fuck I do."
You can view the clip here
This gets me every time... I can't help but pause the show and laugh audibly for an extended period of time.
So... what is a packet? In layman's terms, it is a box that we use to ship information, complete with the sender's information and receiver's information - but packets are really so much more. Let's consider an email being sent and received.
The e-mail is broken into smaller parts. These are the packets. Each packet carries the information that will help it get to its destination -- the sender's IP address, the intended receiver's IP address, something that tells the network how many packets this e-mail message has been broken into and the number of this particular packet. The packets carry the data using Transmission Control Protocol/Internet Protocol (TCP/IP). Each packet contains part of the body of your message. A typical packet contains perhaps 1,000 or 1,500 bytes. Once received on the other end, the packets are reassembled to form the entire email message.
Most network packets are split into three parts:
Header - The header contains instructions about the data carried by the packet. These instructions may include:
Length of packet (some networks have fixed-length packets, while others rely on the header to contain this information)
Synchronization (a few bits that help the packet match up to the network)
Packet number (which packet this is in a sequence of packets)
Protocol (on networks that carry multiple types of information, the protocol defines what type of packet is being transmitted: e-mail, Web page, streaming video)
Destination address (IP address the packet is going to)
Originating address (IP address the packet came from)
Payload - This is the actual data that the packet is delivering to the destination. If a packet is fixed-length, then the payload may be padded with blank information to make it the right size.
Footer - This typically contains a couple of bits that tell the receiving device that it has reached the end of the packet. It may also have some type of error checking. The most common error checking used in packets is Cyclic Redundancy Check (CRC).
As an example, let's look at how an e-mail message might get broken into packets. Let's say that you send an e-mail to a friend. The e-mail is about 3,500 bits (3.5 kilobits) in size. The network you send it over uses fixed-length packets of 1,024 bits (1 kilobit). The header of each packet is 96 bits long and the trailer is 32 bits long, leaving 896 bits for the payload. To break the 3,500 bits of message into packets, you will need four packets (divide 3,500 by 896).
Three packets will contain 896 bits of payload and the fourth will have 812 bits. Here is what one of the four packets would contain: