Lecture 21: Networking & Protocol Stacks, Slides of Network Technologies and TCP/IP

– A router has a distinguished role as a host because it will forward IP packets across network boundaries. – All internetworking is done below ...

Typology: Slides

2022/2023

Uploaded on 05/11/2023

ekassh
ekassh 🇺🇸

4.7

(23)

272 documents

1 / 25

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
11/10/20
1
CS 422/522 Design & Implementation
of Operating Systems
Lecture 21: Networking & Protocol
Stacks
Zhong Shao
Dept. of Computer Science
Yale University
Acknowledg ement:
some slides are taken from previous versions of the CS422/522 lectures taught by Prof. Bryan Ford
and Dr. David Wol ins ky, and also from the official set of slides accompanying the OSPP textbook by Anderson and Dahlin.
1
Overview
Introduction
History, Basic Concepts
Networking Fundamentals
Layering, Internetworking, Addressing, Naming
Internet Protocols
Link Layer Protocols, IP, Transport Protocols (TCP, UDP)
Network Programming
BSD sockets
2
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19

Partial preview of the text

Download Lecture 21: Networking & Protocol Stacks and more Slides Network Technologies and TCP/IP in PDF only on Docsity!

CS 422/522 Design & Implementation of Operating Systems

Lecture 21: Networking & Protocol

Stacks

Zhong Shao Dept. of Computer Science Yale University Acknowledgement: some slides are taken from previous versions of the CS422/522 lectures taught by Prof. Bryan Ford and Dr. David Wolinsky, and also from the official set of slides accompanying the OSPP textbook by Anderson and Dahlin. 1

Overview

  • Introduction
    • History, Basic Concepts
  • Networking Fundamentals
    • Layering, Internetworking, Addressing, Naming
  • Internet Protocols
    • Link Layer Protocols, IP, Transport Protocols (TCP, UDP)
  • Network Programming
    • BSD sockets 2

What is the internet?

! History:

  • 1960s: ARPAnet - Defense Advanced Research Projects Agency * research project into packet switching networks * wanted communications infrastructure capable of exploiting redundancy to route around damaged links
  • 1970s: ARPA needed:
    • A common OS for researchers with ARPA funding
    • Technology to keep geographically dispersed ARPA researchers in contact with each other Þ funding for BSD Unix project, Univ. of Calif. Berkeley
  • 1980s: BSD Unix
    • Included support for Internet network protocols (TCP/IP) 3

What is the internet?

! The Internet is really a network of networks

connecting millions of computing devices throughout the world. ! Each network is administered independently of all other networks

  • There is no central authority running the Internet. 4

Overview

  • Introduction
    • History, Basic Concepts
  • Networking Fundamentals
    • Layering, Internetworking, Addressing, Naming
  • Internet Protocols
    • Link Layer Protocols, IP, Transport Protocols (TCP, UDP)
  • Network Programming
    • BSD sockets 7

The OSI seven-layer networking model

Physical Data Link Network Transport Session Presentation Application Layer Name Description Specific application (file transfer, remote login, etc.) Data formatting and conversion (e.g. byte-swapping) Long-lived “virtual connection” primitives Reliable or unreliable end-to-end data delivery Packet routing through intermediate hosts Controls physical link between two endpoints Electrical signals over physical media 8

TCP/IP and the OSI seven-layer model

! TCP/IP based on a simplified form of OSI model: OSI model Physical Data Link Network Transport Session Presentation Application Internet model Application Network Transport Data Link (telnet, ftp, WWW, …) Transmission Control Protocol (TCP), UDP Internet Protocol (IP) (Ethernet, token ring, PPP,…) 9

An illustrative example: file transfer

! We want to transfer a file between two hosts directly connected by a Local Area Network (LAN): Ethernet FTP client FTP server 10

Routing

! Multiple networks are linked together by routers - special hosts with multiple network connections: Ethernet driver FTP client TCP IP Ethernet driver FTP server TCP IP FTP Protocol TCP Protocol IP Protocol Ethernet Ethernet Ethernet driver IP Ethernet driver IP Protocol router Ethernet Protocol Ethernet Protocol 13

Routing, cont.

! Items to note from this diagram:

  • The router has multiple network interfaces (physical network connections). Hosts with multiple network interfaces are said to be multi-homed.
  • A router has a distinguished role as a host because it will forward IP packets across network boundaries.
  • All internetworking is done below the level of IP; In fact, TCP and FTP don’t even know that multiple networks are involved! 14

Network layering revisited

! In the previous example, FTP is “above” TCP which is “above” IP, which is “above” the Ethernet driver. ! Q: What does this mean from an implementation point of view? ! A: Each network layer may only interact with layers located directly above and below it in the protocol stack.

  • Each network layer provides a well-defined set of services to the layers above and below it through an Application Programmer Interface (API).
  • The only network API directly accessible to user programs is the sockets API for transport-layer access. Lower-level APIs are in the OS kernel. 15

Encapsulation and demultiplexing

! A network layer makes use of layers beneath it through encapsulation: application data application data application data application data TCP header TCP header TCP header IP header ENet header IP header ENet trailer TCP segment IP datagram Ethernet frame 16

IP Addressing, cont.

