文章目录

  • 1. Introduction
    • 1.1 Different ways to access internet
    • 1.2 How to link with others
    • 1.3 Network Performance
    • 1.4 Protocol layers and Service models
      • 1.4.1 Internet protocol stack
      • 1.4.2 ISO/OSI reference model
    • 1.5 Network Security
  • 2. Application Layer
    • 2.1 Architectures for applications
      • 2.1.1 P2P Architecture
      • 2.1.2 Transport service requirements
      • 2.1.3 Internet transport protocols services
    • 2.2 Web application
      • 2.2.1 HTTP
      • 2.2.2 Non-persistent HTTP
      • 2.2.3 Persistent HTTP
      • 2.2.4 request & response
    • 2.2.5 Cookies
      • 2.2.6 Web Caches (Proxy server)
      • 2.2.5 Conditional GET
    • 2.3 E-mail
    • 2.4 DNS
      • 2.4.1 caching, updating records
      • 2.4.2 Protocol, messages
    • 2.5 P2P Applications
      • 2.5.1 File distribution time
      • 2.5.2 BitTorrent
    • 2.6 Socket Programming
      • 2.6.1 Socket programming with UDP
      • 2.6.1 Socket programming with TCP
  • 3. Transport Layer
    • 3.1 Transport layer services and protocols
    • 3.2 Multiplexing and demultiplexing
      • 3.2.1 Multiplexing
      • 3.2.2 Connectionless demultiplexing (UDP)
      • 3.2.3 Connection-oriented demux
    • 3.3 Connectionless transport: UDP
    • 3.4 Principles of reliable data transfer
      • 3.4.1 rdt1.0: reliable transfer over a reliable channel
      • 3.4.2 rdt2.0: channel with bit errors
      • 3.4.3 rdt2.1: sender, handles garbled ACK/NAKs
      • 3.4.4 rdt2.2: a NAK-free protocol
      • 3.4.5 rdt3.0: Channels with errors and loss
    • 3.5 Pipelined communication
      • 3.5.1 Go-Back-N
      • 3.5.2 Selective repeat
    • 3.6 TCP: connection-oriented transport
      • 3.6.1 TCP timeout value
      • 3.6.2 TCP reliable data transfer
      • 3.6.3 TCP fast retransmit
      • 3.6.4 TCP flow control
      • 3.6.5 Connection Management
    • 3.7 Principles of congestion control
  • 3.8 Roadmap
      • 3.8.1 TCP congestion control
    • 3.8.2 Explicit Congestion Notification (ECN)
      • 3.8.3 TCP throughput
  • 4. Network Layer
    • 4.1 Router
      • 4.1.1 Input port functions
      • 4.1.2 Destination-based forwarding
      • 4.1.3 Switching fabrics
      • 4.1.4 Input port queueing
      • 4.1.5 Output ports
    • 4.2 Internet Protocol
      • 4.2.1 IP fragmentation, reassembly
    • 4.3 IPv4 addressing
      • 4.3.1 Subnets
      • 4.3.2 Network Classes
      • 4.3.3 CIDR
      • 4.3.4 DHCP
      • 4.3.5 Hierarchical addressing
    • 4.4 NAT
    • 4.5 IPv6
      • 4.5.1 IPv6 datagram format:
      • 4.5.22 Transition from IPv4 to IPv6
    • 4.6 Generalized Forward and SDN

1. Introduction

1.1 Different ways to access internet

  • Dial-up Internet access (PSTN)
    Dial-up Internet access is a form of Internet access that uses the facilities of the public switched telephone network (PSTN) to establish a connection to an Internet service provider (ISP) by dialing a telephone number on a conventional telephone line. Dial-up connections use modems to decode audio signals into data to send to a router or computer, and to encode signals from the latter two devices to send to another modem.
    Bandwith: 56 Kbps
  • Digital subscriber line (DSL)
    Telephone line based: To central office DSL Access Multiplexer (DSLAM). Data over DSL phone line goes to Internet. Voice over DSL phone line goes to telephone net.
    Bandwidth:

    • Upstream transmission rate < 2.5 Mbps (typically < 1Mbps)
    • Downstream transmission rate < 24 Mbps (typically < 10Mbps)
    • ADSL = Asymmetric Digital Subscriber Line
  • cable network (TV net based)

    • Key technology:

      • Frequency division multiplexing (FDM): Different channels transmitted in different frequency bands.
      • Hybrid fiber coax (HFC): Asymmetric: 30Mbps downstream transmission rate, 2 Mbps upstream transmission rate.
  • fiber to the home (FTTH)

    FTTH using the passive optical networks (PONs) distribution architecture
  • home network
  • Enterprise access networks (Ethernet)

    Typically used in companies, universities, etc. 10Mbps, 100Mbps, 1Gbps, 10Gbps transmission rates. Today, end systems typically connect into Ethernet switch.
  • Wireless access networks
    Shared wireless access network connects end system to router. Via base station, aka “access point”.

DSL, Cable, FTTH 对比:

1.2 How to link with others

Network Core

  • Mesh of interconnected routers
  • Packet-switching:
    • Hosts break application-layer messages into small packets.
    • Packages are forwarded from one router to the next, across links on path from source to destination.

Two key network-core functions

Packet Switching: store and forward

drawback: queueing delay, loss

Circuit Switching

  • Dedicated resources: no sharing, circuit-like (guaranteed) performance.
  • Circuit segment is idle if not used by call (no sharing)
  • Commonly used in traditional telephone networks
  • FDM versus TDM:

Packet Switching VS Circuit Switching
Packet switching allows more users to use network.

  • PS adavantages:

    • resource sharing
    • simpler, no call setup
  • PS drawbacks:
    • excessive congestion possible: delay and loss. protocols needed for reliable data transfer, congestion control

关于 PS 和 CS

Network of networks

  • tier-1 ISPs, national & international coverage.
  • content provider network (e.g., Google): private network that connects it data centers to Internet, often bypassing tier-1, regional ISPs.

