Tuesday, October 5, 2021

CST 311 Intro to Computer Networks Module 5: Network Layer - Data Plane

 1.0 Learning Objectives

  • Gain an understanding of the principles behind network layer services, focusing on data plane:
  • Learn the distinction between forwarding and routing.
  • Learn how a router works.
  • Learn how to implement IPv4 addressing.
  • Learn about IPv6,
  • Be introduced to Software-designed networking (SDN).
  • Investigate and experiment with Network Address Translation (NAT) using Mininet and Wireshark.
  • Investigate and experiment with Dynamic Host Configuration Protocol (DHCP) using Mininet and Wireshark.
  • Start a programming assignment to develop a multi-threaded client-server chat program.

Overview of Network Layer

  • The primary data-plane role of each router is to forward datagrams from its input links to its output links; the primary role of the network control plane is to coordinate these local, per-router forwarding actions so that datagrams are ultimately transferred end-to-end, along paths of routers between source and destination hosts.
  • The primary role of the network layer is deceptively simple—to move packets from a sending host to a receiving host. To do so, two important network-layer functions can be identified:  
    • Forwarding. When a packet arrives at a router’s input link, the router must move the packet to the appropriate output link.  
    • Routing. The network layer must determine the route or path taken by packets as they flow from a sender to a receiver. The algorithms that calculate these paths are referred to as routing algorithms.  
  • Forwarding (data plane) refers to the router-local action of transferring a packet from an input link interface to the appropriate output link interface. Forwarding takes place at very short timescales (typically a few nanoseconds), and thus is typically implemented in hardware. We can think of forwarding as the process of getting through a single interchange: A car enters the interchange from one road and deter- mines which road it should take to leave the interchange.
  • Routing (control plane) refers to the network-wide process that determines the end-to-end paths that packets take from source to destination. Routing takes place on much longer timescales (typically seconds), and as we will see is often implemented in software. We can think of routing as the process of planning the trip from Pennsylvania to Florida: Before embarking on the trip, the driver has consulted a map and chosen one of many paths possible, with each path consisting of a series of road segments connected at interchanges.
  • Forwarding Table A key element in every network router is its forwarding table. A router forwards a packet by examining the value of one or more fields in the arriving packet’s header, and then using these header values to index into its forwarding table. The value stored in the forwarding table entry for those values indicates the outgoing link interface at that router to which that packet is to be forwarded.  
  • Control Plane: Traditional Approach the routing algorithm determines the contents of the routers’ forward- ing tables. In this example, a routing algorithm runs in each and every router and both forwarding and routing functions are contained within a router. tTe routing algorithm function in one router communicates with the routing algorithm function in other routers to compute the values for its forwarding table by exchanging routing messages containing routing information according to a routing protocol. 
  • Control Plane: The SDN Approach An alternate approach in which a physically separate (from the routers), remote controller computes and distributes the forwarding tables to be used by each and every router. The control-plane approach is at the heart of software-defined networking (SDN), where the net- work is “software-defined” because the controller that computes forwarding tables and interacts with routers is implemented in software.
  • Network Service Model The network service model defines the characteristics of end-to-end delivery of packets between sending and receiving hosts including: 
    • Guaranteed delivery. This service guarantees that a packet sent by a source host will eventually arrive at the destination host.  
    • Guaranteed delivery with bounded delay. This service not only guarantees delivery of the packet, but delivery within a specified host-to-host delay bound (for example, within 100 msec).  
    • Guaranteed minimal bandwidth. This network-layer service emulates the behav- ior of a transmission link of a specified bit rate (for example, 1 Mbps) between sending and receiving hosts.    
    • In-order packet delivery. This service guarantees that packets arrive at the desti- nation in the order that they were sent.  
    • Security. The network layer could encrypt all datagrams at the source and decrypt them at the destination, thereby providing confidentiality to all transport-layer segments.  
  • Best Effort Service The Internet’s network layer provides a single service, known as best-effort service. With best-effort service, packets are neither guaranteed to be received in the order in which they were sent, nor is their eventual delivery even guaranteed. It might appear that best-effort service is a euphemism for no service at all—a network that delivered no packets to the destination would satisfy the definition of best-effort delivery service!  
  • Link Layer Switches Some packet switches, called link-layer switches base their forwarding decision on values in the fields of the link-layer frame; switches are thus referred to as link-layer (layer 2) devices. 
  • Routers other packet switches, called routers, base their forwarding decision on header field values in the network-layer datagram. Routers are thus network-layer (layer 3) devices. 

