Main content
AP®︎/College Computer Science Principles
Course: AP®︎/College Computer Science Principles > Unit 2
Lesson 4: Routing with redundancyIP packets
On the massive network known as the Internet, computing devices send all kinds of messages to other computing devices. A message might be a tiny ping to check if another device is online or a message could be an entire webpage.
But there's a limit to how large a message can be, since there's a limit to how much data can be reasonably transmitted at once by the physical network connections between devices.
That's why many networking protocols split each message into multiple small packets. The Internet Protocol (IP) describes the structure of the packets that whizz around the Internet.
Each IP packet contains both a header (20 or 24 bytes long) and data (variable length). The header includes the IP addresses of the source and destination, plus other fields that help to route the packet. The data is the actual content, such as a string of letters or part of a webpage.
You can think of IP packets like postal letters: the header is the envelope with all the routing information that's needed by the post office, and the payload is the letter that's read only by the recipient.
Just like the postal system routes postal letters around the world, the Internet Protocol routes IP packets around the Internet.
In the next article, we'll learn much more about routing on the Internet.
🙋🏽🙋🏻♀️🙋🏿♂️Do you have any questions about this topic? We'd love to answer—just ask in the questions area below!
Want to join the conversation?
- If the source and destination IP address lines within the IP header are each only 4 bytes (32 bits) long, how is it possible for the header to store IPv6 addresses, which are 128 bits long?(29 votes)
- Nice catch!
The headers of IPv6 packets are 40 bytes (unlike IPv4 with 20 -24 bytes). Just imagine the image like currently only instead of having a single line for the source and destination IP you have a block of lines for each.(30 votes)
- what are IP packets used for?(2 votes)
- They store the data that is sent over a network. For example, when we both wrote on the KA forum, our writing was decomposed into packets, each storing our messages, and these packets were delivered to KA.
Hope this helps!(7 votes)
- i have an ip. does that mean random peoples data packets are traveling through my router?(4 votes)
- Pretty sure not. If an unknown packet was to somehow get into your router, it would most likely be dropped. All packets travel over your ISP's centers and the destination's servers. A way to know is to check the route trace. If you are on Windows, go to command prompt and type 'tracert google.com'. The first couple of hops should be your ISP routing it to a Google server. The other IP address seem to be Google datacenter IPs.(3 votes)
- There is another question: normaly, how many bytes is the whole IP packet linearly? and within it, how many bytes usually is the header? I don't understand the first picture in the text? Should it be linear?(3 votes)
- I'm not sure what you mean with linearly.
The header of an IPv4 packet is between 20 and 24 bytes long and the header of an IPv6 packet is 40 bytes.
The maximum size of an IP packet (total) is 2^16 - 1 bytes.(3 votes)
- where does the port number get stored?(2 votes)
- The source port number and destination port number are stored in the header of the TCP segment. If you are unfamiliar with TCP segments, you can refer to this article here on Transmission Control Protocol (TCP):
https://www.khanacademy.org/computing/computers-and-internet/xcae6f4a7ff015e7d:the-internet/xcae6f4a7ff015e7d:transporting-packets/a/transmission-control-protocol--tcp(4 votes)
- We do use 5g, it's just that 5g is a technology that "sits below" IP. You can basically imagine it like an hour glass with applications like messengers, email, khan academy at the top, technologies like ethernet, wi-fi, 5g at the bottom and TCP/IP in between. The top and the bottom keep changing, new applications to do things with and new technologies for systems to communicate get developed and TCP/IP makes sure that systems can keep communicating with each other despite those changes.(6 votes)
- Is the data in an HTTP request an IP packet? It has headers and data...(3 votes)
- Regarding the servers, I know that is has little to do with this course in particular, but is that all the data, for example, text and videos in Khan Academy website is stored in a specific server hard disk in Google's data center? In this way, all the data from all the websites available in Google is stored in Google servers?(3 votes)
- Does this work with all electronics like computers Ipads phones .ect(2 votes)
- This is essentially how any device with internet capabilities works.(2 votes)
- I am concused I like we send messages to our friends andfamily without limit so I want to know that is the limit of texting in computer(1 vote)
- Over here the limit being referred to is the size of the packet, the texts you send are not transported in their entirety, there is another protocol known as Transmission Control Protocol (TCP) that breaks down your texts into smaller sized blocks called packets through a technique known as packet switching and then assigns these packets a sequence number, the IP then sends these packets to the local ISP which redirect them to the required destination. At the destination the packets might arrive in a random order, it is the job of the TCP to now assemble the packets according to the sequence number they were assigned.(1 vote)