An Integrated Approach to Architecture and Operating Systems
Chapter 13
Fundamentals of Networking and
Network Protocols
©Copyright 2008 Umakishore Ramachandran and William D. Leahy Jr.
13.1 Preliminaries
• Today a general purpose computer not connected to the "net" or some net is almost unthinkable.
• Connecting to a network requires an I/O device which will use DMA
13.2 Basic Terminologies
• Computer connected to a network is called a host
• The connection is made using a device called a
Network Interface Card or NIC
• What exactly is the
"network" shown in the diagram?
• As we shall see it may be one network or a composite of multiple networks
13.2 Basic Terminologies
• What is the Internet? Consider the postal system…
13.2 Basic Terminologies
• Now consider an email
13.2 Basic Terminologies
• Each cloud represented computers of an
Internet Service Provider (ISP)
• The ISP clouds are not directly connected
• Instead they are connected by routers, which are special purpose computer for this purpose
• How do these routers know where to send information? A universal system of addresses called Internet Protocol (or IP) Addresses is part of the answer
13.2 Basic Terminologies
• We showed connecting using a cable or phone network. Connections may also be made through Local Area Networks (LAN's)
• Other hardware devices
– hubs/repeaters
– bridges
– switches
– routers
13.3 Networking Software
• Need to address issues such as
– Arbitrary message size and physical limitations of network packets
– Out of order delivery of packets
– Packet loss in the network
– Bit errors in transmission
• Software is logically in a protocol stack configuration
13.3 Networking Software
• A protocol is the set of rules used to describe all of the hardware and (mostly) software operations used to send messages from
Processor A to Processor B
• A protocol describes the syntax, semantics and timing of communication between two devices
• Common practice is to attach headers/trailers to the actual payload forming a packet or frame.
• Good abstraction
• Simpler to understand than OGP
• Easier to design, analyze, implement and test
• Design concept is suites or families
• What do we mean by layers? Or a layered protocol? Consider the army…
General
Colonel
Captain
Sergeant
Private
General
Colonel
Captain
Sergeant
Private
13.3.2 Internet Protocol Stack
13.3.2 Internet Protocol Stack
• Application: HTTP, SMTP, FTP, etc. Shield applications using network from network details
• Transport: Breaks message into packets, handles things like out of order packets, may deal with reliability
• Network: Responsible for routing, does best effort delivery
• Link: Moves the packet using a protocol such as
Ethernet, Token Ring, and ATM
• Physical: Responsible for physically (electrically, optically, etc.) moving the bits of the packet from one node to the next.
13.3.2 Internet Protocol Stack
• Application: HTTP, SMTP, FTP, etc. Shield applications using network from network details
• Transport: Breaks message into packets, handles things like out of order packets, may deal with reliability
• Network: Responsible for routing, does best effort delivery
• Link: Moves the packet using a protocol such as
Ethernet, Token Ring, and ATM
• Physical: Responsible for physically (electrically, optically, etc.) moving the bits of the packet from one node to the next.
13.3.2 Internet Protocol Stack
Manufacturers group their protocol software together into a family and give it a nice name…
• Novell Corporation
• Banyan Systems
• Apple Computer
• Digital Equipment
• IBM
• “The Internet Biggie”
•
•
•
•
•
•
Netware
VINES
AppleTalk
DECNET
SNA
TCP/IP
13.3.2 Internet Protocol Stack
• Layer 5: Application-Sends application specific messages
• Layer 4: Transport-Sends segments
• Layer 3: Network-Sends packets
• Layer 2: Datalink-Sends frames
• Layer 1: Physical-Sends bits
13.3.2 Internet Protocol Stack
13.4 Transport Layer
• Assume
– send (destination-address, message)
– receive (source-address, message)
• Functionality of transport layer
– Support arbitrary message size at the application level
– Support in-order delivery of messages
– Shield the application from loss of messages
– Shield the application from bit errors in transmission.
13.4 Transport Layer
13.4.1 Stop and wait protocols
• Simple approach
– Sender sends a packet and waits for a positive acknowledgement, commonly referred to as an ACK.
– As soon as packet is received, recipient generates and sends an ACK for that packet. ACK should contain information for sender to discern unambiguously packet being acknowledged. Sequence number is unique signature of each packet. Thus, all that needs to be in ACK packet is sequence number of received packet.
– Sender waits for a period of time called timeout. If within this period, it does not hear an ACK, it re-transmits the packet. Similarly, the destination may re-transmit the ACK, if it receives the same packet again (an indication to the receiver that his ACK was lost en route)
13.4.1 Stop and wait protocols
13.4.1 Stop and wait protocols
13.4.1 Stop and wait protocols
RTT = Round Trip Time
13.4.2 Pipelined protocols
(a)
(b)
13.4.3 Reliable Pipelined Protocol
13.4.3 Reliable Pipelined Protocol
Increasing sequence numbers
Active window of sequence numbers
Packets sent and acknowledged
Packets that are in the active window that can be sent without waiting for any further ACKs
Packets sent but not yet acknowledged
Packets that cannot yet be sent since they are outside the active window
• Methods are needing to determine if packets are being received correctly
• Examples
– Checksums
– Error Correcting Codes (ECC)
Transport protocol
Features
TCP Connectionoriented; selfregulating; data flow as stream; supports windowing and
ACKs
UDP
Pros
Reliable; messages arrive in order; wellbehaved due to selfpolicing
Cons
Complexity in connection setup and tear-down; at a disadvantage when mixed with unregulated flows; no guarantees on delay or transmission rate
Connection-less; unregulated; message as datagram; no ACKs or windowing
Simplicity; no frills; especially suited for environments with low chance of packet loss and applications tolerant to packet loss;
Unreliable; message may arrive out of order; may contribute to network congestion; no guarantees on delay or transmission rate
Transport protocol
TCP
Application
Web browser
Instant messaging
Key requirement
Reliable messaging; in order arrival of messages
Reliable messaging; in order arrival of messages
Voice over IP
Electronic Mail
Electronic file transfer
Low latency
Reliable messaging
Reliable messaging; in order delivery
Video over Internet Low latency
TCP
Usually UDP
TCP
TCP
Usually UDP; may be TCP
TCP File download on
P2P networks
Network file service on LAN
Reliable messaging; in order arrival of messages
Reliable messaging; in order arrival of messages
TCP; or reliable messaging on top of UDP
TCP Remote terminal access
Reliable messaging; in order arrival of messages
13.5 Network Layer
• Why a separate layer?
– Multiple network connections to the host
– Multiple hops between source and destination
– Route is not static
• Transport/network layers interface
– Destination address and packet size
• Network layer functionality (host)
– Routing algorithms
– Provide a service model to the transport layer
– Pass it up to transport if destination reached
• Network layer functionality (Routers)
– Routing algorithms
13.5.1 Routing Algorithms
13.5.1 Routing Algorithms
3
4
5
Init
1
2
Iteration
Count
New node to which least-cost route known
Cost/
B route
A
AC
ACB
ACBD
ACBDE
ACBDEF
2/AB
2AB
2/AB
Cost/
C route
Cost/ route
D
Cost/ route
E F
Cost/ route
1/AC 4/AD 5/AE
1/AC
3/ACD 4/ACE 6/ACF
3/ACD 3/ABE 6/ACF
3/ACD
3/ABE
3ABE
5/ADF
4/ABEF
4/ABEF
13.5.1 Routing Algorithms
Destination
A
B
C
D
F
A
5(EA)
7(EAB)
6(EAC)
B
3(BA)
1(EB)
3(EBC)
C
4(ECA)
5(ECB)
3(EC)
8(EACD) 4(EBEFD) 5(ECD)
9(EABEF) 2(EBEF) 7(ECBEF)
F
5(EFDCA)
6(EFDCB
4(EFDC)
2(EFD)
1(EF)
DV Table for Node E
13.5.1 Routing on the Internet
• Network of networks
• Scale, dynamism
• Autonomous Systems (AS)
– Allows for evolution
– Gateway node for inter-AS routing
Details of the network layer in a gateway node
Gateway nodes use BGP
Nodes within AS use LS or DV
BGP Border Gateway Protocol
13.5.2 Internet Addressing
Telephone Number
Internet Protocol Address
24 bits
IP Network
8 bits
Device
13.5.2 Internet Addressing
• Consider this 32 bit IP Address
– (10000000 00111101 00010111 11011000)
2
• Convert each 8-bit octet into a decimal number and separate each with a decimal
– 128.61.23.216
• In this address the first 24 bits are network while the last 8 are the device
– 128.61.23.216/24
13.5.2 Internet Addressing
How many IP networks?
13.5.2 Internet Addressing
How many IP networks?
13.5.2 Internet Addressing
8 bits
Device
16 bits
IP Network
24 bits
IP Network
24 bits
Device
16 bits
Device
8 bits
Device
13.5.3 Network Service Model
13.5.3 Network Service Model
MessageSwitching
13.5.3 Network Service Model
Packet Switching
13.5.4 Network Layer Summary
Network
Terminology
Definition/Use
Circuit switching A network layer technology used in telephony. Reserves the network resources (link bandwidth in all the links from source to destination) for the
TDM
FDM duration of the call; no queuing or store-and-forward delays
Time division multiplexing, a technique for supporting multiple channels on a physical link used in telephony
Frequency division multiplexing, also a technique for supporting multiple channels on a physical link used in telephony
Packet switching A network layer technology used in wide area Internet. It supports best effort delivery of packets from source to destination without reserving any network resources en route.
Message switching Similar to packet switching but at the granularity of the whole message (at the transport level) instead of packets.
Switch/Router A device that supports the network layer functionality. It may simply be a computer with a number of network interfaces and adequate memory to serve as input and output buffers.
Input buffers These are buffers associated with each input link to a switch for assembling incoming packets.
Output buffers These are buffers associated with each outgoing link from a switch if in case the link is busy.
Routing table This is table that gives the next hop to be used by this switch for an incoming packet based on the destination address. The initial contents of the table as well as periodic updates are a result of routing algorithms in use by the network layer.
13.5.4 Network Layer Summary
Network
Terminology
Delays
Store and forward
Definition/Use
The delays experienced by packets in a packet-switched network
This delay is due to the waiting time for the packet to be fully formed in the input buffer before the switch can act on it.
Queuing This delay accounts for the waiting time experienced by a packet on either the input or the output buffer before it is finally sent out on an outgoing link.
Packet loss
Service Model
Virtual Circuit
(VC)
Datagram
This is due to the switch having to drop a packet due to either the input or the output buffer being full and is indicative of traffic congestion on specific routes of the network.
This is the contract between the network layer and the upper layers of the protocol stack. Both the datagram and virtual circuit models used in packetswitched networks provide best effort delivery of packets.
This model sets up a virtual circuit between the source and destination so that individual packets may simply use this number instead of the destination address. This also helps to simplify the routing decision a switch has to make on an incoming packet.
This model does not need any call setup or tear down. Each packet is independent of the others and the switch provides a best effort service model to deliver it to the ultimate destination using information in its routing table.
• Innovations in the link layer in the 70's led to making the internet a household term
• Link layer is responsible for acquiring physical medium for transmission, and sending packet over the physical medium to destination host.
• Broad Classification
– Random Access: Example-Ethernet
– Taking Turns: Example-Token Ring
• Portion of protocol that deals with gaining access to physical medium is called the Media Access
and Control (MAC) layer
13.6.1 Ethernet
Need to
Transmit
Listen for
Carrier
Medium
Idle
Transmit
Message
No collision
Collision
Detected
Abort
Transmission
Medium
Not Idle
Transmission
Complete
Terminologies
• Base band signaling
• Manchester encoding
• CSMA/CD
• CSMA/CA
– Hidden terminal problem
– RTS/CTS
Joe
• xBASEy
• Watch
– Triumph of the Nerds (PBS show)
Cindy Bala
13.6.1 Manchester Encoding
0 1 1 0 0 1 0 1 1
13.6.1 Ethernet
Hidden Terminal Problem
13.6.2 Token Ring
Link
Layer
Protocol
Features
Comparison
Pros Cons
Ethernet Member of random access protocol family; opportunistic broadcast using CSMA/CD;
Token ring exponential backoff on collision
Member of taking turns protocol family; Token needed to transmit
Simple to manage; works well in light load
Too many collisions under high load
Fair access to all competing stations; works well under heavy load
Unnecessary latency for token acquisition under light load
13.6.3 Other link layer protocols
• FDDI: Fiber Distributed Data Interface
– Fiber optics based
– High bandwidth backbone used to connect LAN's
• ATM: Asynchronous Transfer Mode
– Guarantees quality of service using link reservation and admission control to avoid congestion
– Connection oriented and can have transport layer implemented on top of it
– Used in MAN's and WAN's
• PPP: Point to Point
– Used by dial-up connections
– Widespead
13.6.3 Other link layer protocols
• Ethernet is really not just one protocol. As obsolescence approaches a new version is introduced and typically comes out on top
• FDDI was upstaged by Gigabit Ethernet
• ATM is likely to be upstaged by 10-Gigabit
Ethernet
• Both TCP and IP include error checking
– They don't have to be used together
• Most layers are in software but the link layer is often implemented in hardware
/* Packet Header Data Structure */ struct header_t { int destination_address; /* destination address */ int source_address; /* source address */ int num_packets; /* total number of */
/* packets in message */ int sequence_number; /* sequence number of */
/* this packet */
}; int packet_size; /* size of data */
/* contained in the */
/* packet */ int checksum; /* for integrity check of */
/* this packet */
/* Packet Data Structure */ struct packet_t { struct header_t header; /* packet header */ char *data; /* pointer to the memory */
/* buffer containing the data */
/* of size packet_size */
};
13.9 Message transmission time
P1 P2
S msg
Protocol stack
Protocol stack
R pkt1 pkt2
T w
… pktn
Network
T f
13.9 Message transmission time
Sender
Overhead
Time on the wire
Time of
Flight
Receiver
Overhead
13.10 Protocol Layering
• Layering is a structuring tool for combating complexity of protocol stack
• Allows partitioning total responsibility for message transmission and reception among various layers.
• Modularity allows integration of a new module at a particular layer with minimal changes to the other layers.
• It might appear that a potential downside to layering might be a performance penalty, as the message has to traverse several layers.
• Judicious definition of interfaces between layers avoids such inefficiencies.
5
4
3
7
6
2
1
13.10.1 OSI Model
Application
Presentation
Session
Transport
Network
Data Link
Physical
• Presentation layer subsumes user directed input/output functionalities that are common across different applications.
• Session layer maintains process-to-process communication details and provides a higher-level abstraction between an application and the transport layer (e.g. Unix socket).
5
4
3
7
6
2
1
Application
Presentation
Session
Transport
Network
Data Link
Physical
Telnet, FTP, etc.
TCP
IP
Ethernet Card
Physical
5
4
3
2
1
13.11 Networking Hardware
• Hub/Repeater
Hub
13.11 Networking Hardware
• More Hubs
Hub Hub
Hub Hub
Hub
13.11 Networking Hardware
• Bridge
1
2
HUB BRIDGE HUB
3
4
Collision domain Collision domain
13.11 Networking Hardware
• Switch
13.11 Networking Hardware
• VLAN
1
2
3
Switch
4
Switch
8
7
5
6
• NIC
13.11 Networking Hardware
MAC address
Header
Message
Payload
13.11 Networking Hardware
• Router
MAC address of router IP address of the destination Message
Payload for destination node
Payload for the router
13.11 Networking Hardware
Definition/Function Name of
Component
Host
NIC
Port
Collision domain
Repeater
A computer on the network; this is interchangeably referred to as node and station in computer networking parlance
Network Interface Card; interfaces a computer to the
LAN; corresponds to layer 2 (data link) of the OSI model
End-point on a repeater/hub/switch for connecting a computer; corresponds to layer 1 (physical) of the OSI model
Term used to signify the set of computers that can interfere with one another destructively during message transmission
Boosts the signal strength on an incoming port and faithfully reproduces the bit stream on an outgoing port; used in LANs and WANs; corresponds to layer 1
(physical) of the OSI model
13.11 Networking Hardware
Definition/Function Name of
Component
Hub Connects computers together to form a single collision domain, serving as a multi-port repeater; corresponds to layer 1 (physical) of the OSI model
Bridge
Switch
Router
VLAN
Connects independent collision domains, isolating them from one another; typically 2-4 ports; uses MAC addresses to direct the message on an incoming port to an outgoing port; corresponds to layer 1 (physical) of the OSI model
Similar functionality to a bridge but supports several ports (typically 4-
32); provides expanded capabilities for dynamically configuring and grouping computers connected to the switch fabric into VLANs; corresponds to layer 1 (physical) of the OSI model
Essentially a switch but has expanded capabilities to route a message from the LAN to the Internet; corresponds to layer 3 (network) of the OSI model
Virtual LAN; capabilities in modern switches allow grouping computers that are physically distributed and connected to different switches to form a LAN; VLANs make higher level network services such as broadcast and multicast in Internet subnets feasible independent of the physical location of the computers; corresponds to layer 1 (physical) of the OSI model
13.12 Network Programming
P1 P2
Socket
13.12.1 Unix Sockets
• Socket: create an endpoint of communication
• Bind: bind a socket to a name or an address
• Listen: listen for incoming connections on the socket
• Accept: accept an incoming connection request on a socket
• Connect: send a connection request to a name (or address) associated with a remote socket
• Recv: receive incoming data on a socket from a remote peer
• Send: send data to a remote peer via a socket
P1 foo (args)
RPC
P2 foo (args) return
Host 1 Host 2
User fopen
Unix file system
NFS client NFS server
RPC layer at client RPC layer at server
Network
Unix file system
13.15 Historical Perspective
•
•
•
•
• 1875 Telephone invented…analog system
• 1960 Telephone infrastructure goes digital
• 1940's Mainframe computers developed
• 1960's Transition
– Batch-oriented card-input/output
– CRT I/O and timesharing
Digital Data ?Missing Link?
Analog Data
Telephone
Infrastructure
Analog Data
?Missing Link?
Digital Data
Digital Data
MODEM
Analog Data
Telephone
Infrastructure
Analog Data
MODEM
Digital Data
• 1968/9 Carterphone decision allowed devices which were beneficial and not harmful to the network to be connected to the Public
Switched Telephone Network (PSTN).
Paved the way for computers to communicate using the telephone switching infrastructure.
13.15.2 Evolution of the Internet
• 1965 DoD DARPA plans first computer network
• 1969 ARPANET connects 4 computers using packet switched network
– Stanford Research Institute, UCLA, UC Santa
Barbara, and the University of Utah
– Networking luminary Leonard Kleinrock, is credited with successfully sending the first network “message” from UCLA to Stanford.
13.15.2 Evolution of the Internet
• “Router” in the network was called Interface Message
Processor (IMP), built by a company called BBN (which stands for Bolt, Beranak, and Newman Inc.).
– IMP system architecture required a careful balance of the hardware and software that would allow it to be used as a store-and-forward packet switch among these computers.
– IMP's used modems and leased telephone lines to connect to one another.
• 1971 The ARPANET grows to 23 hosts connecting universities and government research centers around the country.
13.15.2 Evolution of the Internet
1973 Robert Metcalfe and David Boggs invent the Ethernet networking system at the Xerox
Palo Alto Research Center.
13.15.2 Evolution of the Internet
• 1973 The ARPANET goes international
13.15.2 Evolution of the Internet
• 1975 Internet operations transferred to the
Defense Communications Agency
• 1978 Hayes Microcomputer Products releases the first mass-market modem, transmitting at 300 bps (0.3K).
• 1980 John Shoch at Xerox creates the first
“worm” program, with the capacity to travel through networks.
• 1981 Ungermann-Bass ships the first commercial
Ethernet network interface card.
13.15.2 Evolution of the Internet
• 1981 ARPANET has 213 hosts. A new host is added approximately once every 20 days.
• 1982 The term 'Internet' is used for the first time.
• 1983 TCP/IP becomes the universal language of the Internet. Developed by Vinton Cerf and
Robert Kahn
• 1984 CISCO founded
• Early 80's Unix and IBM OS included TCP/IP
13.15.2 Evolution of the Internet
• Late 90's Internet becomes household term
– Needed PC
– Needed "Killer app" i.e. WWW & browsers
13.15.3 PC and the arrival of LAN
• 1971 Intel introduces the first microprocessor
- the Intel 4004.
• 1971 The Kenbak-1, the first microcomputer, is introduced in Scientific American, selling a total of 40 units in 2 years.
Used 130 IC's with a 256 byte memory and 8-bit words, processed 1000 instructions per second, and cost $750.
13.15.3 PC and the arrival of LAN
• 1972 Intel launches the 8-bit 8008 - the first microprocessor which could handle both upper and lowercase characters.
• 1972 Xerox develops the Xerox Alto - the first computer to use a Graphic User Interface.
The Alto consists of four major parts: the graphics
display, the keyboard, the graphics mouse, and the disk storage/processor box. Each Alto is housed in a beautifully formed, textured beige metal cabinet that hints at its $32,000 price tag (1979US money). With the exception of the disk storage/processor box, everything is designed to sit on a desk or tabletop
13.15.3 PC and the arrival of LAN
• 1973 Robert Metcalfe and David Boggs invent the Ethernet networking system at the Xerox
Palo Alto Research Center.
13.15.3 PC and the arrival of LAN
• 1974 Intel introduces the 8080 microprocessor
– 5 times faster than the 8008.
– And the heart of the future Altair 8800.
• 1975 MITS markets the Altair 8800 - the first mass-market microcomputer, launching the
Personal Computer Revolution.
• 1975 Bill Gates and Paul Allen form the Microsoft company to create software for the new Altair
8800.
13.15.3 PC and the arrival of LAN
• 1976 Apple Computer is formed by Steve Jobs,
Steve Wozniak, and Ron Wayne, and launches the Apple Computer.
• 1977 Tandy Radio Shack ships its first personal computer - the TRS-80. It sells over 10,000 units, tripling expectations.
• 1977 Apple Computer launches the Apple II, which sets new standards for sophisticated personal computer systems.
13.15.3 PC and the arrival of LAN
• 1978 The C programming language is completed at AT&T Bell Laboratories, offering a new level of programming.
• 1978 Apple and Tandy ship PCs with 5.25" floppy disks, replacing cassette tape as the standard storage medium for PCs.
• 1978 Hayes Microcomputer Products releases the first mass-market modem, transmitting at
300 bps (0.3K).
13.15.3 PC and the arrival of LAN
• 1978 Intel ships the Intel 8086 microprocessor, with 29,000 transistors, and running at 4.77 megahertz.
• 1979 Personal Software creates VisiCalc for the Apple II, the first electronic spreadsheet program, selling over 100,000 copies.
• 1979 Intel develops the 8088 microprocessor, which would later become the heart of the
IBM PC.
13.15.3 PC and the arrival of LAN
• 1979 Motorola develops the Motorola 68000 microprocessor, offering a new level of processing power.
• 1979 Robert Metcalf founded 3COM
• 1980 Seagate Technology introduces the first microcomputer hard disk, capable of holding 5 megabytes of data.
• 1980 Philips introduces the first optical laser disk, with many times the storage capacity of floppy or hard disks.
13.15.3 PC and the arrival of LAN
• 1980 Xerox creates Smalltalk - the first objectoriented programming language.
• 1981 Ungermann-Bass ships the first commercial Ethernet network interface card.
• 1981 Xerox introduces the Xerox Star 8010, the first commercial Graphic User Interface computer, for $16,000-$17,000.
13.15.3 PC and the arrival of LAN
• 1981 Microsoft supplies IBM with PC-DOS
(which it would also sell as MS-DOS), the OS that would power the IBM PC.
• 1981 IBM brings to market the IBM PC, immediately establishing a new standard for the world of personal computers.
13.15.4 Evolution of LAN
• Thicknet
– Coaxial cable/Vampire taps
– 10base5 (10 Mbits/sec, baseband, 500 meters)
– 1979-1985
Thick Coax Segment
500 Meter Maximum
Ethernet
Interface
15 pin AUI Connector
MAU
AUI Cable
(50 meter max)
AMP
Thick
Coaxial
(Vampire)
Tap
MAU - Medium Access Unit
AUI - Attach Unit Interface Male "N" Connector
50 ohm terminator
13.15.4 Evolution of LAN
• Thinnet
– Coaxial cable/BNC connectors
– 10base2 (10 Mbits/sec, baseband, 200 meters)
– 1985-1993 10-Base-2 Coaxial Ethernet Cable with BNC terminations
Computer
Terminator
BNC "T"
Connector
Terminator
13.15.4 Evolution of LAN
• Fast Ethernet
– Move "ethernet" into the box
– 100baseT (T for twisted pair)
– RJ45 Connectors