Network Fundamentals – Layer 3 Technologies

 

Network Layer Addresses

Although each network interface has a unique MAC address, this does not specify the location of a specific device or to what network it is attached, meaning a router cannot determine the best path to that device. In order to solve this problem, Layer 3 addressing is used.

Network addresses are logical addresses assigned when a device is placed in the network and changed when the device is moved. Network layer addresses have a hierarchical structure comprised of two parts: the network address and the host address. Logical addresses can be assigned manually by the administrator or dynamically via a dedicated protocol, such as Dynamic Host Configuration Protocol (DHCP). All the devices in a network have the same network portion of the address and different host identifiers.

This addressing structure is illustrated in Figure 1.23 below, both for IPv4 and for IPv6. The IPv4 and IPv6 address structures will be covered in detail in Chapter 6.

23

Figure 1.23 – Network Addressing Structure

Routers analyze the network portion of IP addresses and compare them with entries from its routing table. If a match is found, the packet is sent to the appropriate interface. If the devices are directly connected, routers also examine the host portion of the address in order to send the packet to the appropriate device. The router uses Address Resolution Protocol (ARP) to determine the MAC address of the device with a specific IP address and encapsulates the packet with a header that contains that specific MAC address before sending it on the wire.

 

IPv4 Addressing

IPv4 addresses are 32-bit numbers represented as strings of 0s and 1s. As mentioned before, the Layer 3 header contains a Source IP Address field and a Destination IP Address field. Each field is 32 bits in length.

For a more intuitive representation of IPv4 addresses, the 32 bits can be divided into four 4-octet (1 octet, or byte, = 8 bits) groupings separated by dots, which is called dotted-decimal notation. The octets can be converted into decimal numbers by standard base-2 to base-10 translation.

For example, consider the following 32-bit string:

11000000101010001000000010101001

Dividing it into 4 octets results in the following binary representation:

11000000.10101000.10000000.10101001

This translates into an easy-to-read decimal representation:

192.168.128.169

The maximum value of an octet is when all the bits are equal to 1. The equivalent decimal value is 255.

IPv4 addresses are categorized into five classes. Classes A, B, and C are used for addressing devices, Class D is for multicast groups, and Class E is reserved for experimental use. The first bits of the address define which class it belongs to, as illustrated below. Knowing the class of an IPv4 address helps determine which part of the address represents the network and which part represents the host bits.

 

Class

Leading Bits

Size of Network Portion

Size of Host Portion

Number of Networks

Addresses per Network

Start Address

End Address

A

0

8 bits

24

128

16,777,216

0.0.0.0

127.255.255.255

B

10

16 bits

16

16,384

65,536

128.0.0.0

191.255.255.255

C

110

24 bits

8

2,097,152

256

192.0.0.0

223.255.255.255

D

1110

224.0.0.0

239.255.255.255

E

1111

240.0.0.0

225.255.255.255

IPv4 addresses can be classified into the following categories:

  • Public addresses, used for external communication
  • Private addresses, which are reserved and used only internally within a company

Private address ranges, as defined by RFC 1918, include the following:

  • 10.0.0.0 to 10.255.255.255
  • 172.16.0.0 to 172.31.255.255
  • 192.168.0.0 to 192.168.255.255

When reserving full classes of addresses (i.e., classful addressing) for certain networks, certain limitations appear because of the large number of addresses per network and because of the limited IPv4 address space. For this reason, the concept of subnets (i.e., classless addressing) was introduced in RFC 950.

Classless addressing allows Class A, B, and C addresses to be divided into smaller networks called subnets, resulting in a larger number of possible networks, each with fewer host addresses. The subnets are created by borrowing bits from the host portion and using them as subnet bits.

An important aspect in IPv4 addressing is separating the network and the host part of the addressing string. This is accomplished by using a subnet mask, also represented as a 32-bit number. The subnet mask starts with a continuous string of bits with the value of 1 and ends with a string of 0s. The number of bits with the value of 1 represents the number of bits in the IP address that must be considered in order to calculate the network address. A subnet mask bit of 0 indicates that the corresponding bit in the IPv4 address is a host bit. Using the same example as above and a 255.255.255.0 mask results in the following situation:
24

With a string of 24 bits of 1 in the subnet mask, consider only the first 24 bits in the IP address as the network portion, resulting in a network address of 192.168.128.0 with a subnet mask of 255.255.255.0. The last 8 bits in the IP address, called the host portion of the IP address, can be assigned to network devices. Having 8 free bits, you can assign an IP address to 28 hosts, meaning a total of 256 host addresses in the 192.168.128.0 network space. Every machine in a particular LAN will have the same network address and subnet mask; however, the host portion of the IP address will be different.

When using classless addressing, a subnet mask indicates which bits have been borrowed from the host field. Using subnet masks creates a three-level hierarchy: network, subnet, and host. Another way to represent the subnet mask is by using a prefix or a slash-notation (/) to indicate how many network bits the address contains. For example, 192.168.10.0/24 means the first 24 bits of the 192.168.10.0 address are network bits. This corresponds to a 255.255.255.0 subnet mask.

IPv6 Addressing

