梅庄

计算机网络-自顶向下方法【一】

Ch1-Introduction

2017-02-04 15:23:25 星期六

What is the Internet

hosts

hosts = end-systems,上面会running network apps
hosts大到服务器,小到PDA

fiber, copper, radio, satellite
transmission rate = bandwidth

routers

forward packets(数据块)

protocols

control sending, receiving of msgs
eg. TCP, IP,HTTP(浏览器),FTP(point-to-point),PPP

Intenet

network of networks
loosely hierarchical
public Internet versus
private intranet(使得建在不同地区的网络,看起来像建在同一个地区。)

Internet standards

RFC: Request for comments
IETF: Internet Engineering Task Force
IEEE

communication infrastructure

enable distributed applications: eg. web, email, sharing……

communication services provided to applications

connectionless(通信前不用建连线) eg. UDP,适合query, domain name server
connection-oriented(通信前要先建连线,就像打电话一样) eg. TCP

What is a protocol

all communication activity in Internet governed by protocols
protocols define

  • format
  • order
    order of messages sent and received among network entities
  • action
    action taken on the ttransmisssion/receipt of a message

    Network edge

    applications and hosts 比如PC,PDA, 手机

    end systems(hosts)

  • run application programs
  • eg. Web, email
  • at “edge of network”

    client/server model

    client提出需求,server回应
  • client host requests, receives service from alsways-on server
  • eg. Web browser/server; email client/server

    peer-peer model

  • mminimal (or no) use of dedicated servers eg.Gnutella KaZaA
    没有server了,避免
  1. server 负担过重
  2. 被track,不容易被跟踪,抓到

    connection-oriented service

    data transfer between end systems

    handshaking

    数据传输前,先建立连线
    setup(prepare for)data transfer ahead of time
  • Hello, Hello back human protocol
  • set up “state” in two communicating hosts

    TCP

    Transmission Control Protocol
  • Internet’s connection-oriented service

    reliable, in-order byte-stream data transfer

    Internet是一个不可靠的环境,可能发生丢包
    file transfer要求可靠,使命必达
    TCP内容要对,顺序也要对
  • loss:acknowledgements and retransmissions
    接收方要确认,否则要重发

    flow control

  • sender won’t overwhelm recevier
    recevier 要告诉sender可以送多快

    congestion control

    拥挤,堵塞
    如果网络拥挤,就放慢传送速度
    如何判断网络有多快?每次double越来越快地送packet,直到packet掉了。然后减半,再冲
  • senders “slow down sending rate” when network congested
    eg. 每一个link都有一个频宽,当要嵩的信息量大于频宽的时候会queue在router里面,慢慢送

    connectionless service

    data transfer between end systems
  • same as connection-oriented service

    UDP

    User Datagram Protocol
  • unreliable data transfer 不可靠,不管对方有没有收到
  • no flow control
  • no congestion control

    App’s using TCP

  • HTTP (Web), FTP (file transfer), Telnet (remote login)BBS, SMTP (email)

    App’s using UDP

    允许掉一点packet 影音啥的
  • streaming media网络音乐, teleconferencing, DNS, Internet telephony

    Network core

    mesh(网状) of interconnected routers
  • router
  • network of networks

    circuit switching(电路交换)预分配 no sharing

    在每一段link上都预留一段频宽
    End-end resources reserved for “call”
  • link bandwidth, switch capacity
  • dedicated resources(专属的资源):no sharing
  • circuit-like(guaranteed) performance
  • call setup required

    pieces

    network resources(e.g. bandwidth) divided into “pieces”
  • pieces allocated to calls
  • resource piece idle if not used by owning call(no sharing)
  • frequency division
  • time division
    FDMA
    TDMA

    packet switching(分组交换)按需 sharing

    packets

    each end-end data stream divided into packets
  • user A,Bpackets share network resources
  • each packet uses full link bandwidth
  • resources uses as needed (not reservation)

    contention

    resource contention:
  • aggregate resource demand can exceed amount available
  • congestion(拥挤): packets queue, wait for link use
  • store and forward(先存起来,再转送): packets move one hop at a time

    transmit over link
    wait turn at next link

比如,如果A不用,B就全部把它用完

Packet Switching vs Circuit Switching