What's Inside A Router 

  • Input ports. An input port performs several key functions. It performs the physical layer function of terminating an incoming physical link at a router. An input port also performs link-layer functions needed to interoperate with the link layer at the other side of the incoming link; Perhaps most crucially, a lookup function is also performed at the input port; this will occur in the rightmost box of the input port. It is here that the forwarding table is consulted to determine the router output port to which an arriving packet will be forwarded via the switching fabric.
  • Switching fabric. The switching fabric connects the router’s input ports to its output ports. This switching fabric is completely contained within the router—a network inside of a network router!
  • Output ports. An output port stores packets received from the switching fabric and transmits these packets on the outgoing link by performing the necessary link-layer and physical-layer functions. When a link is bidirectional, an output port will typically be paired with the input port for that link on the same line card.  
  • Routing processor. The routing processor performs control-plane functions. In traditional routers, it executes the routing protocols , maintains routing tables and attached link state information, and computes the forwarding table for the router. In SDN routers, the routing processor is responsible for communicating with the remote controller in order to (among other activities) receive forwarding table entries computed by the remote controller, and install these entries in the router’s input ports. The routing processor also performs the network management functions.
  • Control Plane - router’s control functions—executing the routing protocols, responding to attached links that go up or down, communicating with the remote controller (in the SDN case) and performing management functions—operate at the millisecond or second timescale. These control plane functions are thus usually implemented in software and execute on the routing processor (typically a traditional CPU).
  • Destination-based forwarding. Suppose the car stops at an entry station and indicates its final destination (not at the local roundabout, but the ultimate destination of its journey). An attendant at the entry station looks up the final destination, determines the roundabout exit that leads to that final destination, and tells the driver which roundabout exit to take.  
  • Generalized forwarding. The attendant could also determine the car’s exit ramp on the basis of many other factors besides the destination. In the case of generalized forwarding, any number of factors may contribute to the attendant’s choice of the exit ramp for a given car.
  • Prefix - With this style of forwarding table, the router matches a prefix of the packet’s des- tination address with the entries in the table; if there’s a match, the router forwards the packet to a link associated with the match. For example, suppose the packet’s destination address is 11001000 00010111 00010110 10100001; because the 21-bit prefix of this address matches the first entry in the table, the router forwards the packet to link interface 0. If a prefix doesn’t match any of the first three entries, then the router forwards the packet to the default interface 3.  
  • longest prefix matching rule(Used in Internet Addressing) When there are multiple matches, the router uses the longest prefix matching rule; that is, it finds the longest matching entry in the table and forwards the packet to the link interface associated with the longest prefix match.
  • Switching Fabric The switching fabric is at the very heart of a router, as it is through this fabric that the packets are actually switched (that is, forwarded) from an input port to an output port\
  • Switching via memory. The simplest, earliest routers were traditional computers, with switching between input and output ports being done under direct control of the CPU (routing processor).  
  • Switching via a bus. In this approach, an input port transfers a packet directly to the output port over a shared bus, without intervention by the routing processor.  
  • Switching via an interconnection network. One way to overcome the bandwidth limitation of a single, shared bus is to use a more sophisticated interconnection network, such as those that have been used in the past to interconnect processors in a multiprocessor computer architecture.  
  • Output port processing takes packets that have been stored in the output port’s memory and transmits them over the output link. 
  • Packet Lost Since as these queues grow large, the router’s memory can eventually be exhausted and packet loss will occur when no memory is available to store arriving packets. Recall that in our earlier discussions, we said that packets were “lost within the network” or “dropped at a router.” It is here, at these queues within a router, where such packets are actually dropped and lost.
  • head-of-the-line (HOL) blocking This phenomenon is known as head-of-the-line (HOL) blocking in an input-queued switch—a queued packet in an input queue must wait for transfer through the fabric (even though its output port is free) because it is blocked by another packet at the head of the line. [Karol 1987] shows that due to HOL blocking, the input queue will grow to unbounded length (informally, this is equivalent to saying that significant packet loss will occur) under certain assumptions as soon as the packet arrival rate on the input links reaches only 58 percent of their capacity
  • Drop tail When there is not enough memory to buffer an incoming packet, a decision must be made to either drop the arriving packet (a policy known as drop-tail) or remove one or more already-queued packets to make room for the newly arrived packet.  
  • Active queue management (AQM) A number of proactive packet-dropping and -marking policies (which collectively have become known as active queue management (AQM) algorithms) have been proposed and analyze.
  • Random Early Detection (RED) One of the most widely studied and implemented AQM algorithms.
  • Packet scheduler at the output port must choose one packet, among those queued, for transmission.
  • First In First Out The FIFO (also known as first-come-first-served, or FCFS) scheduling discipline selects packets for link transmission in the same order in which they arrived at the output link queue.
  • Priority Queuing Under priority queuing, packets arriving at the output link are classified into prior- ity classes upon arrival at the queue. When choosing a packet to transmit, the priority queuing discipline will transmit a packet from the highest priority class that has a nonempty queue (that is, has packets waiting for transmission). The choice among packets in the same priority class is typically done in a FIFO manner.
  • Non-Preemptive Priority Queue The transmission of a packet is not interrupted once it has begun
  • Round Robin Under the round robin queuing discipline, packets are sorted into classes as with priority queuing. However, rather than there being a strict service priority among classes, a round robin scheduler alternates service among the classes. In the simplest form of round robin scheduling, a class 1 packet is transmitted, followed by a class 2 packet, followed by a class 1 packet, followed by a class 2 packet, and so on. 
  • Work-conserving queuing discipline will never allow the link to remain idle whenever there are packets (of any class) queued for transmission. A work- conserving round robin discipline that looks for a packet of a given class but finds none will immediately check the next class in the round robin sequence.  
  • Weighted fair queuing (WFQ) discipline A generalized form of round robin queuing. Here, arriving packets are classified and queued in the appropriate per-class waiting area. As in round robin scheduling, a WFQ scheduler will serve classes in a circular manner— first serving class 1, then serving class 2, then serving class 3, and then (assuming there are three classes) repeating the service pattern. WFQ is also a work-conserving queuing discipline and thus will immediately move on to the next class in the service sequence when it finds an empty class queue.