The limited number of IPv4 addresses and the permanent increase in the number of addressable network devices all over the world has accelerated the implementation of IP version 6. IPv6 addresses have a different structure than IPv4 addresses do. They are 128 bits long, which means a larger pool of IPv6 addresses is available. The notation of IPv6 addresses is also different: while an IPv4 address can be written in decimal format, an IPv6 address is notated in a hexadecimal format (i.e., 16 bits separated by colons), for example:

2001:43aa:0000:0000:11b4:0031:0000:c110.

Considering the complex format of IPv6 addresses, the following rules were developed to shorten them:

  • One or more successive 16-bit groups that consist of all 0s can be omitted and represented by two colons (::)
  • If a 16-bit group begins with one or more 0s, the leading 0s can be omitted.

For the IPv6 example above (2001:43aa:0000:0000:11b4:0031:0000:c110), the shortened representations are as follows:

  • 2001:43aa::11b4:0031:0000:c110
  • 2001:43aa::11b4:0031:0:c110
  • 2001:43aa::11b4:31:0:c110

Several types of IPv6 addresses are required for various applications, as listed below. Compared to IPv4 address types (i.e., unicast, multicast, and broadcast) IPv6 is different in that special multicast addresses are used instead of broadcast addressing and it includes a new address type called anycast.

Address Type

Range

Description

Aggregatable Global Unicast

2000::/3

Public addresses, host-to-host communications; equivalent to IPv4 unicast
Multicast

FF00::/8

One-to-many and many-to-many communication; equivalent to IPv4 multicast
Anycast

Same as Unicast

Interfaces from a group of devices can be assigned the same anycast address; the device closest to the source will respond; application-based, including load balancing, optimization traffic for a particular service, and redundancy
Link-local Unicast

FE80::/10

Connected-link communications; assigned to all device interfaces and used only for local-link traffic
Solicited-node Multicast

FF02::1:FF00:0/104

Neighbor solicitation

IP Routing

Routers are devices that operate at OSI Layer 3 and their responsibility is to determine the best path a packet can take to a specific destination. After the best path has been chosen, the packet is encapsulated with a new frame and the router places the packet on the interface that has a link to the next hop in that path.

The process of choosing the best path is called routing and the process of sending the packet to the correct interface is called switching. Although routers are the most popular devices that make routing decisions, other network devices can have routing functionality, such as Layer 3 switches or security appliances.

A router is responsible for sending the packet the correct way, no matter what is happening above the network layer. However, a router is concerned with what is happening on the Physical and Data Link Layers because it might need to receive data from certain media and send over a different media type. This happens by decapsulating the received packet up to the Network Layer and encapsulating it with the header specific to the other media type.

Figure 1.24 below illustrates this process. Router A receives the packet over an Ethernet connection, re-encapsulates it with a Frame Relay header, and sends it to Router B, which processes the packet in the reverse order by stripping the Frame Relay header and encapsulating it in the Ethernet format before sending the packet to the receiver endpoint. Note that the routers are concerned with only the last three OSI layers.

25

Figure 1.24 – Routing across Different Physical Media

Routers look at the packet’s destination address to determine where the packet is going so they can select the best route to get the packet there. In order to calculate the best path, routers must know what interface should be used in order to reach the packet’s destination network. Routers learn about the network either by being connected to them physically or by learning information from other routers or from a network administrator. The process of learning about networks from other routers’ advertisements is called dynamic routing and different routing protocols can be used to achieve this (this process will be covered in more detail in subsequent chapters). The process by which a network administrator manually defines routing rules on the device is called static routing. Finally, the routes to which a router is physically connected are known as directly connected routes.

Routers keep the best path to destinations learned via direct connections, static routing, or dynamic routing in internal data structures called routing tables. A routing table contains a list of networks the router has learned about and information about how to reach them.

As mentioned before, dynamic routing is the process by which a router exchanges routing information and learns about remote networks from other routers. Different routing protocols can accomplish this task, including the following:

  • Routing Information Protocol (RIP)
  • Enhanced Interior Gateway Routing Protocol (EIGRP)
  • Open Shortest Path First (OSPF)
  • Intermediate System to Intermediate System (IS-IS)
  • Border Gateway Protocol (BGP)

The most important information a routing table contains includes the following items:

  • How the route was learned (i.e., static, dynamic, or directly connected)
  • The address of the neighbor router from which the network was learned
  • The interface through which the network can be reached
  • The route metric, which is a measurement that gives routers information about how far or how preferred a network is (the exact meaning of the metric value depends on the routing protocol used)

26

Figure 1.25 – Routing Tables

Figure 1.25 above illustrates a scenario with two routers that use hop count as the metric. The topology contains three networks known by both routers. Hop count represents the number of routers that a packet is sent through to reach a specific destination. Router A has two directly connected networks, 10.10.10.0 and 192.168.10.0; thus, the metric to each of them is 0. Router A knows about the 10.10.20.0 network from Router B, so the metric for this network is 1, because a packet sent by Router A must traverse Router B to reach the 10.10.20.0 network. Router B has two directly connected networks, 10.10.20.0 and 192.168.10.0, and one remote network learned from Router A, 10.10.10.0, with a metric of 1.

Summary

Comments

Popular posts from this blog

Terraform

Scrum Master Interview help - Bootcamp

Kubernetes