Packet switching

  • allows more users ti use network
  • Great for bursty(短暂而大量的) data

    resource sharing
    simpler, no call setup

  • Excessive congestion: packet delay and loss

  • protocols needed for reliable data transfer, congestion control

How to provide circuit-like behavior
(Internet 不保证bandwidth)

  • bandwidth guarantees needed for audio/video apps

Packet Switching:Message Segmenting

  • L = 7.5 Mbits
  • R = 1.5 Mbps
  • dealy = 15 sec

Now,Break the msgs into 5000 packets

  • Each packet 1500 bits
  • 1 msec to transmit packet on one link
  • pipelinling each kink works in parallel (比如第二个packet开始送第一个L的时候,第一个packet可以开始送第二个L)
  • Delay reduced from 15 sec to 5.002 sec

Packet-switched networks:forwarding

Goal

move packets through routers from source to destination

  • we’ll study several path selection (i.e. routing) algorithms (chapter 4)
  • router之间平时会交换资料,了解周边网络长什么样,决定packet走哪一条路

    datagram network(类比于信)

  • destination address in packet determines next hop
  • routes may change during session(中间交流的过程)
  • analogy: driving, asking directions

    virtual circuit network(人工的方式走固定的路线)

  • each packet carries tag (virtual circuit ID)(贴标签), tag determines next hop
  • fixed path determined at call setup time, remains fixed thru call
  • routers maintain per-call state

    怎样通过分组交换网形成通路:
    因特网中,每个通过该网络传输的packet在它的首部包含了其目的地址。就像邮政地址一样,该地址是一种层次结构。当packet到达网络中的一台路由器时,该路由器检查packet的目的地址的一部分,并向相邻路由器转发该packet
    更特别的是,每台路由器具有一个转发表(forwarding table)用于将目的地址(或目的地址的一部分)映射到输出链路。当packet到达一台路由器时,该路由器检查目的地址,并用这个目的地址搜索转发表,以找到合适的输出链路。然后路由器将该packet导向输出链路。

Network Taxonomy

  • Datagram network is not either connection-oriented or connectionless.
  • Internet provides both connection-oriented (TCP) and
    connectionless services (UDP) to apps.

    Network access and physical media

    communication links

    Access networks and physical media

    keep in mind

  • bandwidth (bits per second) of access network?
  • shared or dedicated? (共享的还是专属的)

Residential access: point to point access

Dialup via modem

  • up to 54Kbps(often less)
  • Can’t surf and phone at same time: can’t be “always on”

    ADSL(asymmetric digital subscriber line) 对Frequency做分割

  • up to 1 Mbps upstream (today typically < 256 kbps)

  • up to 8 Mbps downstream (today typically < 1 Mbps)

  • FDM: 50 kHz - 1 MHz for downstream

4 kHz - 50 kHz for upstream
  0 kHz - 4 kHz for ordinary telephone

Residential access: cable modems

HFC: hybrid fiber coaxial cable(混合式)

  • asymmetric: up to 30Mbps downstream, 2 Mbps upstream
  • network of cable and fiber attaches homes to ISP router
  • shared access to router among home
  • issues: congestion(拥挤), dimensioning(规模)
  • deployment(部件): available via cable companies, e.g., MediaOne

    Company access: local area networks (区域网络,快很多)

    company/university local area network (LAN) connects end system to edge router
    Ethernet(有线网络里面普及率最高的)

  • mshared or dedicated link connects end system and router
  • 10 Mbs, 100Mbps, Gigabit Ethernet
    deployment: institutions, home LANs happening now

Wireless access networks

shared wireless access network connects end system to router
via base station also known as “access point”

  • wireless LANs:
    • 802.11b (WiFi): 11 Mbps
    • 802.11g: 54 Mbps
    • 802.11n: 108 Mbps
  • wider-area wireless access(远距离无线通信)
    • provided by telcom operator
    • 3G ~ 384 kbps
    • 4G ~ 2 Mbps以上
    • WAP/GPRS in Europe
    • 802.16a/e (WiMax):

Home networks