1.3 Network Performance

How do loss and delay occur
Packages queue in router buffers:

  • packet arrival rate to link exceeds output link capacity
  • packets queue, wait for turn

Four sources of packet delay
dnodal=dproc+dqueue+dtrans+dpropd_{nodal}=d_{proc}+d_{queue}+d_{trans}+d_{prop}dnodal​=dproc​+dqueue​+dtrans​+dprop​

  1. dprocd_{proc}dproc​: nodal processing

    • check bit errors
    • determine output link
    • typically < msec
  2. dqueued_{queue}dqueue​: queueing delay
    • time waiting at output link for transmissiong depends on congestion level of router.
    • L: packet length (bits)
    • R: link bandwidth (bps)
    • a: average packet arrival rate
      • LaR→0\frac{La}{R}\rightarrow0RLa​→0: avg. queueing delay small
      • LaR→1\frac{La}{R}\rightarrow1RLa​→1: avg. queueing delay large
      • LaR>1\frac{La}{R}>1RLa​>1: more work arriving than can be serviced, average delay infinite.
  3. dtransd_{trans}dtrans​: transmission delay
    • L: packet length (bits)
    • R: link bandwidth (bps)
    • dtrans=LRd_{trans}=\frac{L}{R}dtrans​=RL​
  4. dpropd_{prop}dprop​: propagation delay
    • d: length of physical link
    • s: propagation speed (2.9×1082.9\times10^82.9×108 m/sec)
    • dprop=dsd_{prop}=\frac{d}{s}dprop​=sd​

Throughput

Rate (bits/time unit) at which bits transferred between sender/receiver.

  • Instantaneous: rate at given point in time.
  • average: rate over longer period of time.
  • bottleneck: min⁡{Rc,Rs,R10}\min\{R_c, R_s, R_{10}\}min{Rc​,Rs​,R10​}

1.4 Protocol layers and Service models

1.4.1 Internet protocol stack

  • application: supporting network applications (FTP, SMTP, HTTP)
  • transport: process-process data transfer (TCP, UDP)
  • network: routing of datagrams from source to destination (IP, routing protocols)
  • link: data transfer between neighboring network elements (Ethernet, PPP, WiFi)
  • physical: bits

1.4.2 ISO/OSI reference model

ISO/OSI = ISO/Open System Interconnection

  • presentation: allow applications to interpret meaning of data, e.g., encryption, compression, machine-specific conventions
  • session: synchronization, checkpointing, recovery of data exchange.
  • Internet stack “missing” these layers. these services, if needed, must be implemented in application.

1.5 Network Security

  • Field of network security:

    • how bad guys can attack computer networks (Malware, DDoS, Packet sniffing)
    • how we can defend networks against attacks
    • how to design architectures that are immune to attacks
  • Internet not originally designed with (much) security in mind

2. Application Layer

2.1 Architectures for applications

2.1.1 P2P Architecture

  • No always-on server is needed.
  • End systems directly exchange data.
  • Peers request service from other peers, provide service in return to other peers. Self scalability: new peers bring new service capacity, as well as new service demands.
  • Peers are intermittently connected
  • Dynamic IP addresses

e.g. 为什么迅雷的下载速度如此之快?(快个勾芭啊
迅雷并非是一个传统的 HTTP/FTP 下载工具,它带有 P2P 功能。在世界上,P2P 可以说是最主流的下载方式,P2P 用户节点之间能进行数据传输的机制,解决了传统 HTTP 下载不堪重负的局限。迅雷的 P2P 机制令每个迅雷用户都变成了下载网络中的一个节点,之所以很多死链、冷门资源在迅雷中也有速度,这个 P2P 机制功不可没——就算没法从原始地址下载,也可以从其他节点中获取数据。

2.1.2 Transport service requirements


2.1.3 Internet transport protocols services

  • TCP service:

    • Reliable transport between sending and receiving process
    • Flow control: sender won’t overwhelm receiver
    • Congestion control: throttle sender when network overloaded.
    • Does not offer: timing, minimum throughput guarantee, security
    • Connection-oriented: setup required between client and server processes
  • UDP service:
    • Unreliable data transfer between sending and receiving process
    • Does not offer: reliability, flow control, congestion control, timing, throughput guarantee, security, or connection setup
    • 简单,轻量化

2.2 Web application

2.2.1 HTTP

  1. Client initiates TCP connection (creates socket) to server, port 80
  2. Server accepts TCP connection from client
  3. HTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server)
  4. TCP connection closed

HTTP is stateless, server maintains no information about past client requests.
Protocols that maintain state are cimplex, because:
5. past history (state) must be maintained.
6. if server / client crashes, their views of state may be inconsistent, must be reconciled.

2.2.2 Non-persistent HTTP

At most one object sent over TCP connection, then connection closed. Downloading multiple objects required multiple connections

RTT (Round Trip Time)
time for a small packet to travel from client to server and back round trip time.

HTTP response time

  • One RTT to initiate TCP connection.
  • One RTT for HTTP request and first few bytes of HTTP response to return
  • File transmission time

that is: Non-persistent HTTP response time=2∗RTT+file transmission time\text{Non-persistent HTTP response time}=2*\text{RTT}+\text{file transmission time}Non-persistent HTTP response time=2∗RTT+file transmission time

Non-persistent HTTP issues:

  • Requires 2 RTTs per object
  • OS overhead for each TCP connection
  • Browsers often open parallel TCP connections to fetch referenced objects.

2.2.3 Persistent HTTP

Multiple objects can be sent over single TCP connection between client, server

Persistent HTTP issues:

  • Server leaves connection open after sending response
  • Subsequent HTTP messages between same client/server sent over open connection
  • Client sends requests as soon as it encounters a referenced object
  • As little as one RTT for all the referenced objects.

2.2.4 request & response

request general format:

request method

  • Get
  • Post
  • Put
  • Create
  • Modify
  • Delete
  • Patch
  • Head
  • Trace
  • Options
  • Connect

