学习笔记——网络架构与七层参考模式

计算机网络概论——网络基础

网络概览

Applications应用

通常人们如何通过什么途径认识网络?

  • 浏览器
  • 在线游戏
  • Email
  • 社交网络
  • 网络串流
  • 文件分享
  • 即时通讯

应用层协议

  • URL(Uniform resource locater)
  • HTTP(Hyper Text Transfer Protocol)
  • TCP(Transmission Control Protocol)

一次URL请求大概需要17次message?

  • 6个找到IP地址
  • 3次握手 TCP
  • 4次 HTTP
  • 4次 tearing down(取消)TCP

网络链接Network Connectivity

重要名词 Important terminologies

  • Link(设备连接 有线/无线)
  • Nodes(设备 电/手机)
  • Point-to-point(点对点)
  • Multiple access(两个以上的连接)
  • Switched Network(交换网络)
    • Circult Switched(线路交换)
    • Packet Switched(数据包交换)
  • Packet,message
  • Store-and-foward

Terminologies

  • Host(主机)
  • Switches(交换机)
  • Spanning tree(生成树协议)
  • internetwork(互联网)
  • Router/gateway(路由器)
  • Host-to-host connectivity(终端对终端连接)
  • Address
  • Routing(路由)
  • Unicats/broadcats/multicast(特定对象/广播/多个)
    • broadcats通常会被Router拦截
  • LAN(Local Area Networks 局域网)
  • MAN(Metropolitan Area Networks 城域网)
  • WAN(Wide Area Networks 广域网)

数据元是如何在互联网上被传输的?How datagrams are delivered in an Internet?

路由器之间会交换彼此网络状态,数据元会根据状态自动调整传输路线。

路由器可以将fragment(封包切分),当封包超过大小上限值的时候会被fragment。

每一个小的封包都具备完整的地址信息,可以被独立传送。

每一个小的封包都是独立的,所以每个小封包的路径可能会不一样,这样造成封包未必会按照顺序到达接受的Nodes

当封包过多次被Routing没有送达会被Router丢弃,就会存在丢包

合理的资源分配Cost-Effective Resource Sharing

  • resource资源:links and nodes
  • How to share a link?
    • Multiolexing(多个input共用一个links进行output)
    • De-multiplexing
FDM: Frequency Division Multiplexing 频道分割
TDM:Time-division Multiplexing 时间分割
Statistical Multiplexing 统计多工
  • Data is transmitted based on demand of each flow
  • FIFO先进先出, Round-Robin轮流,Priorities(Quality-of-Service(Qos)重要优先)

Logical Channels 逻辑频道

两个Host的连接,就叫做Logical Channel

Network Reliability 网络可靠性

  • 网络应该隐藏错误
  • Bits 丢失/错误
    • Bits error收到电场电磁波干扰,会出错(1,0错误)
    • 大量Bits错误,Burst errors。
    • 无法纠错会丢包
  • Packets are lost (Congestion)网络阻塞
  • Links and Node failures
  • Messages are delayed 延迟
  • Messages are delivered out-of-order 封包顺序错乱
  • Third parties eaves drop 第三次篡改

Network Architecture 网络体系结构

Protocols 协议

  • 定义横向通信规范
    • peer system
  • 上层协议需要下层提供服务
  • Building blocks of a network arch architecture
  • 每个协议有两个 interfaces
    • Service interface 为上层提供服务
    • Peer-to-Peer interface 对等网络

Protocols interface 协议接口

  • 横向
    • 格式
    • 流程
  • 纵向
    • 提供不同服务

Protocols 特点

  • Protocols Specification 协议规格
  • Interoperable 可以互通
  • IETF 制定协议

Protocol Architecture 协议结构

下层服务加值提供给上层协议服务

开放系统互连架构 OSA(Open Systems Interconnection) Architecture