! There are five different classes of Internet address: Class A Class B Class C Class D Class E (^0) netid 7 bits hostid 24 bits (^1 0) netid hostid 14 bits 16 bits (^1 1 0) netid hostid 21 bits 8 bits (^1 1 1 0) multicast group ID 28 bits (^1 1 1 1 0) reserved for future use 27 bits 19

IP Addressing, cont.

! Certain IP addresses are assigned a “special” meaning: ! netid = 127:

  • Always refers to loopback interface on local host. Try the command telnet localhost from any Unix system to verify this. ! netid = (all 1 bits), hostid = (all 1 bits):
  • Limited broadcast to all hosts on directly connected network. ! netid = (some valid network ID), hostid = (all 1 bits):
  • net-directed broadcast to all hosts on specified network. ! These broadcast addresses are primarily useful for locating configuration information on the local net during booting. 20

Naming of internet hosts

! IP Addresses are not particularly convenient for humans. ! Therefore, each host may be assigned a hostname - a friendly, string “name” identifying the host. ! For example, the hostname: george.lbl.gov ! maps to the IP address: 128.3.196. 21

The Domain Name System (DNS) - motivation

! Originally, the mapping from host names to IP addresses was administered through a single flat file: /etc/hosts.

  • one entry for every host on the Internet(!)
  • one “master copy” administered at a central site; periodically copied by local sys. admins. ! This approach was rife with problems:
  • scalability - An /etc/hosts file in 1996 would be prohibitively large.
  • administrative autonomy - Individual sites had to register with the NIC every time they wanted to name a machine! ! To address these problems, the Domain Name System (DNS) was devised. 22

DNS - name resolution

! The process of looking up a domain name to address mapping is called name resolution. Name resolution happens recursively: ns.nasa.gov (root) client … abc.edu berkeley.edu …. 1 2 ns.berkeley.edu … cchem.berkeley.edu cs.berkeley.edu ... 3 4 ns.cchem.berkeley.edu … cesium.cchem.berkeley.edu selenium.cchem.berkeley.edu … 5 6 25

Overview

  • Introduction
    • History, Basic Concepts
  • Networking Fundamentals
    • Layering, Internetworking, Addressing, Naming
  • Internet Protocols
    • Link Layer Protocols, IP, Transport Protocols (TCP, UDP)
  • Network Programming
    • BSD sockets 26

Internet Protocols -- The Link Layer

Application Network Transport Data Link (telnet, ftp, WWW, …) Transmission Control Protocol (TCP), UDP Internet Protocol (IP) (Ethernet, token ring, PPP,…) 27

The link layer

! The Link Layer refers to the software directly responsible for a physical link.

  • This is generally found in the driver for a particular piece of hardware (e.g. the Ethernet driver). ! The link layer is highly dependent on the network hardware being used. ! There are different link layer standards for Ethernet, RS- 232 serial link, and token ring hardware. 28

ARP and RARP

! Key Points:

  • ARP and RARP work by broadcasting a query on the local network.
  • ARP and RARP are network-layer protocols, in parallel to IP in layering diagrams.
  • RARP is only used by a machine at boot-time to discover its own IP address. 32 - bit IP Address physical address ARP RARP ARP and RARP translate between physical addresses and IP addresses: 31

Internet Protocols - The Network

Layer

Application Network Transport Data Link (telnet, ftp, WWW, …) Transmission Control Protocol (TCP), UDP Internet Protocol (IP) (Ethernet, token ring, PPP,…) 32

Internet protocol - basic concepts

! IP is a stateless, connectionless, unordered, unreliable, protocol. More sophisticated facilities such as logical connections and reliability are provided by higher layers. ! Internet hosts communicate by exchanging IP datagrams. 33

IP – basic concepts

! IP is stateless - hosts do not retain any information at the level of IP about previous transmissions. ! IP is connectionless - a datagram may be sent from one node to another without first “opening a connection” to the node. ! IP is unordered^ - packets may arrive at their destination in a different order than they were sent. ! IP is unreliable - packets may be dropped or corrupted. 34

IP datagram format - notes

! 16 - bit header size limits max IP datagram size to 64KB

! TTL limits number of routers a datagram may traverse

  • decremented by 1 every time packet forwarded by some router

! header checksum calculated over IP header only

! identification field uniquely identifies each datagram

sent by a host

! options are rarely used, but provided for things like:

  • recording routes (with severe size limitations)
  • loose/strict source routing 37 Transmission Control Protocol (TCP), UDP

The Internet Protocols - Transport

Layer

Application Network Transport Data Link (telnet, ftp, WWW, …) Internet Protocol (IP) (Ethernet, token ring, PPP,…) 38

TCP – basic concepts

! TCP is a transport-layer protocol layered on top of IP. TCP provides a connection-oriented, two-way, ordered, reliable, byte-stream model of communication.

! IP provides none of the above services, so all of

this functionality is found in the TCP protocol. 39

TCP – basic concepts

! TCP is connection-oriented. A logical connection must be established before communication begins. ! TCP is ordered - data is delivered to a receiving application in the order it was transmitted by the sender. ! TCP is reliable - Retransmissions and acknowledgements are used to ensure that all data arrives at the destination. Checksums are used to ensure that data is not corrupted in transit. ! TCP presents a byte-stream model - data may be delivered in different-sized chunks than it was transmitted. 40