What is Layering? Modular approach to network functionality The idea of divide and conquer Use abstraction to hide complexity. Example: TCP/IP, OSI, ? Link hardware (PHY, Internet interface) Host-to-host connectivity (internet) Application-to-application channels (Transport) Application
TCP/IP Layering Relatively simple Router Host Application Transport Network Link
Protocol Demultiplexing Multiple choices at each layer FTPHTTPTFTPNV TCPUDP IP NET 1 NET 2 NET n … TCP/UDPIP IPX Port Number Network Protocol Field Type Field
First: Network Interface or PHY Creating a link between nodes Link: path followed by bits Wired or wireless Broadcast or point-to-point (or both) Node: any device connected to a link Problems: How to connect them? Topology Sharing links How to address each machine? Addressing How to regulate accessing to the media? MAC (Media Access method or protocol) Collision!
PHY (cont.) Dealing with Transmission/Receiving bits. Encoding digital data, 0 & 1, on the signal Modulation and Demodulation Digital to Digital or Analog Framing Media Access Control Error Detection CRC, checksum Error Correction- Reliable data Transmission FEC- Forward Error Correction ARQ- Automatic Repeat Request, Stop & wait,..
Packet Transmission Modes Unicast Transmission to single specific receiver Broadcast Transmission to all network nodes Multicast Transmission to specific subset of nodes Anycast Transmission to one of a specific subset of nodes
روشهاي برقراري ارتباط دو ماشين در شبکه Circuit SwitchingMessage Switching Packet Switching / Cell Switching
Circuit Switching Establishing and adjusting the circuit (setup a connection) Data transmission (busy intermediate switches) Terminating the connection (releasing intermediate switches) Disadvantages Considerable time to establish a connection The impossibility of communicating with the two machines and intermediate switches by other machines when transmitter and receiver channels being busy by two machines
BCD A سوئيچينگ مداری Connection request Connection reply Data transmission disconect
Message Switching Digital data Permanent connection to each station with its own switching center Adding some information to the data before sending it into switching center by station central switch receive message completely and then select the appropriate output channel based on receiver address Advantage Non busy Faster ?!
Transmissi on delay Message Switching A B C Processing latency
Disadvantage Message length subject Need large memory in switches Retransmission of data on a bit fault Excessive delay on data transmission Volume of messages at once Store & forward vs. cut through
Packet Switching / Cell Switching Divided each messages into smaller fragments, Added some information to reconstruct the message at the receiver Decrease total delay Packets and cells have constant length and are small
Multiplexing 1 Mbps link; users require 0.1 Mbps when transmitting; users active only 10% of the time Packet switching: with 35 users, probability that >=10 are transmitting at the same time < 0.0017
Goals of MAC Protocols MAC Protocols arbitrate access to a common shared channel among a population of nodes Goals: 1. Fair among users 2. High efficiency 3. Low delay 4. Fault tolerant 5- Simple
MAC Protocols Centralized Access point in Wireless Distributed Token based Token Ring Token Bus Random access ALOHA CSMA, CSMA/CD CSMA/CA, etc.
MAC Protocols Partition the channel and give everybody a time/freq slot FDMA TDMA SDMA: (Space Division Multiple Access) CDMA: (Code Division Multiple Access) Reservation Based access or Centralized arbiter
Examples of MAC Protocols Packet-Switched Radio Network Aloha Carrier Sense Multiple Access/Collision Detection Ethernet (IEEE 802.3) Token Passing Token Ring (IEEE 802.5) Fiber Distributed Data Interface (FDDI) Simple Random Complex Deterministic Wireless
Flow Control Time Packet ACK Timeout Stop and Wait Simplest ARQ protocol Send a packet, stop and wait until acknowledgement arrives Use sequence number to recognize repeat SenderReceiver
Flow Control (cont.) How to Keep the Pipe Full? Send multiple packets Number of pkts in flight = window How large a window is needed Round trip delay * bandwidth = capacity of pipe Reliable, unordered delivery Several parallel stop & waits Send new packet after each ack After Nack Go back N Resent the Nacked packet only
Others about PHY MAC address Modulation Analog to Analog Analog to Digital Digital to Analog Digital to Digital Why Modulation?
Second: Internetwork A collection of interconnected networks Host: network endpoints (computer, PDA, switch, …) Router: node that connects networks Internet vs. internet Internetwork
Internetworking Communication between networks. Problems & Challenges Different Networking technologies (Heterogeneity). So many Networks (Scaling). Some terminologies: “internetworking” refer to an arbitrary collection of connected networks. “Internet” the global internetwork. “Network” either directly connected or switched network using any LAN technology such as Ethernet, Token ring, ATM, etc.
Goals Connect existing networks initially ARPANET and ARPA packet radio network Survivability - ensure communication service even in the presence of network and router failures Support multiple types of services Must accommodate a variety of networks Allow distributed management Allow host attachment with a low level of effort Allow resource accountability
Challenge Many differences between networks Address formats Performance – bandwidth/latency Packet size Loss rate/pattern handling Routing How to translate between various network technologies
IP Internet Concatenation of Networks or “networks of Networks”. “R” is routers and “H” is hosts. R2 R1 H4 H5 H3 H2 H1 Network 2 (Ethernet) Network 1 (Ethernet) H6 Network 3 (FDDI) Network 4 ( point-to-point) H7R3H8
Service Model Connectionless (datagram-based) Best-effort delivery (unreliable service) packets are lost. No recover from lost. packets are delivered out of order duplicate copies of a packet are delivered packets can be delayed for a long time Datagram format VersionHLen TOSLength IdentFlagsOffset TTL Protocol Checksum SourceAddr DestinationAddr Options (variable) Pad (variable) 0 4 816 1931 Data Contains all information for routing!
IP Address Classes (Some are Obsolete) Network IDHost ID Network IDHost ID 816 Class A 32 0 Class B 10 Class C 110 Multicast Addresses Class D 1110 Reserved for experiments Class E 1111 24
Original IP Route Lookup Address classes A: 0 | 7 bit network | 24 bit host (16M each) B: 10 | 14 bit network | 16 bit host (64K) C: 110 | 21 bit network | 8 bit host (254) We need to keep only network address, 2 21 entries. Address would specify prefix for forwarding table Simple lookup
CIDR Revisited Supernets Assign adjacent net addresses to same org Classless routing (CIDR) How does this help routing table? Combine routing table entries whenever all nodes with same prefix share same hop
Routing Forwarding tables at each router populated by routing protocols. Original Internet: manually updated Routing protocols update tables based on “cost” Exchange tables with neighbors or everyone Hierarchical routing
What is Routing? Univ. of TehranComputer Network44 R3 A B C R1 R2 R4D E F R5 F R3E D Next HopDestination D
What is Routing? R3 A B C R1 R2 R4D E F R5 F R3E D Next HopDestination D 16 32 41 Data Options (if any) Destination Address Source Address Header ChecksumProtocolTTL Fragment Offset Flags Fragment ID Total Packet LengthT.ServiceHLenVer 20 bytes
How do we set up Routing Tables? Graph theory to compute “shortest path” Switches = nodes Links = edges Delay, hops = cost Need to adapt to changes in topology
Factors Affecting Routing Routing algorithms view the network as a graph Problem: find the lowest cost path between two nodes Factors Static topology Dynamic load Policy 4 3 6 2 1 9 1 1 D A F E B C
Internet Routing Internet organized as a two level hierarchy First level – autonomous systems (AS’s) AS – region of network under a single administrative domain AS’s run an intra-domain routing protocols Distance Vector, e.g., Routing Information Protocol (RIP) Link State, e.g., Open Shortest Path First (OSPF) Between AS’s runs inter-domain routing protocols, e.g., Border Gateway Routing (BGP) De facto standard today, BGP-4
Example AS-1 AS-2 AS-3 Interior router BGP router
How To Find Nodes? internet Computer 1Computer 2
Naming Humans use readable host names E.g. www.srbiau.ac.ir Globally unique (can correspond to multiple hosts) Naming system translates to physical address E.g. DNS translates name to IP Address (e.g. 18.104.22.168) Address reflects location in network
Domain Name System What’s the IP address for www.ccieee.com? It is 22.214.171.124 DNS server address manually configured into OS Local DNS ServerComputer 1
Packet Routing/Delivery Each network technology has different local delivery methods Address resolution provides delivery information within network E.g., ARP maps IP addresses to Ethernet addresses Local, works only on a particular network Routing protocol provides path through an internetwork
Network:Address Resolution Protocol Ethernet Broadcast: who knows the Ethernet address for 126.96.36.199? Ethernet Broadcast: Yes, it is 08-00-2c-19-dc-45
Internetwork: Datagram Routing R R R R R H H H H R R H R Routers send packet to next closest point H: Hosts R: Routers
Third: Transport Layer First end-to-end layer End-to-end state May provide reliability, flow and congestion control
Why End-to-End Protocols? Underlying best-effort network drop messages re-orders messages delivers duplicate copies of a given message limits messages to some finite size delivers messages after an arbitrarily long delay multiple application processes on each host Different speed of sender and receiver (Flow control) Congestion in the network (Congestion controls) Initially, there was no end to end protocol.
User Datagram Protocol (UDP) Minimal Transport Service: Port addressing: for application multiplexing Error detection (Checksum): formerly optional Connectionless end-to-end datagram service No flow control. No error recovery (no acks) Used by SNMP, DNS, TFTP, RTP, RPC, etc Source Port Dest Port Check- sum Length 16 Size in bits16
TCP Communication abstraction: Connection oriented, Point to point Reliable Error Detection and correction Ordered Byte-stream Application writes bytes TCP sends segments Application reads bytes Full duplex, two way connection Flow and congestion controlled Protocol implemented entirely at the ends
What’s Different From Link Layers? Logical link vs. physical link Must establish connection Variable RTT (Round-Trip Time) May vary within a connection Reordering packets How long can packets live max segment lifetime Can’t expect endpoints to exactly match link Buffer space availability Packets in transmission, delay X bandwidth Transmission rate Don’t directly know transmission rate
TCP Header Source portDestination port Sequence number Acknowledgement Advertised windowHdrLen Flags 0 ChecksumUrgent pointer Options (variable) Data Flags: SYN FIN RESET PUSH URG ACK
TCP Flow Control TCP is a sliding window protocol For window size n, can send up to n bytes without receiving an acknowledgement When the data is acknowledged then the window slides forward Each packet advertises a window size Indicates number of bytes the receiver has space for Original TCP always sent entire window Congestion control now limits this
TCP Congestion Control Underlying design principle: packet conservation, Make load udaptable At equilibrium, inject packet into network only when one is removed Reaching equilibrium Slow start Eliminates spurious retransmissions Accurate RTO (recovery time objective) estimation Fast retransmit Adapting to resource availability Congestion avoidance
TCP Congestion Control Basics Keep a congestion window, cwnd Denotes how much network is able to absorb Sender’s maximum window: Min (advertised window, cwnd) Sender’s actual window: Max window - unacknowledged segments If we have large actual window, should we send data in one shot? No, use acks to clock sending new data
Self-clocking PrPr PbPb ArAr AbAb Receiver Sender AsAs
Slow Start How do we get this clocking behavior to start? Initialize cwnd = 1 Upon receipt of every ack, cwnd = cwnd + 1 Implications Window actually increases to W in RTT * log 2 (W) Can overshoot window and cause packet loss
Slow Start Example 1 One RTT One pkt time 0R 2 1R 3 4 2R 5 6 7 8 3R 9 10 11 12 13 14 15 1 23 4567
Congestion Window Time Congestion Window Slow start with each time out
Congestion Avoidance Loss implies congestion – why? Not necessarily true on all link types If loss occurs when cwnd = W Network can handle 0.5W ~ W segments Set cwnd to 0.5W (multiplicative decrease) Upon receiving ACK Increase cwnd by 1/cwnd Results in additive increase
Return to Slow Start If packet is lost we lose our self clocking as well Need to implement slow-start and congestion avoidance together When timeout occurs set ssthresh to 0.5w If cwnd < ssthresh, use slow start Else use congestion avoidance
Fast Retransmit Don’t wait for window to drain Resend a segment after 3 duplicate ACKs remember a duplicate ACK means that an out-of sequence segment was received Notes: duplicate ACKs due to packet reordering why reordering? window may be too small to get duplicate ACKs ACK 2 segment 1 cwnd = 1 cwnd = 2 segment 2 segment 3 ACK 4 cwnd = 4 segment 4 segment 5 segment 6 segment 7 ACK 3 3 duplicate ACKs ACK 4
Fast Recovery Each duplicate ack notifies sender that single packet has cleared network When < cwnd packets are outstanding Allow new packets out with each new duplicate acknowledgement Behavior Sender is idle for some time – waiting for ½ cwnd worth of dupacks Transmits at original rate after wait Ack clocking rate is same as before loss
Time Sequence No Sent for each dupack after W/2 dupacks arrive
Fourth : Application Demands Reliability Corruption Lost packets Flow and congestion control Fragmentation In-order delivery Etc…
What if the Data gets Corrupted? Internet GET windex.htmlGET index.html Solution: Add a checksum Problem: Data Corruption 0,996,7,8214,571,2,36 X
What if the Data gets Lost? Internet GET index.html Problem: Lost Data Internet GET index.html Solution: Timeout and Retransmit GET index.html
What if Network is Overloaded? Short bursts: buffer What if buffer overflows? Packets dropped and retransmitted Sender adjusts rate until load = resources Called “Congestion control” Problem: Network Overload Solution: Buffering and Congestion Control
What if the Data Doesn’t Fit? Problem: Packet size Solution: Fragment data across packets On Ethernet, max IP packet is 1.5kbytes Typical web page is 10kbytes GETindex.html GET index.html
What if the Data is Out of Order? Solution: Add Sequence Numbers Problem: Out of Order GETx.thindeml GET x.thindeml GET index.html ml4inde2x.th3GET1
Is Layering Harmful? Sometimes.. Layer N may duplicate lower level functionality (e.g., error recovery) Layers may need same info (timestamp, MTU) Strict adherence to layering may hurt performance
Performance Metrics Bandwidth (throughput) data transmitted per time unit link versus end-to-end notation KB = 2 10 bytes Mbps = 10 6 bits per second Latency (delay) time to send message from point A to point B one-way versus round-trip time (RTT) components Latency = Propagation + Transmit + Queuing Queuing time can be a dominant factor
Latency Latency ( Queuing Delay) Host A Host B R1 R2 R3 TRANSP 1 TRANSP 2 TRANSP 3 TRANSP 4 PROP 1 PROP 2 PROP 3 PROP 4 Q2Q2 The egress link might not be free, packets may be queued in a buffer. If the network is busy, packets might have to wait a long time. How can we determine the queuing delay?
Queues and Queuing Delay Cross traffic causes congestion and variable queuing delay.