结构分层

  • Application 应用层
  • Presentation 表现层/呈现层
  • Session 会话层
  • Transport 传输层
    • 负责分类不同服务
    • TCP/UTP
    • 只有两端host有
  • Network 网络层
    • 如何送给对方host
    • IP
  • Data Link 数据链路层
    • 如何传输数据给下一个Router(下一步)
  • Physical 物理层
    • 电缆,光纤,无线网络
    • 如何传输信号

Host如何和Router链接

Host => LAN(交换机) => Router

交换机只解析到Data Link链路层

链路层传输依靠物理层网卡位置信息

设备可以处理第几层,就是第几层的设备。

网络分层描述 Description of Layers

  • Physical Layer 物理层 如何在Link上传输

    • Coaxial cable 同轴电缆
      • Twisted pair 双绞线(搅在一起降低电磁干扰,8条线)
      • Optical Fiber 光纤 (不受电磁波干扰, 传输距离远)
      • Air space 电磁波 (wireless radio channel)
    • Different Signal Coding schems 不同编码
      • 发送和接受要求速率相同
      • 不同材料不同coding
    • Collects a streame of bits into a frame
    • How to transmit a frame to a directly connected host (destination)?
    • MAC(Media Access Control Protocol) 媒体访问控制
      • CSMA/CD(IEEE 802.3 Ethernet) 监听是否有正在传输
      • CSMA/CA(IEEE 802.11 Wireless LAN)
    • Layer 2 devlces 2层设备
    • Switches 交换机
    • Bridges
  • Network Layer 网络层 (如何将封包送到目的地主机)

    • IP to IP
    • How to transmit frames to a host via the Internet?
    • Handle routing among nodes within a packet-switched network
    • Data exchanged between
    • IP protocol不可靠服务
    • Router之间互通状态,
    • Routing protocols 为了动态选择路径,依靠的protocol。网络层最重要的内容
      • RIP 第一代协议,每30秒交换一次状态
      • OSPF 会寻找最短路径
      • BGP
    • Routing Tables 路由状态信息会存入Routing Tables
      • Routing Tables 自身是动态维护的,所以Table的信息是会变的
      • 收到封包,获得header,根据ip查询Routing Tables,传递给下一个Router
  • Transport Layer(提供不同主机processes之间的数据传输)

    • Implements a process-to-process channer
    • Unit of data exchanges in this layer is called a message
    • TCP(Transmission Control Protocol) - Reliable service 可靠服务
    • UCP(User Datagram Protocol) - Unreliable service 不可靠服务
  • Session Layer 会话层

    • Provides a name space that is used to tie together the potentially different transport streamsthat are part of a single application
    • 将不同的streames汇合为一起
  • Presentation Layer 表现层/呈现层

    • Concerned about the format of data exchanged between peers
    • 双方数据的格式标准
  • Application Layer 应用层

    • Standardize common type of exchanges
    • FTP/E-mail/DNS/HTTP/Browsers..

Host有7层,Router只有传输层以下三层,交换机只有物理层和链路层

实际上使用中并不严格按照7层来,可以跳过中间的层。

网络性能Network Performance

  • 频宽 Bandwidth
    • `Number of bits per second
  • 1Mbps: 1 * 10^6 bits/second
  • 速度越快,bit宽度越窄
  • 信号传递时间 + 传输资料的时间 + queuing time
    • 距离/速度
    • size大小/bandwidth频宽
  • 问题
    • 传输完,前导资料未到()
    • 传输为完后才能,前导资料已到(transmission time)

Delay X Bandwidth

  • Delay X Bandwidth = pipe full 的资料量
  • Bandwidth 和 latency 哪个重要
    • 大档案传输Bandwidth重要
    • 小资料latency更重要
    • latency的动态 jitter jitter越大越不稳定
  • 在停下来等对方回应之前能够传输最多的资料量

Throughput

  • RTT(Round Trip Time) dominates
  • Throughput = TransferSize/TransferTime