Cover
ابدأ الآن مجانًا eitf45 -L5- network layer IP and routing.pdf
Summary
# The internet and network layer architecture
This section summarizes the fundamental architecture of the internet and the core functions of the network layer, focusing on routing and forwarding.
### 1.1 Internet architecture
The internet is a global network of interconnected computer networks. It is comprised of two main types of networks: access networks, which connect end-users to the internet, and backbone networks, which form the high-speed core of the internet. A crucial element that unites all networks within the internet is the Internet Protocol (IP) [12](#page=12) [4](#page=4).
### 1.2 Network layer protocols
The network layer, often referred to as Layer 3 (L3), is responsible for end-to-end communication between hosts. This is distinct from the data link layer (L2), which operates on a hop-by-hop basis. Routers are the primary devices operating at the network layer and perform two key functions: routing and forwarding [24](#page=24) [6](#page=6) [9](#page=9).
#### 1.2.1 Routers and their functions
Routers are internetworking devices that connect different networks. They handle the process of directing data packets across these networks [24](#page=24) [9](#page=9).
##### 1.2.1.1 Routing
Routing is the process of selecting the optimal path for data packets to travel from their source to their destination. This involves using a cost metric to evaluate different paths and sharing information about network topology. Routing algorithms define the rules and procedures for how this information is exchanged and how paths are determined. Routing can be managed in a central or distributed manner [10](#page=10) [24](#page=24) [9](#page=9).
##### 1.2.1.2 Forwarding
Forwarding, in contrast to routing, is the actual act of moving a packet from an incoming link to an outgoing link on a router. This is a much faster, per-packet operation. One important aspect of forwarding is address aggregation, which helps in efficient routing [11](#page=11) [24](#page=24) [25](#page=25) [9](#page=9).
### 1.3 Internet Protocol (IP)
The Internet Protocol (IP) is the foundational protocol of the internet. It defines how data is addressed and formatted into packets for transmission across the network. IP handles network addresses and is essential for enabling host-to-host delivery, even when multiple applications are running on the same host. The network layer protocol is responsible for ensuring that packets reach their intended destination across potentially diverse underlying network technologies [12](#page=12) [41](#page=41) [5](#page=5) [8](#page=8).
### 1.4 Summary of Network Layer [1](#page=1).
Key takeaways from this section include understanding the internet's architecture with its backbone and access networks, the role of routers in routing and forwarding, and the significance of the Internet Protocol (IP) for addressing and packet formats. The distinction between Layer 2 (hop-by-hop) and Layer 3 (end-to-end) is also crucial [41](#page=41) [6](#page=6).
> **Tip:** Remember that routing is the decision-making process of finding the best path, while forwarding is the action of sending the packet along that path. These are distinct but complementary functions of routers.
> **Tip:** The end-to-end principle is a key design philosophy of the internet, where complex functionalities are placed at the endpoints (hosts) rather than in the network core (routers) [41](#page=41).
> **Example:** Imagine sending a letter. Routing is like deciding which postal service and which route to use to get the letter to the destination city. Forwarding is like the mail carrier actually putting the letter into the correct truck or sorting bin to move it along that chosen route.
---
# Internet protocols and addressing
This section explores the Internet Protocol (IP) within networking models, focusing on IPv4 and IPv6 addressing, including classful and classless schemes, subnetting, and CIDR notation [41](#page=41).
### 2.1 The Internet Protocol (IP)
The Internet Protocol (IP) is a fundamental component of the TCP/IP model and operates at the network layer, comparable to Layer 3 of the OSI model. Its core functions include addressing, packet formatting, and managing internetworking [13](#page=13) [14](#page=14) [41](#page=41).
### 2.2 IPv4 addressing
IPv4 addresses are 32 bits long, equivalent to 4 bytes, providing a total of $2^{32}$ or 4,294,967,296 unique addresses. IPv4 addressing schemes have evolved from classful to classless addressing to manage the growing number of connected devices [17](#page=17) [19](#page=19).
#### 2.2.1 Classful addressing
In the early days of the internet, classful addressing was used, defining five address classes (A, B, C, D, and E). This system allowed addresses to be obtained only in predefined blocks, which proved insufficient as the internet grew [18](#page=18) [19](#page=19).
#### 2.2.2 Subnetting and supernetting
To address the limitations of classful addressing and the depletion of available addresses, subnetting and supernetting were introduced. Subnetting involves dividing larger address blocks (like Class A and B) into smaller subnets, while supernetting combines several smaller blocks (like Class C) into larger blocks [19](#page=19).
#### 2.2.3 Classless addressing (CIDR)
Classless addressing, also known as Classless Inter-Domain Routing (CIDR), emerged as a more flexible approach. In this scheme, IP addresses are allocated in blocks where the block size is a power of 2. A block is defined by its first address, which must be divisible by the block size ($N$), where $N = 2^{32-n}$, and '$n$' represents the number of bits in the network ID [21](#page=21).
> **Tip:** CIDR uses slash notation (e.g., /n) to represent the number of bits used for the network identifier, making it easier to denote the network and host portions of an address.
##### 2.2.3.1 CIDR notation and examples
CIDR notation is commonly represented as an IP address followed by a slash and the number of network bits, such as `205.16.37.39/28`. This notation replaces the need for fixed class boundaries [23](#page=23).
An example of IPv4 address decomposition using CIDR is as follows:
- **Address:** `11011110 00010111 01000011 01000100`
- **Mask:** `11111111 11111111 11000000 00000000`
- **Net-id:** `11011110 00010111 01000000 00000000`
- **Host-id:** `00000000 00000000 00000011 01000100`
In dotted-decimal notation, this translates to:
- **Address:** `222.23.67.68`
- **Mask:** `255.255.192.0`
- **Net-id:** `222.23.64.0`
- **Host-id:** `0.0.3.68`
With a CIDR notation of `/18` (indicating 18 network bits), the block size is $2^{32-18} = 2^{14} = 16,384$. The end of this block would be `222.23.127.255` [22](#page=22).
### 2.3 Problems with IPv4
Despite its widespread use, IPv4 faces significant challenges, including an insufficient address space, lack of inherent design for real-time applications, and no built-in support for encryption and authentication [28](#page=28).
### 2.4 IPv6 addressing
IPv6 was developed to overcome the limitations of IPv4, primarily addressing the critical issue of insufficient address space [29](#page=29).
#### 2.4.1 Advantages of IPv6
IPv6 offers several key advantages:
- **Larger address space:** IPv6 uses 128-bit addresses, providing a vastly expanded range of over $3 \times 10^{38}$ unique addresses ($2^{128}$) compared to IPv4's $4 \times 10^9$ addresses. This massive increase ensures long-term scalability [29](#page=29) [30](#page=30) [31](#page=31).
- **Improved header format:** The IPv6 base header has a constant length of 40 bytes, making packet processing more efficient. Optional fields can be added as needed, enhancing extensibility [29](#page=29).
- **Enhanced security:** IPv6 includes support for encryption and authentication options, addressing the security deficiencies of IPv4 [29](#page=29).
- **Support for real-time applications:** IPv6 provides mechanisms for special handling of datagrams, which can be requested to better support real-time applications [29](#page=29).
#### 2.4.2 IPv6 address structure and notation
IPv6 addresses are 128 bits long and are typically represented in hexadecimal notation, grouped into eight 16-bit blocks separated by colons. For example, a global unicast address is structured to identify individual computers uniquely and includes fields for type, area, ISP, and organization [30](#page=30) [32](#page=32).
> **Tip:** IPv6 addresses can be shortened by omitting leading zeros in each 16-bit block and by replacing consecutive blocks of zeros with a double colon (`::`), but this double colon can only be used once in an address.
---
# IPv4 and IPv6 packet structures and features
This topic delves into the intricate structures of IPv4 and IPv6 packets, comparing their header fields and exploring key features like fragmentation handling and the advanced capabilities of IPv6.
### 3.1 Internet Protocol (IP) packet structures
Internetworking relies on the Internet Protocol (IP) for addressing and defining packet formats, facilitating communication between diverse networks. IP operates at Layer 3 of the network model, encapsulating data from higher layers for transmission across networks [37](#page=37) [41](#page=41).
### 3.2 IPv4 packet structure
An IPv4 packet consists of a header followed by the data payload. The IPv4 header contains essential control information, including source and destination IP addresses, and fields that govern packet processing and routing [27](#page=27).
### 3.3 IPv6 packet structure and features
IPv6 introduces significant improvements over IPv4, notably a larger address space and a more efficient header format. The IPv6 base header is simpler, designed to be flexible and accommodate extensions through optional IPv6 extension headers [33](#page=33) [34](#page=34).
#### 3.3.1 IPv6 extension headers
Extension headers in IPv6 provide a mechanism for adding optional functionality without cluttering the base header. This design enhances flexibility and allows for the incorporation of advanced features [34](#page=34).
#### 3.3.2 Quality of Service (QoS) features in IPv6
IPv6 incorporates features to support Quality of Service (QoS) more effectively than IPv4. Two key fields for QoS are the Traffic Class and Flow Label [35](#page=35).
##### 3.3.2.1 Traffic Class field
The Traffic Class field is used for classifying packets, enabling different queueing schemes and influencing delay characteristics. This field is particularly relevant for differentiating between congestion-controlled protocols (like TCP) and non-congestion-controlled protocols (like UDP), as well as other protocols like RTP and RSVP [35](#page=35).
##### 3.3.2.2 Flow Label field
The Flow Label field is designed to identify a specific stream of packets, such as TCP sessions or virtual connections. Devices can use this label to look up forwarding or routing information in a flow label table, potentially reducing the need to run complex routing algorithms for every single packet within that flow [35](#page=35).
### 3.4 Fragmentation handling
Fragmentation is the process of dividing a large IP packet into smaller pieces when the packet size exceeds the Maximum Transmission Unit (MTU) of a network link [36](#page=36) [37](#page=37).
#### 3.4.1 IPv4 fragmentation
In IPv4, fragmentation can be performed by any router that encounters a packet too large for the next hop's MTU. The fragmented packet's header includes fields that help reassemble the original packet at the destination [36](#page=36) [38](#page=38).
#### 3.4.2 IPv6 fragmentation
IPv6 handles fragmentation differently: it is performed exclusively by the source node, not by intermediate routers. This design choice simplifies router processing. Defragmentation, however, is still the responsibility of the destination host [36](#page=36).
##### 3.4.2.1 Fragmentation offset in IPv6
The fragmentation offset is a crucial field within an IPv6 fragment header, indicating the relative position of the fragment within the reassembled original packet. The IPv6 header uses 13 bits for the fragmentation offset, which is less than the 16 bits in IPv4, implying a granularity of /8 bytes for offsets [39](#page=39).
> **Tip:** Understanding how fragmentation differs between IPv4 and IPv6 is vital for grasping the evolution of network efficiency and router workload. IPv6's approach offloads this task from routers to the end hosts.
> **Example:** Imagine a large video stream being sent over the internet. If the packet size exceeds the MTU of a particular link, IPv4 routers might break it down. In IPv6, if the source node initiates the transmission of a packet larger than the MTU, the source itself would create the necessary fragments before sending them out. The destination host would then receive these fragments and piece them back together using information like the fragmentation offset [36](#page=36) [39](#page=39).
---
## Common mistakes to avoid
- Review all topics thoroughly before exams
- Pay attention to formulas and key definitions
- Practice with examples provided in each section
- Don't memorize without understanding the underlying concepts
Glossary
| Term | Definition |
|------|------------|
| Network Layer | The third layer in the OSI model and part of the Internet layer in the TCP/IP model, responsible for logical addressing and routing of data packets between networks. It operates on an end-to-end basis. |
| Router | An internetworking device that operates at the network layer. Its primary functions are routing (determining the best path for data packets) and forwarding (moving packets from an input interface to an output interface based on routing information). |
| Forwarding | The process by which a router moves a packet from an input link to an output link. This is typically done using a forwarding table that maps destination addresses to output links. |
| Routing | The process of selecting paths in a network along which to send network traffic. Routing algorithms determine the optimal path by using cost metrics and sharing information, often in a distributed manner. |
| IP (Internet Protocol) | A network layer protocol that provides logical addressing and packet routing across networks. It is the primary protocol of the Internet and is used in both IPv4 and IPv6 versions. |
| IPv4 | The fourth version of the Internet Protocol, using 32-bit addresses. It has been widely used but suffers from address exhaustion and limitations in supporting modern network features. |
| IPv6 | The sixth version of the Internet Protocol, designed to address the limitations of IPv4. It uses 128-bit addresses, offering a vastly larger address space, and includes improvements in header format, security, and Quality of Service (QoS). |
| Addressing Scheme | A system used to assign unique identifiers (addresses) to devices on a network, allowing for data packets to be sent to specific destinations. This includes defining the format, structure, and hierarchy of addresses. |
| Packet Formats | The defined structure of data units transmitted over a network. For the network layer, this refers to the IP packet structure, including header fields and the payload. |
| Classful Addressing | An older IPv4 addressing scheme that divided IP addresses into different classes (A, B, C, D, E) with predefined network and host portions. This system led to inefficient use of address space. |
| Classless Addressing (CIDR) | A method for allocating IP addresses and routing IP packets. CIDR eliminates the traditional classful divisions by using a prefix length (slash notation) to define the network portion of an address, allowing for more flexible and efficient allocation. |
| Subnetting | The process of dividing a larger IP network into smaller, more manageable subnetworks. This improves network organization, reduces traffic, and enhances security. |
| Supernetting | The opposite of subnetting, where multiple smaller network blocks are combined into a single, larger block. This is used for route aggregation to simplify routing tables. |
| Fragmentation | The process of dividing a large IP packet into smaller pieces (fragments) so that it can be transmitted over a network link with a smaller Maximum Transmission Unit (MTU). In IPv4, routers can perform fragmentation; in IPv6, only the source node does. |
| MTU (Maximum Transmission Unit) | The largest packet size, in bytes, that a data link layer protocol can pass on the network layer. If an IP packet exceeds the MTU of a link, it must be fragmented. |
| Flow Label | A field in the IPv6 header used to identify a stream of packets, such as those belonging to a single TCP session or virtual connection. This aids in consistent forwarding and potentially specialized handling by routers. |
| Traffic Class | A field in the IPv6 header that allows for the classification of packets. It can be used to prioritize different types of traffic, influencing queueing schemes and delay characteristics. |