Typical home network components:

  • ADSL or cable modem
  • router/firewall/NAT
  • Ethernet
  • wireless access

    Physical Media

    -Bit: propagates between
    transmitter/receiver pairs
  • physical link: what lies between transmitter & receiver
    • guided media:有实体的材料,送电流
      signals propagate in solid media: copper, fiber, coax
    • unguided media:无线通信,送电磁波
      signals propagate freely, e.g., radio

      Twisted Pair (TP) 双绞线

      Coaxial cable:同轴电缆

  • two concentric copper conductors
  • bidirectional双向传输,送进去,电流往两边跑
  • baseband:一个channel,大家抢,办公室里面用(送data)
    • single channel on cable
    • legacy Ethernet
  • broadband:有线电视
    • multiple channels on cable
    • HFC

      Fiber optic cable:光纤(高速,不受电磁波干扰)

  • glass fiber carrying light pulses, each pulse a bit
  • high-speed operation:
    • high-speed point-to-point transmission (e.g., 5 Gps)
  • low error rate: repeaters(用来放大信号) spaced far apart ; immune to electromagnetic noise

    Physical media: radio

  • signal carried in electromagnetic spectrum
  • no physical “wire”
  • bidirectional
  • propagation environment effects:
    • reflection
    • obstruction by objects
    • interference
      Radio link types:
  • terrestrial microwave
  • LAN (e.g., Wifi)
  • wide-area (e.g., cellular) 3G,4G
  • satellite
    • delay 不方便互动(实时视频互动啥的)

Internet structure and ISPs

Internet structure: network of networks
两台电脑相连,经过很多ISP转接

Dealy&loss in packet-switched networks

How do loss and delay occur

packets queue in router buffers

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

4 sources of packet delay

  1. nodal processing(收到packet先检查是否正确)
  • check bit errors
  • determine output link
    2.queueing
  • time waiting at output link for transmission
  • depends on congestion level of router
  1. Transmission delay:
  • R = link bandwidth(bps)(把资料送上link的速度)
  • L = packet length(bits)
  • time to sen bits into link = L/R
  1. Propagation delay
  • d = length of physical link
  • s = propagation speed in medium(~2x10的8次方 m/sec) (传递在link上的速度)
  • propagation delay = d/s

1st bit of packet can arrive at 2nd router before packet is fully transmitted at 1st router!

dproc = processing delay

  • typically a few microsecs or less
    dqueue = queuing delay
  • depends on congestion
    dtrans = transmission delay
  • m= L/R, significant for low-speed links
    dprop = propagation delay
  • a few microsecs to hundreds of msecs

Queueing delay(revisited)

  • (L · a)/R ~ 0: average queueing delay small
  • (L · a)/R -> 1: delays become large
  • (L · a)/R > 1: more “work” arriving than can be serviced, average delay infinite! (infinite queue length) –- or packet loss! (finite queue length)

“Real”Internet delays and routes

  • Traceroute program: provides delay measurement from source to router along end-end Internet path towards destination.

Packet loss

  • queue (also known as buffer) preceding link in buffer has finite capacity
  • when packet arrives to full queue, packet is dropped (also known as lost)
  • lost packet may be retransmitted by previous node, by source end system, or not retransmitted at all

Protocol layers, service models

layers:each layer implements a service

每一个layer都是利用下层的service来实现某些功能,提供给上一层

  • via its own internal-layer actions
  • relying on services provided by layer below

    Internet protocol stack

    • application:supporting network applications
    • FTP, SMTP(mail), HTTP
  • transport:host-host data transfer
    • TCP(虽然网络不可靠,但要求提供给上层的服务是可靠的), UDP
  • network:routing of datagrams from source to destination(路径可能会经过很多点)(路径选择,将datagram送到destination, 可能会loss)
    • IP, routing protocols
  • link:data transfer between neighboring network elements(直接相连的两点,送两个连接的node,一边送到一边)
    • PPP,Ethernet
  • physical:bits “on the wire”

router:3层(physical, link, network) 看IP
switch:2层(physical link) 看MAC

each layer:

  • distributed “entities” implement layer functions at each node
  • entities perform actions, exchange messages with peers

    layering:physical communication

    Encapsulation

    上一层交给你的东西,对下一层来说,都是data,下一层加上自己的header或(头和尾)

    Hl:加MAC address(从哪来,到哪去)每经过一个link,更新一次
    Hn:加IP address(从哪来,到哪去)source IP 和 destination IP都不能换