The Network layer, or OSI Layer 3, provides services to exchange data over the network between identified end devices. It uses four basic processes:

  • Addressing
  • Routing
  • Encapsulation
  • Decapsulation

The encapsulation and decapsulation are similar to the one in the DataLink Layer. So Let’s concentrate on the Addressing and Routing.

Network Layer Protocols

Protocols implemented at the Network layer that carry user data include:

  • Internet Protocol version 4(IPv4)
  • Internet Protocol version 6(IPv6)
  • Novell Internetwork Packet Exchange(IPX)
  • AppleTalk
  • Connectionless Network Service(CLNS/DECNet)

The Internet Protocol(IPv4 and IPv6) is the most widely-used Layer3 data carrying protocol and will be focus of this article.

1, IPv4 Protocol

As shown in the figure, the Network layer services implemented by the TCP/IP protocol suite are the Internet Protocol (IP). Version 4 of IP (IPv4) is currently the most widely-used version of IP. IPv4 basic characteristics:

  1. Connectionless - No connection is established before sending data packets.
  2. Best Effort(unreliable) - No overhead is used to guarantee packet delivery.
  3. Media Independent - Operates independently of the medium carrying the data.

IPv4 Packet - Packaging the Transport Layer PDU

The Transport Layer’s packets will be encapsulated into IPv4 Packet by appending an IP header:

As shown in the figure, an IPv4 protocol defines many different fields in the packet header. These fields contain binary values that the IPv4 services reference as they forward packets across the network. Here is 6 major key fields:

  • IP Source Address
  • IP Destination Address
  • Time-to-Live(TTL)
  • Type-of-Service
  • Protocol
  • Fragment Offset

2, Network Addressing in IPv4

Each device on a network must be uniquely defined. With IPv4, this means that each packet has a 32-bit source address and a 32-bit destination address in the Layer 3 header:

Addressing for different purposes

Within the address range of each IPv4 network, we have three types of addresses:

  1. Network address - The address by which we refer to the network.
  2. Broadcast address - A special address used to send data to all hosts in the network.
  3. Host addresses - The addresses assigned to the end devices in the network.

Unicast, Broadcast, Multicast


A unicast MAC address is the unique address used when a frame is sent from a single transmitting device to single destination device.


With a broadcast, the packet contains a destination IP address that has all ones in the host portion.


Recall that multicast addresses allow a source device to send a packet to a group of devices.

Private & Public Addresses

Although most IPv4 host addresses are public addresses designated for use in networks that are acessible on the Internet, there are blocks of addresses that are used in networks that require limited or no Internet access. These addresses are called private addresses.

Private Addresses:

  • - (
  • - (
  • - (

Network Address Translation(NAT)

With service to translate private addresses to public addresses, hosts on a privately addressed network can have access to resources across the Internet. These services, called Network Address Translation(NAT). There are three types of NAT:

  1. Static NAT:

  2. Dynamic NAT:

  3. Overloading(PAT or NPAT):


One such reserved address is the IPv4 loopback address The loopback is a special address that hosts use to direct traffic to themselves.

Assignment of Addresses

IP addresses can be assigned either statically or dynamically.

Static Assignment of Addresses

With a static assignment, the network administrator must manually configure the network information for a host, as shown in the figure.

Dynamic Assignment of Addresses

Because of the challenges associated with static address management, end user devices often have addresses dynamically assigned, using Dynamic Host Configuration Protocol (DHCP), as shown in the figure.

Internet Assigned Numbers Authority(IANA) is the master holder of the IP adresses. The IP multicast addresses and the IPv6 addresses are obtatined directly from IANA. Until the mid-1990s, all IPv4 address space was managed directly by the IANA.

The Subnet Mask

As we learned earlier, an IPv4 address has a network portion and a host portion. We referred to the prefix length as the number of bits in the address giving us the network portion. The prefix is a way to define the network portion that a human readable. The data network must also have this network portion of the addresses defined. To define the network and host portions of an address, te devices use a separate 32-bit pattern called a subnet mask, as shown in the figure.


To get access to the services of the Internet, we have to connect our data network to the Internet using an Internet Service Provider(ISP).

ISP Tiers

ISPs are designated by a hierarchy based on their level of connectivity to the Internet backbone. Each lower tier obtains connectivity to the backbone via a connection to a higher tier ISP, as shown in the figure.

3, Network Routing in IPv4

If the destination network is no directly connected, the packet is forwarded on to a second router that is the next-hop routes. The packet forwarding then becomes the responsibility of this second router. Many routers or hops along the way may process the packet before reaching the destination.


The gateway, also known as the defalt gateway, is needed to send a packet out of the local network. If the network portion of the destination address of the packet is different from the network of the originating host, the packet has to be routed outside the original network. To do this, the packet is sent to the gateway.

A Route - The Path to a Network

Host Routing Table

Routes in a routing table have three main features:

  • Destination network
  • Next-hop
  • Metric

Default Route

A default route is a route that will match all destination networks. In IPv4 networks, the address is used for this purpose. The default route is used to forward packets for which there is no entry in the routing table for the destination network.

Routing Processes - How Routes are learned

Each router in a path does not need a route to all networks. It only needs to know the next hop on the path to the packet’s destination network. The routing table contains the information that a router uses in its packet forwarding decisions.

Static Routing

Routes to remote networks with the associated next hops can be manually configured on the router. This is known as static routing.

Dynamic Routing

Dynamic routing protocols are the set of rules by which routers dynamically share there routing information. Common Routing protocols are:

  • Routing Information Protocol (RIP)
  • Enhanced Interior Gateway Routing Protocol (EIGRP)
  • Open Shortest Path First (OSPF)

4, Testing the Network Layer

Ping is a utility for testing IP connectivity between hosts. Ping sends out requests for responses from a specified host address. Ping uses a Layer 3 protocol that is a part on the TCP/IP suite called Internet Control Message Protocol(ICMP). ICMP messages that may be sent include:

  • Host confirmation
  • Unreachable Destination or Service
  • Time exceeded
  • Route redirection
  • Source quench

5, Address Resolution Protocol(ARP)

The ARP protocol provides two basic functions:

  • Resolving IPv4 addresses to MAC addresses
  • Maintaining a cache of mappings

Proxy ARP

Using proxy ARP, a router interface acts as if it is the host with the IPv4 address requested by the ARP request. By “faking” its identity, the router accepts responsibility for routing packets to the “real” destination.

评论需要翻墙 for disqus