Computer Networking 004 -- The Network Layer

本文详细介绍了路由器的工作原理,包括数据平面和控制平面的概念,输入端口和输出端口的功能,以及交换结构的运作方式。文中还解释了转发过程,如目的地基转发、最长前缀匹配等,并探讨了IP地址分配、子网划分以及NAT技术。

Overview

Data Plane

  • Local to one router, how to put a datagram from the input link to the output link

Control Plane

  • Across many routers, end to end view,  how to put a datagram from source to destination

Input Port & Output Port

  • Where link layer and physical layer (Ethernet, Optical Fiber, WiFi, etc,) are implemented
  • Where network layer is implemented

Input Port

  • Line termination function: physical layer (wire, cable, etc.) responsible for bit-level reception.
  • Link layer protocol: Bits assembled into link layer frames (eg. Ethernet Frames)
  • Network layer functions: Look up & Forwarding Functions, determining where the arriving packet will be going through switching fabric.

Input Port Queuing

  • Switching rate < Combined rate of input port transmission rates

  • Head of the line blocking: Packets from different input ports want to go to the same output port, all of those packet except for one have to want at the input port, which further blocks following packets

Output Port

Output Port Queuing

  • Packets arriving at the output port faster than the packets leaving output port
  • Congestive Packet Loss: output port buffer full, extra packets are dropped and lost
  • Drop Policy: Which packet to drop when buffer is full
    • Drop: Tail Drop (new packet comes in get dropped), Priority (old packet in buffer replaced by new packet)
    • Marking: Special Packet marked to forcast network congestion (ECN, RED) 
  • Scheduling Discipline: Which packet to deliver (in buffer) when the buffer is full.
    • FIFO: first come first scheduled
    • Priority: Higher priority packets get delivered fist (Traffic type, Source IP)
    • Round Robin: Prioritized packets are delivered in turn (High - Mid - Low - High)
    • Weighted Fair Queuing (WFQ): Prioritized Packets, RoundRobin Scheduling, give weighted bandwith to different classes. 

 (High & Low priority queues are delivered in FIFO manner) (Different priority levels are delivered in turns)

 

Switching Fabric

  • Responsibility: A component inside router moving packets from input to output port (which is determined by the input port matching function).
  • Controlled by Routing Processor (a regular CPU), which runs control plane functions and installs forwarding table at input ports
  • Switching rate: Max rate of packet-switching
  • Non-blocking Switch Fabric: Packets won't need much wait at input port to be forwarded to the other side, expensive
  • Blocking Switch Fabric: Packets occasionally need to wait at input port to be forwarded to the other side, less costly, cause input port queuing.

 

  • Control plane components are software running in slower timescale, Data plane components are hardware running in a faster timescale.

Types of Switching Fabrics

  • Memory switching

First Gen, CPU controlled, Ports are treated like I/O devices

  1. Packet get copied from input port buffers to memory
  2. CPU use the destination address, look-up forwarding table
  3. CPU delivers that packet to the right output port
  • Bus switching

No more memory involved, input port writes directly to output port buffer

Note: speed limited by bus bandwidth

  • Interconnection network switching (adopted in practice)

Use multistage switches -- nxn small switches connected to form a bigger switch

Parallel delivery -- fragment datagram gets devided into smaller cells, delivered through the swiches in parallel, and then reassembled at exit

Scalable -- Instead of using just 1 multistage switch, create a network of switching planes, so more parallelism, higher switching capcity

  (Multistage switch unit: four 2x2 switches connected with four 4x4 switches)

 (Cisco CRS router: 8 switching planes, 3-stage network per plane)

Forwarding

Destination-based Forwarding

  • Traditional
  • Based on destination IP

Forwarding Table

Destination Address are arranged in ranges and paired with different output ports (link interfaces).

Longest Prefix Matching

Destination Address are arranged by prefix and paired with different output ports (link interfaces).

  • For 32-bit Address, every bit to the left of the destination IP should match every bit of the prefix, and among the matched prefixes, pick the longest one
  • Carried out in hardware
  • TCAM: present address to TCAM, retrieve address in 1 clock cycle, fast look-up

Generalized Forwarding

  • Based on any set of header field values (eg. Forward packets from the same source but with different transport protocol to different output ports)

IPV4

Addressing

  • 32-bit, group in 8 bits segments, separated by a '.'
  • Subnet: a piece of the network that containing reachabel devices without passing through an intervening router
  • Subnet part address: all devices in a subnet has the same subnet part IP address
  • Host part address  

CIDR Notation

a.b.c.d/x -- x indicates the # bits in the subnet part of the address

CIDR = subnet (x bits)+ host (32-x bits)

Google: CIDR conversion table

In an organization, all devices share a common subnet part.

  • When a router outside the organization forwards a datagram to the orgainzation level router, only the leading x bits of the address need be considered

Datagram

  • Header Length: how many bytes are in the header, so host/router knows where the payload begins (20 bytes without options)
  • Length: Total length in bytes (header+payload) -- maxlength = 64k bytes
  • Type of Service: Identify datagram service type -- e.g. ECN (2 bits, router sets the ECN to indicate congestion), diffserv (remaining 6 bits)
  • TTL: time to live, decrement every time the datagram passes through a router, datagram dropped at router if this field = 0;
  • Upper Layer Protocol: identify TCP or UDP
  • Header Checksum: Computed through IP header, re-computed at each router
  • Source & Destination IP
  • Options: A datagram can have 0 or more options
  • Payload

DHCP

Host dynamically obtains IP address from network server when it "joins" network

  1. Host send request and recieve IP address from DHCP server
  2. Host gives up IP address when leaving the network (latter reused/given to another host)
  3. DHCP is co-located in the router, runs over UDP (port 67)

Protocol

  1. Client sends DHCP discover broadcasting for DHCP server (Source: No IP, Port 68; Broadcasting IP: 255.255.255.255, Broadcasting Port: 67)
  2. DHCP server replies DHCP offer containing valid IP address (Source: DHCP server IP, Port 67; Destination IP: 255.255.255.255, Port: 68; yiaddr: Client's new IP)
  3. Client sends DHCP request, confirm its choice from the DHCP offers
  4. DHCP server ACK the request, confirm the the request

Network IP allocation

  • ICANN is an organization that allocates addresses, manages DNS and assigns domain names

  • ISP obtains an IP address from ICANN and 

  • ISP divides its address space into subnets for each organization
  • ISP receives anything that has the same address subnet portion

NAT

 

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值