The Internet Protocol (IP): IPv4, Addressing, IPv6, and More

  • Datagram is the network layer packet. IPV4 includes: 
    • Version number (4 bits): These 4 bits specify the IP protocol version of the datagram.  
    • Header length(4 bits): Because an IPv4 datagram can contain a variable number of options  these 4 bits are needed to determine where in the IP datagram the payload actually begins. 
    • Types of Service: The type of service (TOS) bits were included in the IPv4 header to allow different types of IP datagrams to be distinguished from each other 
    • Datagram length. This is the total length of the IP datagram (header plus data), measured in bytes. Since this field is 16 bits long, the theoretical maximum size of the IP datagram is 65,535 bytes. However, datagrams are rarely larger than 1,500 bytes, which allows an IP datagram to fit in the payload field of a maximally sized Ethernet frame.   
    • Identifier, flags, fragmentation offset.   
    • Time-to-live. The time-to-live (TTL) field is included to ensure that datagrams do not circulate forever in the network. Each time a datagram is processed by the router, the TTL value is decremented by 1. When the value reaches 0, it will be dropped. 
    • Protocol. This field is typically used only when an IP datagram reaches its final destination. The value of this field indicates the specific transport-layer protocol to which the data portion of this IP datagram should be passed.  
    • Header checksum. The header checksum aids a router in detecting bit errors in a received IP datagram.
    • Source and destination IP addresses. 
    • Options. The options fields allow an IP header to be extended.  
    • Data (payload). Finally, we come to the last and most important field—the raison d’etre for the datagram in the first place  
  • Maximum transmission unit (MTU) For example, Ethernet frames can carry up to 1,500 bytes of data, whereas frames for some wide-area links can carry no more than 576 bytes. The maximum amount of data that a link-layer frame can carry is called the maximum transmission unit (MTU).
  • Fragment How are you going to squeeze this oversized IP datagram into the payload field of the link-layer frame? The solution is to fragment the payload in the IP datagram into two or more smaller IP datagrams, encapsulate each of these smaller IP datagrams in a separate link-layer frame; and send these frames over the outgoing link. Each of these smaller datagrams is referred to as a fragment.  
  • Interface A host typically has only a single link into the network; when IP in the host wants to send a datagram, it does so over this link. The boundary between the host and the physical link is called an interface. Because every host and router is capable of sending and receiving IP datagrams, IP requires each host and router interface to have its own IP address. Thus, an IP address is technically associated with an interface, rather than with the host or router containing that interface. 
  • Dotted-Decimal Notation Each IP address is 32 bits long (equivalently, 4 bytes), and there are thus a total of 232 (or approximately 4 billion) possible IP addresses. These addresses are typically written in so-called dotted-decimal notation, in which each byte of the address is written in its decimal form and is separated by a period (dot) from other bytes in the address. 
  • Subnet this network interconnecting three host interfaces and one router interface forms a subnet. A subnet is also called an IP network or simply a network in the Internet literature
  • Subnet mask IP addressing assigns an address to this subnet: 223.1.1.0/24, where the /24 (“slash-24”) notation, sometimes known as a subnet mask, indicates that the leftmost 24 bits of the 32-bit quantity define the subnet address.   
  • Classless Interdomain Routing The Internet’s address assignment strategy is known as Classless Interdomain Routing (CIDR—pronounced cider) . CIDR generalizes the notion of subnet addressing  
  • Prefix The x most significant bits of an address of the form a.b.c.d/x constitute the network portion of the IP address, and are often referred to as the prefix (or network prefix) of the address.
  • Classful Addressing Before CIDR was adopted, the network portions of an IP address were constrained to be 8, 16, or 24 bits in length, an addressing scheme known as classful addressing, since subnets with 8-, 16-, and 24-bit subnet addresses were known as class A, B, and C networks, respectively. 
  • Dynamic Host Configuration Host addresses can also be configured manually, but typically this is done using the Dynamic Host Configuration Protocol (DHCP). DHCP allows a host to obtain (be allocated) an IP address automatically. A network administrator can configure DHCP so that a given host receives the same IP address each time it connects to the network, or a host may be assigned a temporary IP address that will be different each time the host connects to the network. In addition to host IP address assignment, DHCP also allows a host to learn additional information, such as its subnet mask, the address of its first-hop router (often called the default gateway), and the address of its local DNS server.  
  • Plug-and-play or zeroconf (zero-configuration) protocol DHCP Because of DHCP’s ability to automate the network-related aspects of connecting a host into a network. 
  • DHCP Discover Message The first task of a newly arriving host is to find a DHCP server with which to interact. This is done using a DHCP discover message, which a client sends within a UDP packet to port 67 
  • DHCP Offer message A DHCP server receiving a DHCP discover message responds to the client with a DHCP offer message that is broadcast to all nodes on the subnet, again using the IP broadcast address of 255.255.255.255. 
  • IP address lease time—the amount of time for which the IP address will be valid. It is common for the server to set the lease time to several hours or day.
  • DHCP REQUEST Message The newly arriving client will choose from among one or more server offers and respond to its selected offer with a DHCP request message, echoing back the configuration parameters.
  • ACK Message The server responds to the DHCP request message with a DHCP ACK message, confirming the requested parameters.

Overall, this week has been pretty busy. The labs were not very straight forward and took a lot more time tweaking the instructions until i could get it right. Some of the questions on the lab quiz can be tricky. I just wish it was more straight forward.

No comments:

Post a Comment

CST 499 Capstone - Week 8 Learning Journal Final Entry

This is the very last entry of the journal of your CS Online learning!  Keeping regular journals is a great way for us to grow, both profe...