response status codes
Status code appears in 1st line in server-to-client response message.

  • 200: OK
  • 301: Move permanently
  • 400: Bad Request
  • 404: Not Found
  • 505: HTTP Version Not Supported

2.2.5 Cookies

Four components:

  1. cookie header line of HTTP response message
  2. cookie header line in next HTTP request message
  3. cookie file kept on user’s host, managed by user’s browser
  4. back-end database at web site


What cookies can be used for:

  • Authorization
  • Shopping carts
  • Recommendations
  • User session state

Cookies and privacy:

  • Cookies permit sites to learn a lot about you
  • Remember to clean your cookies

2.2.6 Web Caches (Proxy server)

Goal: satisfy client request without involving origin server

  • User sets browser: Web accesses via cache
  • Browser sends all HTTP requests to cache
    • if object in cache: cache returns object
    • else cache requests object from origin server, then returns object to client
  • Cache acts as both client and server
  • Typically cache is installed by ISP (university, company, residential ISP)
  • Advantages:
    • reduce response time for client request
    • reduce traffic on an institution’s access link
    • Internet dense with caches: enables “poor” content providers to effectively deliver content (so too does P2P file sharing)

2.2.5 Conditional GET

Goal: don’t send object if cache has up-to-date cached version

2.3 E-mail


Send an email:

  • A user sends an email message and connects to an SMTP (Simple Mail Transfer Protocol) server as configured in her email client or Mail User Agent (MUA).
  • On the SMTP server, a Mail Transfer Agent (MTA) looks at the recipient address and looks up the domain part of the address to determine its destination.
  • After querying a Domain Name System (DNS) server for the name of the Mail eXchanger (MX) for the recipient’s domain name.
  • the SMTP server will send the message to that server via the SMTP protocol.
  • The receiving server will store the message and make it available to the recipient.

Email Protocols

  • Delivery

    • SMTP: Simple Mail Transfer Protocol
  • Receive
    • POP3: Post Office Protocol - Version 3
    • IMAP: Internet Message Access Protocol
    • Exchange ActiveSync: Microsoft’s protocol

2.4 DNS

Application-layer protocol:

  • C/S architecture
  • UDP (port 53)
  • hosts, name servers communicate to resolve names (name / address translation)

Distributed database implemented in hierarchy of many name servers

DNS services

  • Hostname to IP address translation(A)
  • Host aliasing(cname)
    • canonical, alias names
  • Mail server aliasing(mx)
  • Load distribution
  • Replicated Web servers: many IP addresses correspond to one name

Why not centralize DNS?

  • Single point of failure
  • Traffic volume
  • Distant centralized database
  • Maintenance

    root name servers
    Contacted by local name server that can not resolve name
  • Contacts authoritative name server if name mapping not known
  • Gets mapping
  • Returns mapping to local name server

