π Lecture 33 β Working of TCP
π Overview: This lecture explains the operational mechanics of the TCP protocol within the TCP/IP suite. It covers how TCP interacts with application layer protocols, the process of data segmentation and encapsulation, and the fundamental role of transport layer services in ensuring reliable communication between hosts.
ποΈ Topics Covered
The lecture begins by explaining the relationship between application layer protocols (like HTTP and SMTP) and transport layer protocols (TCP and UDP) which are part of the operating system. It describes how transport layer protocols provide logical communication between application processes running on different hosts. The key functions covered include segmenting data on the sending side and reassembling it on the receiving side. The lecture also introduces the two Internet transport layer optionsβTCP (reliable) and UDP (unreliable)βand provides an example of TCP's encapsulation process when a browser requests a web page.
π Lecture Summary
Working of TCP
When using a TCP/IP application, the application layer protocol uses a transport layer protocol to send messages across the network. Application layer protocols (such as HTTP for WWW and SMTP for email) are part of the application software, while transport layer protocols are typically part of the operating system (OS) of the computer. The transport layer software waits for the application program to ask it to perform actions.
An application layer protocol could theoretically avoid using a transport layer protocol, but transport protocols provide essential services that many applications need. It is better, faster, cheaper, and simpler for an application to use a transport layer protocol because it provides logical communication between application processes running on different hosts.
π Definition β Logical Communication: Communication that appears to exist directly between application processes on different hosts, even though the data actually travels through multiple network layers and intermediate devices.
Segmenting Data Before Sending
Transport protocols run in end systems. On the sending side, the transport layer breaks application messages into segmentsβsmaller, manageable units of data. On the receiving side, the transport layer reassembles segments into messages and passes them to the application layer.
The Internet transport layer offers two options:
- Transmission Control Protocol (TCP) β provides reliable delivery
- User Datagram Protocol (UDP) β provides unreliable delivery
The minimal transport-layer services are:
- Process-to-process data delivery
- Error checking (error detection)
π Formula: Segmentation β [Application message] β [Multiple segments (TCP)] β [Reassembly] β [Original message] π‘ Why this matters: Segmentation allows efficient transmission of large messages across networks with limited packet sizes and enables error recovery by retransmitting only damaged segments rather than the entire message.
TCPβs Encapsulation
Consider this example: Keith's browser requests a home page. The browser does not actually send the request over the network directly. Instead, it asks the TCP software on Keith's computer to send it. This process is called encapsulationβthe application data is wrapped inside TCP segments before being passed to lower layers for transmission.
π Example: Browser Request Encapsulation
- Context: Keith uses a web browser to request a home page from a web server
- What happens: The browser (application layer) creates an HTTP request message
- Action: Instead of sending the request directly, the browser asks TCP (transport layer) to handle the transmission
- Process: TCP encapsulates the HTTP request by adding its own header, creating a TCP segment
- Result: The segment is then passed to the network layer for further processing and delivery
β Key Takeaways
For the exam, remember that transport layer protocols are part of the operating system and provide logical communication between application processes on different hosts. The transport layer's critical functions are breaking application messages into segments on the sending side and reassembling them on the receiving side. TCP provides reliable delivery while UDP is unreliable, and both offer minimal services of process-to-process data delivery and error checking. Understand the concept of encapsulationβwhen an application like a browser wants to send data, it asks TCP to handle the transmission, and TCP wraps the application data into segments with headers. Finally, remember that transport layer protocols exist in end systems (hosts), not in intermediate network devices.
π§ Quick Revision Questions
- What are the two transport layer protocol options for the Internet, and how do they differ in terms of reliability?
- What are the two minimal transport-layer services that both TCP and UDP provide?
- Explain the process of segmentation: what happens on the sending side and the receiving side?
- Where do transport layer protocols typically reside in a computer system?
- In the encapsulation example with Keith's browser, what happens to the HTTP request message before it is sent over the network?
π Lecture 34 β TCP Flow and Congestion Control
π Overview: This lecture explains the two critical mechanisms TCP uses to prevent data loss and ensure efficient network communication. Flow control prevents the sender from overwhelming the receiver's buffer, while congestion control prevents the sender from overwhelming the network. Both are essential for reliable and fair data transmission in the Internet.
ποΈ Topics Covered
This topic describes the TCP flow and congestion control mechanisms. It begins by explaining the receive buffer and the need for flow control, then details how the receive window operates. The lecture then transitions to congestion, defining what it is and its consequences, before explaining the principles of TCP congestion control and how the sender adjusts its rate based on perceived network conditions.
π Lecture Summary
TCP Flow Control
Flow control is TCP's speed-matching service. It matches the rate at which the sender is sending against the rate at which the receiving application is reading. Hosts on each side of a TCP connection set aside a receive buffer for the connection. When the TCP connection receives bytes that are correct and in sequence, it places the data in the receive buffer. The associated application process will read the data from this buffer, but not necessarily at the instant the data arrives. If the application is relatively slow at reading the data, the sender can very easily overflow the connection's receive buffer by sending too much data too quickly.
π‘ Why this matters: Without flow control, a fast sender could easily corrupt or crash a slow receiver by overflowing its buffer, leading to lost data and failed connections.
π Definition β Receive Window (rwnd): A variable maintained by the sending side of TCP that gives the sender an idea about the free buffer space at the receiver. It is used to prevent the sender from overflowing the receiver's buffer.
π Flow Control Mechanism: The receiver advertises the spare room available in its receive buffer in the Receive Window field of every segment it sends to the sender.
π Example: If a receiver has a receive buffer of 5000 bytes and the application has already read 2000 bytes, but 1000 new bytes have arrived in sequence, the free space is 2000 bytes. The receiver will set the Receive Window field in its next segment to 2000, telling the sender it can send no more than 2000 bytes before waiting for more space to free up.
TCP Congestion Control
Congestion means too many sources sending too much data too fast for the network to handle. This can result in lost packets (buffer overflow at routers) and long delays (queuing in router buffers). Each TCP sender limits the rate at which it sends traffic as a function of perceived congestion. In case the network is congestion-free, upon the arrival of ACKs, the TCP sender indicates a congestion-free source-to-destination path.
π Definition β Congestion: A state where too many sources are sending too much data too fast for the network to handle, leading to packet loss and increased delays.
π Congestion Indication: The occurrence of either a timeout or the receipt of three duplicate ACKs from the receiver indicates congestion.
π Example: If a sender has a sending rate of 100 packets per second and a timeout occurs (the ACK for a packet is not received in time), the sender interprets this as a sign of congestion. To alleviate the congestion, it will drastically reduce its send rate, for example, by dropping the rate down to 10 packets per second. It will then gradually increase the rate until another congestion signal is detected.
π‘ Why this matters: Without congestion control, the Internet could experience "congestion collapse," where almost all packets are lost due to router buffer overflow, making the network practically unusable for everyone.
β Key Takeaways
The most critical concept is the clear distinction between flow control and congestion control: flow control prevents the sender from overwhelming the receiver, while congestion control prevents the sender from overwhelming the network. The receive window is the primary tool for flow control, advertised in every TCP segment. Congestion is detected via timeouts or three duplicate ACKs. The sender's response to these signals is to increase its send rate when the path is clear and decrease it when congestion is detected. Understanding these mechanisms is essential for grasping how TCP ensures reliable and efficient data delivery across the Internet.
π§ Quick Revision Questions
- What is the primary purpose of TCP flow control, and which variable is used to implement it?
- What two specific events does a TCP sender interpret as signals of network congestion?
- How does the receiver tell the sender how much more data it can safely send?
- What are the two main negative consequences of network congestion mentioned in the lecture?
- According to the principles of TCP congestion control, what action does a sender take when it perceives the network path is congestion-free?
π Lecture 35 β User Datagram Protocol (UDP)
π Overview: This lecture introduces the User Datagram Protocol (UDP), an unreliable transport-layer protocol in the Internet transport layer. It contrasts UDP with TCP and uses a household analogy to explain its role in providing logical communication between processes. The lecture explains why UDP exists despite its lack of reliability, focusing on its simplicity and suitability for real-time applications.
ποΈ Topics Covered
The lecture begins with a household analogy comparing transport-layer protocols to mail handlers Hassan and Umer (reliable TCP) versus Fahad and Ahmed (unreliable UDP). It then describes UDP's "best effort" service model, where segments may be lost or delivered out of order, with no connection between sender and receiver. Finally, the lecture explains the reasons for using UDP, including no connection establishment delay, no connection state, no congestion control, and suitability for real-time applications like online streaming video.
π Lecture Summary
Topic 35: User Datagram Protocol (UDP)
This topic describes the User Datagram Protocol (UDP). The Internet Transport Layer can either use Transmission Control Protocol (TCP) or User Datagram Protocol (UDP). TCP is a reliable service while UDP provides unreliable delivery.
π Definition β UDP (User Datagram Protocol): An unreliable, connectionless transport-layer protocol that provides "best effort" delivery of segments between processes running on different hosts.
Household Analogy: Consider two houses, one in Lahore and other in Islamabad. Each house is a home to a dozen kids. The kids are cousins and each kid writes a letter to each cousin every week (144 letters in total). Each letter is delivered by traditional postal service in a separate envelope. In each house, one kid is responsible for mail collection and mail distribution. Hassan does this job in Lahore while Umer does it in Islamabad. Each week Hassan collects the mail and gives it to the postal service mail carrier. He also distributes the received mail. Umer performs a similar job in Islamabad. The postal service provides logical communication between the two houses and not from person to person.
Hassan and Umer provide logical communication among the cousins. Application messages are like letters in envelopes. Processes resemble cousins. Hosts (also called end systems) are same as houses. The job of the transport-layer protocol is the same as that of Hassan and Umer. The network-layer protocol is like the postal service.
Assume Hassan and Umer go on vacation, and another cousin pair β say Fahad and Ahmed replace them. Being younger, they pick up and drop off the mail less frequently and occasionally lose letters. They do not provide the same set of services as Hassan and Umer. Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) offer different service models to applications.
π Definition β Best effort service: A service model where the protocol makes its best attempt to deliver segments but provides no guarantees β segments may be lost, duplicated, or delivered out of order.
In contrast to TCP: UDP provides "best effort" service. Segments may be lost, delivered out of order to application. There is no connection between UDP sender and receiver. Each UDP segment is handled independently of others. UDP does not support error recovery, congestion control, and flow control.
Why is there a UDP?
No connection establishment (which can add delay) is required by UDP. No connection state at sender and receiver, thus making it simpler. As no congestion control is supported, UDP can blast away as fast as desired. UDP is more suitable for real-time apps (online streaming video).
π‘ Why this matters: While UDP seems inferior to TCP due to its lack of reliability, its minimal overhead and lack of connection establishment make it essential for applications where speed matters more than perfect delivery, such as live video streaming, online gaming, and VoIP calls.
β Key Takeaways
UDP provides unreliable, connectionless "best effort" service β segments may be lost or arrive out of order, and no connection is established between sender and receiver. Unlike TCP, UDP does not support error recovery, congestion control, or flow control, making it simpler and faster. The key advantage of UDP is no connection establishment delay, no connection state maintenance, and the ability to send data as fast as desired. These properties make UDP particularly suitable for real-time applications like online streaming video where occasional packet loss is acceptable but delay is not. The household analogy clarifies that transport-layer protocols (like Hassan/Umer or Fahad/Ahmed) provide logical communication between processes on different hosts, just as the postal service provides logical communication between houses.
π§ Quick Revision Questions
- What are the main differences between the service models offered by TCP and UDP?
- In the household analogy, what do the following represent: houses, cousins, letters, and the postal service?
- List three services that UDP does NOT provide that TCP does.
- Why is UDP more suitable than TCP for real-time applications like online video streaming?
- What does "best effort" service mean in the context of UDP, and what are the potential consequences for segment delivery?
π Lecture 36 β TCP Ports Numbers
π Overview: This lecture explains how TCP port numbers enable the correct delivery of data to the right application on a receiving computer. Understanding port numbers is essential for grasping how multiple network applications (browsers, email, FTP) can simultaneously operate on a single device.
ποΈ Topics Covered
The lecture covers the concept of TCP port numbers as identifiers for application programs, the TCP header structure showing the destination port field, the range of port numbers (0-65,535) with well-known ports (0-1023) for standard applications like web servers (port 80), and dynamically assigned port numbers for client-side applications.
π Lecture Summary
The Problem of Multiple Applications
Imagine Keith has two browsers open (one for http://www.fredsco.com and one for http://www.espn.com), plus an email client and an FTP client downloading files. When a new TCP segment arrives at Keith's computer, it reaches the correct computer but could contain data for any of these applications. The question is: which application should receive the data? This is depicted in Figure 36.1.
π‘ Why this matters: Without a mechanism to identify the target application, network data would be delivered to the wrong program, making multitasking across network applications impossible.
The TCP Header and Port Numbers
The TCP header contains a field called the TCP destination port that tells the receiving computer which application program needs to receive the data. As shown in Figure 36.2, the TCP header includes this destination port field.
π Definition β TCP Port Number: A unique number assigned to each application program currently running on a computer, enabling the transport layer to deliver incoming data to the correct application.
π Example: When Keith's computer receives a TCP segment for his ESPN browser, the destination port number in the TCP header directs the data specifically to that browser, not to the other browser, email client, or FTP client.
Port Number Ranges and Assignment
Port numbers range from 0 to 65,535 because the port number field is 16 bits (2^16 = 65,536 possible values). Well-known port numbers range from 0 to 1023 and are used by standard applications. For example, a web server uses port number 80. The complete list of well-known port numbers is available at www.iana.org.
π Formula: Port number range = 0 to 65,535 (16-bit field) β Well-known ports = 0 to 1023
π Definition β Well-known Port Numbers: Ports 0β1023 reserved for standard, widely-used applications (e.g., HTTP uses port 80).
Dynamically Assigned Port Numbers
For client-side applications, the transport layer automatically assigns a port number dynamically (as shown in Figure 36.4). This means the client does not need to manually specify a port; the system handles it.
π Definition β Dynamically Assigned Port Number: A port number automatically assigned by the transport layer to a client application, typically from the range above 1023.
β Key Takeaways
TCP port numbers are critical for directing incoming data to the correct application on a receiving computer, solving the problem of multiple concurrent network applications. The TCP destination port field in the TCP header carries this identifier. Port numbers range from 0 to 65,535 (16 bits), with well-known ports (0β1023) reserved for standard applications like web servers (port 80). Client-side applications typically receive dynamically assigned port numbers from the transport layer automatically.
π§ Quick Revision Questions
- What is the purpose of the TCP destination port field in the TCP header?
- What is the range of possible TCP port numbers, and why is that the range?
- What are well-known port numbers, and what range do they occupy?
- Give an example of a well-known port number and the application it corresponds to.
- Who assigns port numbers to client-side applications, and how are they assigned?
π Lecture 37 β TCP Segmentation
π Overview: This lecture explains how TCP handles data from application layer protocols by breaking it into appropriately sized segments for transmission. Understanding TCP segmentation is essential for grasping how data flows reliably across networks and how protocols like HTTP interact with transport layer services.
ποΈ Topics Covered
The lecture covers the preparatory steps before data exchange via TCP's three-way handshaking, followed by a detailed explanation of TCP segmentation. It describes how TCP receives data from application protocols, the concept of Maximum Segment Size (MSS), and the process of breaking application data into manageable segments. The topic concludes with a practical example illustrating segmentation with a web server request.
π Lecture Summary
Before Data Exchange: Three-Way Handshaking
Before useful data can be exchanged between a client and a server, a TCP connection is established with a three-way handshaking phenomenon. Both endpoints agree to communicate with each other. Also, port numbers the client and server use, what values to start with in the sequence number field, and other details are exchanged with each other.
π Definition β TCP connection: A reliable, connection-oriented communication channel established between two endpoints before data transfer begins. π Definition β Three-way handshaking: The process by which TCP establishes a connection, involving three message exchanges where both sides agree to communicate and exchange initial parameters. π Process: [Client sends SYN β Server responds with SYN-ACK β Client sends ACK] β Both endpoints agree to communicate, exchange port numbers, and agree on initial sequence number values.
TCP Segmentation
When a TCP/IP application such as email or web client has data to send, it gives it to transport layer protocol. The application layer protocol does not have a limit to the size of bytes it chooses to send. However, TCP segments data received from the applications to ensure that a TCP segment will fit into a single link-layer frame. The maximum amount of application-layer data that TCP can grab and place in a segment is called Maximum Segment Size (MSS). 1480 is a typical value for MSS. The process of breaking the application data into parts is called segmentation. The bytes that include the data and the TCP header are called TCP segments.
π Definition β Maximum Segment Size (MSS): The maximum amount of application-layer data that TCP can grab and place in a single TCP segment, typically 1480 bytes. π Definition β Segmentation: The process of breaking application data into appropriately sized parts to fit into a single link-layer frame. π Definition β TCP segments: The bytes that include both the application data and the TCP header.
π Example:
- A client contacts a web server
- The home page has 3000 bytes of data
- HTTP gives all 3000 bytes to TCP
- MSS of TCP is 1480
- TCP puts 1460 bytes into data part of a segment
- π‘ Why this matters: The first segment carries 1460 bytes of data (leaving 1540 bytes remaining), demonstrating how TCP must create multiple segments from a single application data chunk to ensure proper transmission across the network.
β Key Takeaways
Students must understand that TCP segmentation is a critical function ensuring application data fits into link-layer frames. The Maximum Segment Size (MSS) of 1480 bytes (with 1460 bytes of data) is a standard value. The three-way handshaking establishes the connection before any data exchange occurs, exchanging port numbers and initial sequence numbers. Segmentation is necessary because application protocols have no size limit for data they send. The TCP header plus application data together form what is called a TCP segment.
π§ Quick Revision Questions
- What is the purpose of the three-way handshaking in TCP?
- What does MSS stand for and what is its typical value?
- How many bytes of application data from a 3000-byte HTTP response will be placed in the first TCP segment when MSS is 1480?
- Why does TCP need to segment data received from application layer protocols?
- What information is exchanged between endpoints during TCP handshaking besides agreeing to communicate?
π Lecture 38 β Basics of Internet Protocol (IP)
π Overview: This lecture introduces the fundamentals of the Internet Protocol (IP) and its role in network communication. It explains how routers forward data across networks from source to destination, and distinguishes between the two key functions of forwarding and routing. Understanding IP basics is essential for grasping how data travels across the global Internet.
ποΈ Topics Covered
This lecture covers the basics of Internet Protocol (IP), the role of routers as networking devices connecting multiple physical networks, the concept of routing as the complete process of sending data through routers to its destination, and the two key functions of forwarding (moving packets from input to output) and routing (determining the path from source to destination). Examples include Hannah accessing a web page from a server at cisco.com.
π Lecture Summary
Topic 38: Basics of Internet Protocol (IP)
In a typical large network, many routers and LAN switches sit between a client PC and a server. Routers are networking devices that connect to multiple physical networks, such as multiple Ethernets. They make decisions about where to forward the data so that it reaches the correct destination.
π Definition β Router: A networking device that connects to multiple physical networks and makes decisions about where to forward data so that it reaches the correct destination.
π Example: Hannah on a LAN in Mason wants to get a web page from a web server http://www.cisco.com on a LAN in Cincinnati. This involves the data passing through routers between the two LANs.
Routing is the complete process by which a computer sends the data, passing through all the routers and eventually arriving at the destination. The example shows only LANs, but the routers could also be connected to a wide-area network (WAN).
π Definition β Routing: The complete process by which a computer sends data, passing through all the routers and eventually arriving at the destination.
Two Key functions
Forwarding is moving a packet from router's input to appropriate router output. Routing is the determination of the route taken by packets from source to destination. These are two distinct but related functions in network communication.
π Definition β Forwarding: Moving a packet from a router's input to the appropriate router output.
π Definition β Routing: The determination of the route taken by packets from source to destination.
π‘ Why this matters: Forwarding is the local action of moving a packet through a single router, while routing is the global process of determining the entire path across multiple routers. Both are essential for end-to-end data delivery.
β Key Takeaways
The Internet Protocol (IP) is the foundation of network communication, with routers serving as the key devices that connect multiple physical networks and forward data toward its destination. Routing is the complete end-to-end process of sending data from source to destination through multiple routers, which may be connected via LANs or WANs. The two critical functions of routers are forwarding (moving packets from input to appropriate output on a single router) and routing (determining the entire path across the network). These functions work together to ensure data reaches the correct destination across the Internet.
π§ Quick Revision Questions
- What is a router and what is its primary function in a network?
- Define routing in the context of computer networks.
- What is the difference between forwarding and routing?
- In the example given, what path does data take from Hannah's PC in Mason to the cisco.com web server in Cincinnati?
- Can routers be connected to wide-area networks (WANs) in addition to LANs?
π Lecture 39 β Working of IP and IP addresses
π Overview: This lecture explains how the Internet Protocol (IP) operates at the network layer of the TCP/IP model, focusing on IP addressing, forwarding, and routing. Understanding IP addresses is fundamental to how devices communicate over the internet, making this lecture essential for grasping network layer functionality.
ποΈ Topics Covered
The lecture covers IP as the network layer protocol of TCP/IP, the unreliable best-effort nature of IP delivery, IP address structure as 32-bit binary numbers divided into octets, the requirement for unique IP addresses per network interface, the 20-byte IP header format with source and destination address fields, and how sender and receiver IP addresses are used in packet transmission.
π Lecture Summary
Working of IP and IP addresses
Internet Protocol (IP) is the network layer protocol of the TCP/IP model. IP defines addressing, forwarding and routing. IP provides logical communication between hosts and makes its best effort to deliver segments between communicating hosts, but makes no guarantees. IP is said to be an unreliable service.
The addressing details recommended by IP facilitate easy and efficient forwarding of IP packets. IP addresses are 32-bit binary numbers. Each of the decimal numbers in an IP address is called an octet, with a range falling in [0-255]. 2Β³Β² is equal to 4 billion possible IP addresses.
Everyone should have a unique IP address to avoid confusion when trying to deliver data to that address. Each network interface on a computer needs an IP address. A network interface is simply a card that has a physical connector for some type of network. An Ethernet NIC is one such example. The NIC takes care of TCP/IP network interface layer details, which are the equivalent of OSI Layers 1 and 2.
Most end-user computers, also known as TCP/IP hosts, have a single network interface. Devices that have more than one network interface have more than one IP address. Routers are such devices. IP defines a 20-byte long header, which includes a 4-byte source IP address and a 4-byte destination IP address. An IP packet includes the IP header, along with any data that follows the IP header.
To send data from one computer to another, a sender puts the destination computer's IP address into the destination IP address field and puts its own IP address in the source IP address field.
π Definition β Octet: One of the decimal numbers in an IP address, ranging from 0 to 255. π Definition β Network Interface: A card that has a physical connector for some type of network, such as an Ethernet NIC. π Definition β TCP/IP Host: An end-user computer typically having a single network interface. π Formula: IP address size = 32 bits = 4 bytes for source + 4 bytes for destination β This means there are 2Β³Β² β 4 billion possible unique IP addresses. π Example: When Computer A wants to send data to Computer B, Computer A puts Computer B's IP address in the destination IP address field and its own IP address in the source IP address field of the 20-byte IP header.
π‘ Why this matters: The distinction between source and destination IP addresses in the header allows routers to forward packets toward their destination while enabling the receiving host to know where replies should be sent.
β Key Takeaways
IP is an unreliable, best-effort network layer protocol that provides logical communication between hosts without guarantees. IP addresses are 32-bit binary numbers written as four decimal octets (0-255), allowing approximately 4 billion unique addresses. Each network interface requires a unique IP address, meaning routers have multiple IP addresses while typical hosts have one. The IP header is 20 bytes long and contains both source and destination IP addresses (4 bytes each), which the sender must populate correctly for packet delivery.
π§ Quick Revision Questions
- What are the three main functions defined by the Internet Protocol?
- How many bits are in an IP address, and how many possible IP addresses does this provide?
- Why must each network interface have a unique IP address?
- How long is the IP header, and how many bytes are allocated for source and destination IP addresses?
- What type of device requires more than one IP address, and why?
π Lecture 40 β How to run an IP Network?
π Overview: This lecture explains how an IP network operates by drawing an analogy with the postal service. It covers the structure of IP addresses, how they are grouped for efficient routing, and how routers use address prefixes to forward packets without needing to know every individual IP address.
ποΈ Topics Covered
The lecture begins by explaining how an application layer request (HTTP GET) is encapsulated by TCP and then IP to create packets for network delivery. It then introduces the concept of IP addresses using a postal service analogy, where the common portion of an IP address functions like a postal code. The key insight is that all devices on the same physical network share a portion of their IP addresses, which allows routers to make forwarding decisions based on address prefixes rather than individual addresses, dramatically simplifying routing logic.
π Lecture Summary
Topic 40: How to run an IP Network?
This topic explains how an IP network runs.
The postal service provides a wonderful service. You put a letter into the mailbox, and it magically appears at the right address. By sending an IP packet into the network, the networking devices should collectively be able to forward the packet to the right destination. An example of an IP address is 1.1.1.1. There are 4 decimal numbers, between 0 and 255 inclusive, separated by periods. The structure and meaning of IP addresses tell us how IP addresses are used in an internetwork.
To understand the concepts, letβs take postal service as a reference. In addition to the number, street, town, and state, the postal service uses postal codes to make it easy to sort the mail. Everyone in the same general geographical area such as a town has the same postal code. The only time the whole postal address is needed is when the letter gets to the final post office; the one that handles mail for that postal code.
π Definition β IP Address: An IP address is a 32-bit number typically written as four decimal numbers (each between 0 and 255) separated by periods, like 1.1.1.1. It identifies a device's location in an internetwork.
π Formula: [Network Portion].[Host Portion] β The IP address is divided into a common prefix (network portion, like a postal code) and a unique suffix (host portion, like a street address).
π Example: IP address 1.1.1.1 is broken into four octets: 1, 1, 1, 1. All devices on the same Ethernet LAN might share the first octet 1 as their common portion, similar to sharing a ZIP code.
π‘ Why this matters: Just as the postal system sorts mail by postal codes to avoid looking up every street address, IP networks use the common portion of addresses to route packets efficiently without examining every individual host.
IP address grouping makes routing easy
All IP addresses on the same physical network such as one Ethernet LAN have a portion of their IP addresses in common. This common portion works like a postal code. Like postal codes, all the IP addresses on the same Ethernet are in the same general area, so routing can take advantage of that fact.
IP address grouping makes routing easy. Letβs imagine the logic needed by R1:
- Packets whose destination begins with
1should be forwarded to the left. - Packets whose destination begins with
2should be forwarded to the Ethernet on the right. - Packets whose destination begins with
3should be forwarded to R2 so that R2 can forward the packet.
The routers do not have to know about every IP address in the entire internetwork. They only need to know which direction to send packets based on the common prefix of the destination address.
π Definition β Router: A networking device that forwards IP packets between networks based on the destination IP address's network portion (prefix).
π Definition β Routing: The process of forwarding packets from one network to another based on the destination address's common prefix, much like postal sorting by ZIP code.
π Example: Router R1 sees a packet destined for 2.2.2.2. Since the destination begins with 2, R1 forwards it to the Ethernet on the right. R1 does not need to know that host 2.2.2.2 exists β it just knows all 2.x.x.x addresses are on that Ethernet.
π‘ Why this matters: This hierarchical grouping is what makes the Internet scalable. Without it, every router would need a list of billions of individual IP addresses; with it, routers only store routing table entries for network prefixes.
β Key Takeaways
The critical concept from this lecture is that IP addresses are structured with a common network portion that works like a postal code, allowing routers to forward packets based on prefixes rather than individual addresses. Just as the postal service uses ZIP codes to sort mail efficiently without reading every street address, IP networks use the shared portion of addresses on the same physical network to simplify routing. Routers only need to know which direction to send packets based on these prefixes, not every individual IP address. This hierarchical grouping is essential for the scalability of the Internet. The analogy with the postal system helps understand that the full destination address is only needed at the final router, which handles the specific network containing the destination host.
π§ Quick Revision Questions
- What is the postal service analogy for the common portion of IP addresses on the same physical network?
- How many decimal numbers does an IP address contain, and what are their possible range?
- Why do routers not need to know about every individual IP address in the internetwork?
- In the example with router R1, what should R1 do with a packet whose destination begins with
3? - What is the key benefit of IP address grouping for routing in an internetwork?
π Lecture 41 β Classes of IP Networks
π Overview: This lecture explains how IP networks are classified into different sizes (classes) based on their network number. It covers the three main classesβA, B, and Cβand how the network portion and host portion of IP addresses are determined, which is fundamental for understanding IP addressing and routing in internetworks.
ποΈ Topics Covered
The lecture begins by defining an IP network as a group of IP addresses sharing a common beginning (network number). It then introduces three classes of IP networks (A, B, C) that define different network sizes, explains the reserved addresses (network number and broadcast address), and shows how the network and host portions of an address are structured. The example internetwork with two routers and three IP networks (1.0.0.0, 2.0.0.0, 3.0.0.0) illustrates these concepts.
π Lecture Summary
Topic 41: Classes of IP Networks
This topic describes the classes of IP networks. In an internetwork, IP calls a group of IP addresses that share a common beginning part of their addresses an IP network. The common portion is called the network number and is used to represent the network. For an IP network number, the bits other than the common portion have all 0s. In the example internetwork, the network numbers are 1.0.0.0, 2.0.0.0, and 3.0.0.0. A host cannot use a network number as an IP address in the network.
Letβs assume a simple internetwork with two routers and three IP networks. (See Figure 41.1: Classes of IP Networks.)
How many IP addresses can you have in network 1.0.0.0? You can't use 1.0.0.0 and 1.255.255.255 β these are reserved addresses. Valid addresses: more than 16 million addresses. IP defines three sizes of networks as different classes. The three different network classes are called Class A, B, and C. All addresses in the same Class A, B, or C network have the same numeric value for the network portion of the addresses. The rest of the address is called the host portion of the address.
π Definition β IP network: A group of IP addresses that share a common beginning (network number).
π Definition β Network number: The common portion of IP addresses in a network; used to represent the network. For an IP network number, the bits other than the common portion are all 0s.
π Definition β Reserved addresses: In any IP network, the network number itself (all host bits 0) and the broadcast address (all host bits 1) cannot be assigned to hosts.
π Definition β Classes of IP networks: IP defines three network sizes: Class A, Class B, and Class C. The class determines the number of bits used for the network portion and host portion.
π Definition β Network portion: The part of an IP address that is the same for all hosts in the same Class A, B, or C network.
π Definition β Host portion: The remaining part of an IP address after the network portion; it uniquely identifies a host within the network.
π Example: In network 1.0.0.0:
- The network number is 1.0.0.0.
- The broadcast address is 1.255.255.255.
- Both are reserved and cannot be used by hosts.
- Valid host addresses range from 1.0.0.1 through 1.255.255.254, giving more than 16 million possible addresses.
- All addresses in this network share the network portion β1β (first octet), and the remaining three octets form the host portion.
π‘ Why this matters: Understanding network classes is essential for determining how many hosts a network can support and how routers forward packets based on the network portion of an address. It forms the basis for IP subnetting and routing.
β Key Takeaways
The most critical concept from this lecture is that IP networks are grouped by a common network number, and three classes (A, B, C) define different network sizes. The network number and broadcast address are reserved and cannot be assigned to hosts. A hostβs IP address consists of a network portion (same for all hosts in the same class network) and a host portion (unique to each host). The example of network 1.0.0.0 shows that with a single octet for the network portion, over 16 million valid host addresses exist (excluding the two reserved addresses). These classes directly impact how many hosts a network can contain and how routers identify networks.
π§ Quick Revision Questions
- What is an IP network, and what is a network number?
- Which two addresses in an IP network are reserved and cannot be assigned to hosts?
- What are the three classes of IP networks defined by IP?
- In a Class A network like 1.0.0.0, how many valid host addresses are available? Why?
- What is the difference between the network portion and the host portion of an IP address?
π Lecture 42 β IP Subnetting
π Overview: This lecture explains the concept of IP subnetting, a method for subdividing larger IP networks into smaller, more manageable subnetworks. It matters because subnetting allows network engineers to efficiently use IP addresses and control network traffic with routers, preventing address waste on large Class A and B networks.
ποΈ Topics Covered
The lecture covers the problem of unused IP addresses in large Class A and B networks, introduces subnetting as a solution for efficiently segmenting a network, explains how routers separate devices in different subnets, describes how subnet numbers are formed, and discusses the practical benefits of subnetting for network design.
π Lecture Summary
Topic 42: IP Subnetting
In this topic, we explain the use of IP subnetting.
These days, single LANs with more than 1000 devices are extremely rare. Many IP addresses will go unused if you use a Class A or Class B network for the devices on a LAN. Subnetting provides a solution. Letβs assume that a design requires three networks, and uses three different Class B networks. Each Class B network can host 65,534 addresses.
A subnet is just a subdivision of a larger Class A, B, or C network. Subnetting refers to the process whereby the engineer decides to create subnets. Without Subnetting, devices in the same Class A, B, or C network cannot be separated from each other by a router. Also, devices in different Class A, B, or C networks must be separated from each other by a router. With Subnetting, devices in the same subnet cannot be separated from each other by a router. Also, devices in different subnets must be separated from each other by a router. Subnetting allows a network engineer to configure network devices of a class B network for example, 150.1.0.0, such that they can think that the first 3 octets of the addresses identify the network. Following subnets can be created: all addresses that begin with 150.1.1, all addresses that begin with 150.1.2, all addresses that begin with 150.1.3 and so on.
An IP subnet number is used to represent a subnet. The subnet number has the same value in the first part of the number as all the host addresses, and 0s in the last part.
π‘ Why this matters: Subnetting is a fundamental technique for efficient IP address allocation and network segmentation, enabling logical grouping of devices and traffic control with routers.
β Key Takeaways
Subnetting solves the problem of wasted IP addresses by subdividing large Class A, B, or C networks into smaller subnets. Routers can separate devices in different subnets but not devices within the same subnet. A subnet number has the same prefix as its host addresses but ends with all zeros. This technique allows network engineers to create logical groupings, such as all addresses starting with 150.1.1, 150.1.2, etc., within a single Class B network. Without subnetting, devices in the same Class A/B/C network cannot be separated by a router, limiting network design flexibility.
π§ Quick Revision Questions
- What is the main problem that subnetting solves?
- What is the difference between how routers treat devices in the same subnet vs. devices in different subnets?
- How is an IP subnet number constructed?
- Using the example 150.1.0.0, how would you create subnets within this Class B network?
- Why is using multiple Class B networks for a small design considered wasteful without subnetting?