



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A comprehensive overview of the network layer, focusing on its functionality in routing packets between networks. It covers key processes such as addressing, encapsulation, and the routing process, including how routers analyze destination addresses and forward packets. The document also discusses network segmentation, ipv4 characteristics, and the role of routing tables in packet forwarding. It is a valuable resource for understanding network communication and architecture, detailing the interaction between different layers and the importance of dynamic routing protocols. Suitable for students and professionals seeking to deepen their knowledge of network infrastructure and data transmission protocols.
Typology: Summaries
1 / 7
This page cannot be seen from the preview
Don't miss anything!




The network layer is responsible for routing packets from a device on one network to a device on a different network. It converts transport layer segments into packets and guides them across networks to their destination. This process involves dividing networks into groups of hosts to manage data flow and facilitate communication between networks, a process known as routing.
The network layer, also known as OSI Layer 3, provides services for exchanging data between identified end devices. It addresses packets to the proper destination, encapsulates them with necessary delivery data, routes them through connected networks, and ensures the destination host decapsulates the data for processing. The network layer receives data segments from the transport layer and uses protocols to add addressing and other information before sending them to the next router along the best path to the destination network.
IP requires each sending and receiving device to have a unique IP address. The sending host's IP address is the source IP address, and the receiving host's IP address is the destination IP address. Each PDU sent between networks is identified with these addresses in an IP header, which contains address information and identifies the PDU as a network layer PDU. Segments are encapsulated at the network layer to become IP packets.
When a packet is encapsulated at the network layer, it contains all the information needed to travel to networks. Routers connect networks and specialize in understanding OSI Layer 3 packets and protocols, calculating the best path for packets. Routing involves routers receiving packets, analyzing the destination address, selecting a path, and forwarding the packet to the next router. A packet can hop between several routers, each examining the address information without changing it until the packet reaches the destination network. The last router forwards the packet out the correct network interface for final delivery on the local network.
For a network layer packet to travel between hosts, it must be handed down to the data link layer (OSI Layer 2) for framing and then encoded and put onto the physical layer (OSI layer 1) to be sent to the next router.
An IP packet arrives at a router's network interface encapsulated in a Layer 2 frame. The router's NIC accepts the packet, removes the Layer 2 encapsulation, and sends the packet to the network layer. Layers 1 and 2 can be encapsulated and decapsulated multiple times by routers as a packet travels. The network layer only decapsulates the IP packet at the final destination after examining the destination addresses. The IP packet is then discarded, and the information is handed up to the upper layers for delivery and processing.
IP is the most common network layer protocol, but other protocols with different features are available. IPv4 is the most widely used version of IP, providing the functions necessary to deliver a packet from source to destination. It does not track and manage packet flow; these functions are performed by other protocols in other layers.
IPv4 is connectionless, meaning it does not establish a connection before sending data packets. It also provides best-effort (unreliable) service, not guaranteeing packet delivery to reduce processing time and bandwidth. If packets are lost, the receiver communicates with the sender to request a retransmission. The arrangement of bits in the IP packet and header remains unchanged as the packet transfers across different media. The MTU is determined by the OSI data link layer and passed to the network layer.
If a packet encounters a network requiring smaller packets, the router will fragment the packets before forwarding them. The IPv4 packet uses the Fragment Offset field and the MF flag in the IP header to reconstruct the packet at the destination host.
Networks are divided into groups of hosts, similar to how cities are divided into neighborhoods. Large computer networks can be separated into internetworks, historically divided geographically. Now, network members can be grouped by physical or abstract attributes such as purpose and ownership.
network portion of the address. Large networks can be divided into smaller subnets by using some of the host bits for additional network codes, a process called subnetting. Network managers use this flexibility to customize their private networks. In a typical IPv4 address, the three leftmost octets represent the general network address, and the last octet identifies the local host.
Routing and Gateways
Communication within a network or subnet occurs without a network layer device. When a host communicates outside its local network, a router acts as a gateway, selecting a path for the packet. The router interface is a host on the local network, requiring the host IP address and default gateway address to be on the same network. The default gateway is configured on a host, and both the host IPv4 address and the gateway address must share the same network (and subnet, if used) portion of their addresses.
IP Packets and Data Transfer
The network layer's role is to transfer data from the originating host to the destination host. During encapsulation at the source host, an IP packet is created at Layer 3 to carry the Layer 4 PDU. If the destination host is on the same network, the packet is delivered locally without a router. If the hosts are on different networks, the packet may traverse multiple networks and routers. The packet remains largely intact throughout the process. For communication between hosts on different networks, the local network delivers the packet to its gateway router. The router examines the network portion of the destination address and forwards the packet to the appropriate interface.
Routing Decisions and Gateway Addresses
If the destination address's network portion differs from the originating host's network, the packet must be routed outside the original network. The gateway interface has a network layer address that matches the hosts' network address. Both the host IPv4 address and the gateway address must have the same network (and subnet, if used) portion of their respective addresses. A router makes a forwarding decision for each incoming packet. To forward a packet, the router needs a route to the destination network, which may be several routers or hops away.
Verifying Gateway and Route Configuration
The ipconfig command in Windows XP displays the IP address, subnet mask, and default gateway addresses. Routers also add routes for connected networks to their routing table when an interface is configured with an IP address and subnet mask. These connected networks are directly attached to the router interfaces, which act as gateways for hosts on different local networks. Remote networks are not directly connected to the
router. Routes to remote networks can be manually configured or learned automatically using dynamic routing protocols.
Routing Table Components
Routes in a routing table have three main components: the destination network, the next-hop router, and a metric. The router matches the destination address in the packet header with the destination network in the routing table and forwards the packet to the specified next-hop router. If a route to the destination network is not found, the packet is dropped. The default route is used when no other route in the routing table represents the destination network.
Host Routing Tables
Hosts use a local routing table to direct network layer packets to the correct destination network. Unlike router routing tables, host routing tables typically contain only direct connections and a default route to the gateway. Without a default gateway or route, packets destined for outside the network will be dropped. A host serves as its own gateway to its own network and has a default gateway for destinations outside the network, pointing to the router interface.
Packet Forwarding and Routing Tables
When a host creates packets, it uses its routing table to forward them to the locally connected destination. These local network packets are delivered without using a router. To forward a packet to a destination network, the router requires a route to that network. If the router has an entry for the network in its routing table, it indicates the next-hop router to which the packet should be forwarded. The routing process uses the routing table to map the destination network address to the next-hop address and then forwards the packet.
Routing Table Entries and Route Selection
A route in a routing table represents a range of host addresses, and sometimes a range of network and host addresses. If a packet arrives at the router with a destination address of 10.1.1.55, the router forwards the packet to the next-hop router associated with the route to network 10.1.1.0. If a route to 10.1.1.0 is not listed but a route to 10.1.0.0 is available, the packet is forwarded to the next-hop router for that network. The router prioritizes more specific routes when selecting a route for a packet.
Default Routes and Next-Hop Routers
In IPv4 networks, the address 0.0.0.0 is used as the default route. Packets with a destination network address that does not match a more specific
routers to dynamically share routing information. Routers share information about network changes or link changes with other routers. When a router receives new or changed route information, it updates its routing table and shares the information with other routers. This ensures that all routers have accurate, dynamically updated routing tables and can learn routes to remote networks.
Routing protocols provide up-to-date routing tables but introduce overhead. The exchange of route information consumes network bandwidth, which can be problematic on low-bandwidth links. Routing protocols also require complex algorithmic calculations, demanding sufficient processing capacity from routers. Static routing does not produce network overhead, as entries are directly placed into the routing table without processing. However, static routing requires administrative time for manual configuration and maintenance. Most internetworks use a combination of static and dynamic routes for efficient routing.
Network Layer and IP Protocol
The primary network layer (OSI Layer 3) protocol is IP. IPv4 is commonly used, although IPv6 is also available. IP routing does not guarantee reliable delivery or establish a connection before data transmission. The network layer encapsulates upper-level data into a packet and routes it from one host to another. The packet header includes the source and destination addresses.
Hierarchical network layer addressing, using IP addresses with network and host portions, allows for subnetting. The network portion of the IP address is used for forwarding packets between routers. Only the last router connected to the destination network uses the host portion of the IP address. If a host sends a packet to an address outside the local network, it is sent to the default gateway. The gateway router examines the destination address and forwards the packet to a connected network or the next-hop router based on its routing table.
Routing table entries can be configured statically or dynamically. Static routing involves manual configuration of routes and default routes. Dynamic routing uses routing protocols to automatically collect and share route information with other routers. The network layer encapsulates data from the transport layer and sends it to the data link layer (OSI Layer 2).