TLD, authoritative servers

  • Top-level domain (TLD) servers:

    • Responsible for com, org, net, edu, aero, jobs, museums, and all Top-level country domains, e.g.: cn, uk, fr, ca, jp
    • Network Solutions maintains servers for .com TLD
    • Educause for .edu TLD (https://net.educause.edu/)
  • Authoritative DNS servers:
    • Organization’s own DNS server(s), providing authoritative hostname to IP mappings for organization’s named hosts
    • Can be maintained by organization or service provider

Local DNS name server
Does not strictly belong to hierarchy

Each ISP (residential ISP, company, university) has one (Also called “default name server”)

When host makes DNS query, query is sent to its local DNS server

  • Has local cache of recent name-to-address translation pairs (but may be out of date!)
  • Acts as proxy, forwards query into hierarchy

2.4.1 caching, updating records

Caching
Once (any) name server learns mapping, it caches mapping

  • Cache entries timeout (disappear) after some time (TTL)
  • TLD servers typically cached in local name servers

Cached entries may be out-of-date

  • If name host changes IP address, may not be known Internet-wide until all TTLs expire

Update/notify mechanisms proposed IETF standard (RFC 2136)

Records
distributed database storing resource records (RR)

RR format: (name, value, type, ttl)

  • type = A

    • name is hostname
    • value is IP address
  • type = NS
    • name is domain
    • value is hostname of authoritative name server for this domain
  • type = CNAME
    • name is alias name for some “canonical” name
    • value is canonical name
  • type = MX
    • value is name of mailserver associated with name

2.4.2 Protocol, messages

Query and reply messages, both with same message format

  • identification: 16 bit # for query, reply to query uses same #
  • flags:
    • query or reply
    • recursion desired
    • recursion available
    • reply is authoritative

2.5 P2P Applications

2.5.1 File distribution time

CS
server transmission: must sequentially send (upload) N file copies:

  • time to send one copy: Fus\frac F{u_s}us​F​
  • time to send N copies: NFus\frac{NF}{u_s}us​NF​

client: each client must download file copy

  • min client download rate: dmind_mindm​in
  • max client download time: Fdmin\frac F{d_{min}}dmin​F​

time to distribute F to N clients using CS approach: Dcs>max⁡{NFus,Fdmin}D_{cs}>\max\{\frac{NF}{u_s},\frac F{d_{min}}\}Dcs​>max{us​NF​,dmin​F​}

P2P
server transmission: must sequentially send (upload) at least one file copies:

  • time to send one copy: Fus\frac F{u_s}us​F​

client: each client must download file copy

  • min client download time: Fdmin\frac F{d_{min}}dmin​F​

clients: as total must download NF bits

  • max upload rate (limiting max download rate) is us+Σuiu_s+\Sigma u_ius​+Σui​

time to distribute F to N clients using P2P approach: DP2P>max⁡{Fus,Fdmin,NFus+Σui}D_{P2P}>\max\{\frac F{u_s},\frac F{d_{min}},\frac{NF}{u_s+\Sigma u_i}\}DP2P​>max{us​F​,dmin​F​,us​+Σui​NF​}

2.5.2 BitTorrent

Efficient content distribution system using file swarming.
The throughput increases with the number of downloaders via the efficient use of network bandwidth.

Peers in torrent send/receive file pieces(chunks)

  • Tracker: a central server keeping a list of all peers tracks peers participating in torrent
  • Torrent/Swarm: group of peers exchanging chunks of a file

To share a file or group of files, the initiator first creates a .torrent file, a small file that contains:

  • Metadata about the files to be shared

    • SHA-1 hashes of all pieces
    • A mapping of the pieces to files
    • Piece size
    • Length of the file
    • A tracker reference
  • Information about the tracker, the computer
  • that coordinates the file distribution

Downloaders first obtain a .torrent file, and then connect to the specified tracker, which tells them from which other peers to download the pieces of the file.

Peer joining torrent:

  • has no pieces, but will accumulate them over time from other peers
  • registers with tracker to get list of peers, connects to subset of peers (“neighbors”)

While downloading, peer uploads pieces to other peers.

Peer may change peers with whom it exchanges pieces

Peers may come and go

Once peer has entire file, it may (selfishly) leave or remain in torrent

  • As soon as a leecher has a complete piece, it can potentially share it with other downloaders.
  • Eventually each leecher becomes a seeder by obtaining all the pieces, and assembles the file. Verifies the “checksum” of the file.

Piece selection policy

  • The order in which pieces are selected by different peers is critical for good performance.
  • If an inefficient policy is used, then peers may end up in a situation where each has all identical set of easily available pieces, and none of the missing ones.
  • If the original seed is prematurely taken down, then the file cannot be completely downloaded
  • Rarest First (General rule)
    • Determine the pieces that are most rare among your peers, and download those first.
    • This ensures that the most commonly available pieces are left till the end to download.
  • Random First Piece (Special case, at the beginning)
    • Initially, a peer has nothing to trade
    • Important to get a complete piece ASAP
    • Select a random piece of the file and download it
  • Endgame Mode (Special case)
    • Near the end, missing pieces are requested from every peer containing them.
    • This ensures that a download is not prevented from completion due to a single peer with a slow transfer rate.
    • Some bandwidth is wasted, but in practice, this is not too much.

Internal Mechanism

  1. Choking Algorithm

    • Choking is a temporary refusal to upload. It is one of BT’s most powerful idea to deal with free riders (those who only download but never upload).

      • For avoiding free riders and avoiding network congestion
    • Tit-for-tat strategy is based on game-theoretic concepts.
  2. Optimistic Unchoking
    • A peer sends pieces to those four peers currently sending her chunks at highest rate
    • Every 30 secs: randomly select another peer, starts sending chunks
    • Reasons:
      • To discover currently unused connections that are better than the ones being used
      • To provide minimal service to new peers

Upload-Only mode
Once download is complete, a peer can only upload. The question is, which nodes to upload to?

Policy: Upload to those with the best upload rate. This ensures that pieces get replicated faster, and new seeders are created fast

2.6 Socket Programming

Goal: learn how to build client/server applications that communicate using sockets

Socket: door between application process and end-end transport protocol

Two socket types for two transport services:

  • UDP: unreliable datagram
  • TCP: reliable, byte stream-oriented

2.6.1 Socket programming with UDP

UDP: no “connection” between client & server

  • No handshaking before sending data
  • Sender explicitly attaches IP destination address and port # to each packet
  • Receiver extracts sender IP address and port # from received packet

Transmitted data may be lost or received out-of-order. UDP provides unreliable transfer of groups of bytes (“datagrams”) between client and server.


2.6.1 Socket programming with TCP

Client must contact server

  • Server process must first be running
  • Server must have created socket (door) that welcomes client’s contact

client contacts server by:

  • Creating TCP socket, specifying IP address, port number of server process
  • When client creates socket: client TCP establishes connection to server TCP

When contacted by client, server TCP creates new socket for server process to communicate with that particular client

  • Allows server to talk with multiple clients
  • Source port numbers used to distinguish clients (more in Chap 3)



3. Transport Layer


3.1 Transport layer services and protocols

Provide logical communication between app processes running on different hosts

  • Transport protocols run in end systems

    • Send side: breaks app msg into segments, passes to network layer
    • Rcv side: reassembles segments into messages, passes to app layer
  • Transport-layer protocols for Internet
    • Reliable, in-order delivery: TCP

      • Congestion control
      • Flow control
      • Connection setup
    • Unreliable, unordered delivery: UDP
      • No-frills extension of “best-effort” IP
  • Services not available:
    • Delay guarantees
    • Bandwidth guarantees


Transport layer vs. network layer
Network layer: logical communication between hosts
Transport layer: logical communication between processes

  • Relies on, enhances network layer services

3.2 Multiplexing and demultiplexing

3.2.1 Multiplexing

  • Host receives IP datagrams

    • Each datagram has source IP address, destination IP address
    • Each datagram carries one transport-layer segment
    • Each segment has source, destination port number
  • Host uses IP addresses & port numbers to direct segment to suitable socket

3.2.2 Connectionless demultiplexing (UDP)

  • Created socket has host-local port number
  • When creating datagram to send into UDP socket, must specify
    • Destination IP address
    • Destination port number
  • When host receives UDP segment
    • check destination port in segment
    • directs UDP segment to socket with that port
    • IP datagrams with same dest. port #, but different source IP addresses and/or source port numbers will be directed to same socket at dest

3.2.3 Connection-oriented demux

  • TCP socket identified by 4-tuple:

    • source IP address
    • source port number
    • dest IP address
    • dest port number
  • Demux: receiver uses all four values to direct segment to appropriate socket
  • Server host may support many simultaneous TCP sockets, each socket identified by its own 4-tuple
  • Web servers have different sockets for each connecting client, non-persistent HTTP will have different socket for each request

3.3 Connectionless transport: UDP

User Datagram Protocol

  • Feature:

    • Simple and straightforward, no connection state at sender, receiver
    • Best effort
    • No congestion control: UDP can blast away as fast as desired
    • Lost
    • Connectionless
      • No handshaking
      • Each UDP segment handled independently of others: Out-of-order to APP
    • Small header size
  • UDP use:
    • Streaming multimedia apps
    • DNS
  • Reliable transfer over UDP:
    • Add reliability at application layer
    • Application-specific error recovery!

UDP checksum

  • sender

    • Treat segment contents, including header fields, as sequence of 16-bit integers
    • Checksum: addition (one’s complement sum) of segment contents
    • Sender puts checksum value into UDP checksum field
  • receiver
    • Compute checksum of received segment
    • Check if computed checksum equals checksum field value:

3.4 Principles of reliable data transfer

3.4.1 rdt1.0: reliable transfer over a reliable channel

Underlying channel perfectly reliable

  • No bit errors
  • No loss of packets

Separate FSMs for sender, receiver:

  • Sender sends data into underlying channel
  • Receiver reads data from underlying channel

3.4.2 rdt2.0: channel with bit errors

Underlying channel may flip bits in packet. Checksum to detect bit errors.

recover from errors:

  • Acknowledgements (ACKs): receiver explicitly tells sender that pkt received OK
  • Negative acknowledgements (NAKs): receiver explicitly tells sender that pkt had errors
  • sender retransmits pkt on receipt of NAK

New mechanisms in rdt2.0 (beyond rdt1.0):

  • Error detection
  • Receiver feedback: control msgs (ACK,NAK) rcvr->sender

3.4.3 rdt2.1: sender, handles garbled ACK/NAKs

rdt2.0 Drawbacks: ACK/NAK corrupted

  • Sender doesn’t know what happened at receiver
  • Can’t just retransmit: possible duplicate
    • Sender retransmits current pkt if ACK/NAK corrupted
    • Sender adds sequence number to each pkt
    • Receiver discards (doesn’t deliver up) duplicate pkt

3.4.4 rdt2.2: a NAK-free protocol

  • Same functionality as rdt2.1, using ACKs only. instead of NAK, receiver sends ACK for last pkt received OK. receiver must explicitly include seq # of pkt being ACKed
  • Duplicate ACK at sender results in same action as NAK: retransmit current pkt

3.4.5 rdt3.0: Channels with errors and loss

Underlying channel can also lose packets (data, ACKs)

Approach: Sender waits “reasonable” amount of time for ACK

  • Retransmits if no ACK received in this time
  • If pkt (or ACK) just delayed (not lost):
    • Retransmission will be duplicate, but seq. #’s already handles this
    • Receiver must specify seq # of pkt being ACKed
  • Requires countdown timer


Performance of rdt3.0
rdt3.0 is correct, but performance stinks. Network protocol limits use of physical resources

3.5 Pipelined communication

Pipelining: sender allows multiple, “in-flight”, yet-to-be-acknowledged pkts

3.5.1 Go-Back-N

  • Sender can have up to N unacked packets in pipeline
  • Receiver only sends cumulative ack. Doesn’t ack packet if there’s a gap
  • Sender has timer for oldest unacked packet. When timer expires, retransmit all unacked packets.

Sender

  • k-bit seq # in pkt header
  • “window” of up to N, consecutive unacked pkts allowed
  • ACK(n): ACKs all pkts up to, including seq # n - “cumulative ACK”. May receive duplicate ACKs (see receiver)
  • Timer for oldest in-flight pkt
  • Timeout(n): retransmit packet n and all higher seq # pkts in window

  • ACK-only: always send ACK for correctly-received pkt with highest in-order seq #
    • may generate duplicate ACKs
    • need only remember expectedseqnum
  • out-of-order pkt:
    • discard (don’t buffer): no receiver buffering
    • re-ACK pkt with highest in-order seq #

3.5.2 Selective repeat

  • Sender can have up to N unacked packets in pipeline
  • Rcvr sends individual ack for each packet
  • Sender maintains timer for each unacked packet. When timer expires, retransmit only that unacked packet
  • buffers pkts, as needed, for eventual in-order delivery to upper layer. buffers pkts, as needed, for eventual in-order delivery to upper layer
  • Sender only resends pkts for which ACK not received. Sender only resends pkts for which ACK not received
  • Sender window. N consecutive seq #’s. limits seq #s of sent, unACKed pkts

Drawback
Receiver sees no difference in two scenarios:

ab 场景的区别在于 receiver 向 sender 发送 ACK 的时候有无 loss。b 场景中的 ACK 没有被 sender 接受(但 receiver 不知道),所以 sender 重新发送 pkt0,但是发送序列中本来就有两份 pkt0,所以 receiver 无法知道这是第二份 pkt0 还是重新发送的第一份 pkt0,这样就出现了问题。

3.6 TCP: connection-oriented transport

  • P2P: one sender, one receiver
  • Reliable, in-order byte stream: no “message boundaries”
  • Pipelined: TCP congestion and flow control set window size
  • Full duplex data: bi-directional data flow in same connection
  • Connection-oriented: handshaking (exchange of control msgs) inits sender, receiver state before data exchange
  • Flow controlled: sender will not overwhelm receiver

TCP segment structure

  • Sequence numbers: Byte stream “number” of first byte in segment’s data
  • Acknowledgements: Seq # of next byte expected from other side. Cumulative ACK

3.6.1 TCP timeout value

  • Longer than RTT, but RTT varies
  • Too short: premature timeout, unnecessary retransmissions
  • Too long: slow reaction to segment loss

EstimatedRTT=(1−α)∗EstimatedRTT+α∗SampleRTTEstimatedRTT=(1-\alpha)*EstimatedRTT+\alpha*SampleRTTEstimatedRTT=(1−α)∗EstimatedRTT+α∗SampleRTT
Typical value: α=0.125\alpha=0.125α=0.125

Timeout interval: EstimatedRTT plus “safety margin”. Large variation in EstimatedRTT -> larger safety margin

Estimate SampleRTT deviation from EstimatedRTT: DevRTT=(1−β)∗DevRTT+β∗∣SampleRTT−EstimatedRTT∣DevRTT=(1-\beta)*DevRTT+\beta*|SampleRTT-EstimatedRTT|DevRTT=(1−β)∗DevRTT+β∗∣SampleRTT−EstimatedRTT∣
Typical value: β=0.25\beta=0.25β=0.25

TimeoutInterval=EstimatedRTT+4∗DevRTTTimeoutInterval=EstimatedRTT+4*DevRTTTimeoutInterval=EstimatedRTT+4∗DevRTT

3.6.2 TCP reliable data transfer

  • TCP creates rdt service on top of IP’s unreliable service

    • pipelined segments
    • cumulative acks
    • single retransmission timer
  • Retransmissions triggered by:
    • timeout events
    • duplicate acks

TCP sender (simplified)

3.6.3 TCP fast retransmit

  • Time-out period often relatively long: Long delay before resending lost packet
  • Detect lost segments via duplicate ACKs.
    • Sender often sends many segments back-to-back
    • If segment is lost, there will likely be many duplicate ACKs.
    • if sender receives 3 ACKs for same data, resend unacked segment with smallest seq # (likely that unackedsegment lost, so don’t wait for timeout)

3.6.4 TCP flow control

Receiver controls sender, so sender won’t overflow Receiver’s buffer by transmitting too much, too fast

  • Receiver “advertises” free buffer space by including rwnd value in TCP header of receiver-to-sender segments

    • RcvBuffer size set via socket options (typical default is 4096 bytes)
    • many operating systems auto-adjust RcvBuffer
  • Sender limits amount of unacked (“inflight”) data to receiver’s rwnd value
  • Guarantees receive buffer will not overflow

3.6.5 Connection Management

Before exchanging data, sender/receiver “handshake”:

  • Agree to establish connection (each knowing the other willing to establish connection)

    • 2-way handshake:

    • 3-way handshake

  • Agree on connection parameters

closing a connection

  1. Client, server each close their side of connection (Send TCP segment with FIN bit = 1)
  2. Respond to received FIN with ACK. On receiving FIN, ACK can be combined with own FIN
  3. Simultaneous FIN exchanges can be handled

3.7 Principles of congestion control

Congestion:

  • Informally: “too many sources sending too much data too fast for network to handle”
  • Different from flow control
  • Manifestations:
    • lost packets (buffer overflow at routers)
    • long delays (queueing in router buffers)

Causes/costs of congestion: scenario 1

Causes/costs of congestion: scenario 2





costs of congestion:

  • More work (retrans) for given “goodput”
  • Unneeded retransmissions: link carries multiple copies of pkt (decreasing goodput)

Causes/costs of congestion: scenario 3


Approaches to congestion control

  • End-to-end congestion control

    • Network layer does not provide support for congestion control
    • Trans layer has to infer from network behavior
    • TCP will control the size of window
  • Network-assisted congestion control
    • Routers provide feedback to sender and/or receiver (a single one bit)

3.8 Roadmap

3.8.1 TCP congestion control

  • Strategy: additive increase multiplicative decrease (AIMD)
  • Approach: sender increases transmission rate (window size), probing for usable bandwidth, until loss occurs.
    • Additive increase: increase cwnd (congestion window) by 1 MSS (Maximum Segment Size) every RTT until loss detected.
    • Multiplicative decrease: cut cwnd in half after loss.



TCP Slow Start

  • When connection begins, increase rate exponentially until first loss event:

    • Initially cwnd = 1 MSS
    • Double cwnd every RTT
    • Done by incrementing cwnd for every ACK received
  • Summary: initial ratge is slow but ramps up exponentially fast

TCP: detecting, reacting to loss

  • Loss indicated by timeout:

    • cwnd set to 1 MSS
    • window then grows exponentially (as in slow start) to threshold, then grows linearly
  • Loss indicated by 3 duplicate ACKs: TCP RENO
    • Dup ACKs indicat network capable of delivering some segments
    • cwnd is cut in half window then grows linearly
  • TCP Tahoe always sets cwnd to 1 (timeout or 3 duplicate acks)

Implementation:

  • variable ssthresh
  • on loss event, ssthresh is set to 12\frac1221​ of cwnd just before loss event

3.8.2 Explicit Congestion Notification (ECN)

Network-assisted congestion control:

  • Two bits in IP header (ToS field) marked by network router to indicate congestion
  • Congestion indication carried to receiving host
  • Receiver (seeing congestion indication in IP datagram) sets ECE bit on reveiver-to-sender ACK segment to notify sender of congestion

3.8.3 TCP throughput


4. Network Layer

  • Transport segment from sending to receiving host
  • On sending side encapsulates segments into datagrams
  • On receiving side, delivers segments to transport layer
  • Network layer protocols in every host, router
  • Router examines header fields in all IP datagrams passing through it.

Two key network-layer functions

  • Forwarding: move packets from router’s input to appropriate router output.
  • Routing: determine route taken by packets from source to destination (Routing algorithms)

data plane

  • Local, per-router function
  • Determines how datagram arriving on router input port is forwarded to router output port.
  • Forwarding function

control plane

  • Network-wide logic
  • Determines how datagram is routed among routers along end-end path from source host to destination host
  • Two control-plane approaches:
    • traditional routing algorithms: implemented in routers.
    • software-defined networking (SDN): implemented in (remote) servers.

Pre-router control plane
A distinct (typically remote) controller interacts with local control agents (CAs)

4.1 Router

High-level view of generic router architecture:

4.1.1 Input port functions


4.1.2 Destination-based forwarding


Longest prefix matching

  • When looking forwarding table entry for given destination address, use longest address prefix that matches destination address.
  • Longest prefix matching: often performed using ternary content addressable memories (TCAMs)
    • Content addressable: present address to TCAM: retrieve address in one clock cycle, regardless of table size.
    • Cisco Catalyst: can up 1M routing table entries in TCAM

4.1.3 Switching fabrics

  • Transfer packet from input buffer to appropriate output buffer
  • Switching rate: rate at which packets can be transfer from inputs to outputs
    • Often measured as multiple of input/output line rate
    • N inputs: switching rate N times line rate desirable
  • Three types of switching fabrics
  • Switching via memory (first generation routers)
    • Traditional computers with switching under direct control of CPU
    • Packet copied to system’s memory
    • Speed limited by memory bandwidth (2 bus crossings per datagram)
  • Switching via a bus
    • Datagrams from input port memory to output memory via a shared bus
    • Bus contention: switching speed limited by bus bandwidth
    • Cisco 5600: 32 bus
  • Switching via interconnection network
    • Overcome bus bandwidth limitations
    • Banyan networks, crossbar, other interconnection nets initially developed to connect processors in multiprocessor
    • Advanced design: fragmenting datagram into fixed length cells, switch cells through the fabric
    • Cisco 12000: switches 60 Gbps through the interconnection network.

4.1.4 Input port queueing

  • Fabric slower than input ports combined, so queueing may occur at input queues (queueing delay and loss due to input buffer overflow)
  • Head-of-the-line (HOL) blocking: queued datagram at front of queue prevents others in queue from moving forward

4.1.5 Output ports


  • RFC 3439 rule of thumb: average buffering equal to “typical” RTTRTTRTT (say 250 msec) times link capacity CCC
  • Recent recommendation: with NNN flows, buffering equal toRTT⋅CN\frac{RTT\cdot C}{\sqrt N}N​RTT⋅C​

Scheduling mechanisms

  • Scheduling: choose next packet to send on link
  • FIFO scheduling: send in order of arrival to queue
    • Discard policy: if packet arrives to full queue

      • Tail drop: drop arriving packet
      • Priority: drop/remove on priority basis
      • Random: drop/remove randomly
  • Priority
    • send highest priority queued packet
    • Multiple classes, with different priorities. Class may depend on marking or other header info (IP source / dest, port numbers)
  • Round Robin (RR) scheduling
    • Multiple classes
    • Cyclically scan class queues, sending one complete packet from each class (if available)
  • Weighted Fair Queueing (WFQ)
    • Generalized Round Robin
    • Each class gets weighted amount of service in each cycle

4.2 Internet Protocol

Host, router network layer functions:

4.2.1 IP fragmentation, reassembly

Network links have MTU (max transfer size), largest possible link-level frame (Different link types, defferent MTUs)

Large IP datagram divided within net

  • One datagram becomes several datagrams
  • “Reassembled” only at final destination
  • IP header bits used to identify, order related fragments.

4.3 IPv4 addressing

IP address: 32-bit identifier for host, router interface
Interface: connection between host/router and physical link

  • Router’s typically have multiple interfaces
  • Host typically has one or two interfaces

IP addresses associated with each interface

4.3.1 Subnets

IP address, two parts:

  • Subnet part: high order bits
  • Host part: low order bits

What’s a subnet?
Device interfaces with same subnet part of IP address. Can physically reach each other without intervening router

Recipe
To determine the subnets, detach each interface from its host or router, creating islands of isolated networks. Each isolated network is called a subnet.

4.3.2 Network Classes

Classful addressing

  • The network portion of an IP address were constrained to be 8, 16, or 24 bits in length.
  • Subnets with 8-, 16-, and 24-bit subnet addresses were known as class A, B and C networks.
  • It became problematic
    • A class A (/8) subnet could accommodate only up to 28−2=2542^8 − 2 = 25428−2=254 hosts
    • A class B (/16) subnet supporting 216–2=655342^{16} – 2 = 65534216–2=65534 hosts, which is too large

4.3.3 CIDR

CIDR: Classless Inter Domain Routing

  • Subnet portion of address of arbitrary length
  • Address format: a.b.c.d/x, where x is # bits in subnet portion of address

4.3.4 DHCP

DHCP: Dynamic Host Configuration Protocol

Goal: allow host to dynamically obtain its IP address from network server when it joins network

  • Can renew its lease on address in use
  • Allows reuse of addresses (only hold address while connected/“on”)
  • Support for mobile users who want to join network (more shortly)

DHCP overview:

  1. host broadcasts “DHCP discover” msg [optional]
  2. DHCP server responds with “DHCP offer” msg [optional]
  3. host requests IP address: “DHCP request” msg
  4. DHCP server sends address: “DHCP ack” msg

DHCP can return more than just allocated IP address on subnet:

  • Address of first-hop router for client
  • Name and IP address of DNS sever
  • Network mask (indicating network versus host portion of address)

4.3.5 Hierarchical addressing

route aggregation
Hierarchical addressing allows efficient advertisement of routing information

The ability to use a single prefix to advertise multiple networks is often referred to as address aggregation or route aggregation.

more specific routes

4.4 NAT

NAT: network address translation

Motivation: local network uses just one IP address as far as outside world is concerned:

  • Range of addresses not needed from ISP: just one IP address for all devices
  • Can change addresses of devices in local network without notifying outside world
  • Can change ISP without changing addresses of devices in local network
  • Devices inside local net not explicitly addressable, visible by outside world (a security plus)

Implementation: NAT router must:

  • Remember (in NAT translation table) every (source IP address, port #) to (NAT IP address, new port #) translation pair
  • Outgoing datagrams: replace (source IP address, port #) of every outgoing datagram to (NAT IP address, new port #)
  • Incoming datagrams: replace (NAT IP address, new port #) in dest fields of every incoming datagram with corresponding (source IP address, port #) stored in NAT table.

16-bit port-number field: 60,000 simultaneous connections with a single LAN-side address.

NAT is controversial:

  • Routers should only process up to layer 3
  • Address shortage should be solved by IPv6
  • Violates end-to-end argument (NAT possibility must be taken into account by app designers, e.g., P2P applications)
  • NAT traversal: what if client wants to connect to server behind NAT?

4.5 IPv6

Initial motivation: 32-bit address space soon to be completely allocated.
Additional motivation:

  • Header format helps speed processing/forwarding
  • Header changes to facilitate Q&S

4.5.1 IPv6 datagram format:

Fixed-length 40 byte header. No fragmentation allowed.

  • Priority (Traffic Class): identify priority among datagrams in flow.
  • Flow Label: identify datagrams in same “flow”.
  • Next header: identify upper layer protocol for data.

Other changes from IPv4

  • Checksum: removed entirely to reduce processing time at each hop.
  • Options: allowed, but outside of header, indicated by “Next Header” field.
  • ICMPv6: new version of ICMP. Additional message types and Multicast group management functions.

4.5.22 Transition from IPv4 to IPv6

Not all routers can be upgraded simultaneously

  • No “flag days”
  • How will network operate with mixed IPv4 and IPv6 routers?

Tunneling: IPv6 datagram carried as payload in IPv4 datagram among IPv4 routers

4.6 Generalized Forward and SDN

  • Flow: defined by header fields
  • Generalized forwarding: simple packet-handling rules
    • Pattern: match values in packet header fields
    • Actions: for matched packet: drop, forward, modify, matched packet or send matched packet to controller
    • Priority: disambiguate overlapping patterns
    • Counters: #bytes and #packets

Flow table in a router (computed and distributed by controller) define router’s match + action rules

OpenFlow: Flow Table Entries

match+action: unifies different kinds of devices

  • Router

    • match: longest destination IP prefix
    • action: forward out a link
  • Switch
    • match: destination MAC address
    • action: forward or flood
  • Firewall
    • match: IP addresses and TCP/UDP port numbers
    • action: permit or deny
  • NAT
    • match: IP address and port
    • action: rewrite address and port

CAN201-Computer Network(1)相关推荐

  1. 计算机网络环境及应用系统的安装与调试(Computer network environment and application system installation and debugging)

    计算机网络环境及应用系统的安装与调试(Computer network environment and application system installation and debugging) W ...

  2. [Codeforces 555E]Case of Computer Network(Tarjan求边-双连通分量+树上差分)

    [Codeforces 555E]Case of Computer Network(Tarjan求边-双连通分量+树上差分) 题面 给出一个无向图,以及q条有向路径.问是否存在一种给边定向的方案,使得 ...

  3. Computer Network Homework3’ s hard question

    Computer Network Homework3' s hard question 1. Which kind of protocol does CSMA belong to? A. Random ...

  4. 南加利福尼亚大学计算机博士,斑马博士|南加州大学(USC) MSc Electronic Engineering (Computer Network)...

    原标题:斑马博士|南加州大学(USC) MSc Electronic Engineering (Computer Network) 斑马博士 (Dr. Zebra, Since 2010), 深受海内 ...

  5. 计算机网络技术的英语怎么说,计算机网络技术,Computer network technology,音标,读音,翻译,英文例句,英语词典...

    补充资料:计算机网络安全 计算机网络安全 computer network security lisuanii Wangluo QnquQn计算机网络安全(c.mputer.etw.rksecurit ...

  6. 计算机网络cdma编码实验,计算机网络CDMA练习题(Computer network CDMA exercises).doc...

    计算机网络CDMA练习题(Computer network CDMA exercises) 计算机网络CDMA练习题(Computer network CDMA exercises) The firs ...

  7. Advanced Computer Network Review(5)——COPE

    本文参考资料来自: 1.论文原文<XORs in The Air: Practical Wireless Network Coding>(SIGCOMM'06) 2.课程演示文稿 根据复习 ...

  8. 计算机网络技术专业的英文名称,计算机网络技术专业,computer network major,音标,读音,翻译,英文例句,英语词典...

    补充资料:计算机网络互连技术 计算机网络互连技术 computer inter-networking techniques 1 isuanli wQngluo huliQn iishu计算机网络互连技 ...

  9. 计算机网络Computer Network

    1.1 协议标准化的好处 应用程序通信需要协议,分为服务端程序和客户端程序(甲方乙方),是对等实体. 应用层协议:为了实现应用程序的功能,要定义的通信标准.(已经标准化了的多种应用层协议对应着多种应用 ...

  10. Casual Note of Computer Network

    20170605 本地环回地址(loopback): IPV4:127.0.0.1-127.255.255.254 IPV6:::1 (即 0000:0000:0000:0000:0000:0000: ...

最新文章

  1. Linux08-日志
  2. 领域驱动应对业务复杂度
  3. 哈希表(HASHTABLE)
  4. 个推异常值检测和实战应用
  5. Nodejs nmp 常用命令
  6. [Python]输入与输出
  7. Mysql之子父级查询
  8. 淘宝网图片存储系统架构
  9. 编程必备的最基本5种算法思想
  10. 基于opencv python 的网线线序识别(一)
  11. 上楼梯(递归和迭代的对比)
  12. 谷歌ai人工智能叫什么_Google DeepMind在全球使用AI的10种方式
  13. html 3D球状旋转标签云文字云效果
  14. 珊瑚海-一站式动态化布局框架
  15. Gatekeeper代码导读
  16. 计算机语言phal语言,[6.1]-基于接口查询语言的SDK包
  17. Spring笔记上(基于XML配置)
  18. python对erp系统有帮助吗_ERP系统的优点
  19. VIC Classic 驱动程序
  20. 【Office】excel当前日期,下月日期

热门文章

  1. FTP连接Linux时报cannot change directory错误的解决办法
  2. 激活层是每一层都有吗_每一个人的青春里,都有一段刻骨铭心的初恋,你还记得她吗?...
  3. 基于Java+SQL的汽车销售管理系统
  4. 航摄比例尺与成图比例尺
  5. 关于redis的冷热数据分离
  6. 微信小程序学习11:iconfont 网络字体图标使用(阿里巴巴)
  7. endnote 文献保留前三个作者
  8. NC63查询报错:没有定义查询所有pk的接口或者定义不规范
  9. Setup.msi和Setup.exe有什么不同
  10. 阿尔·里斯-市场营销的22条法则(22条商规)-15