Networklayer

network layer

ip

transfer packets across links, addressing scale to large networks, routing protocol determines best paths across the network

IP

addressing mechanism: IP ADDRESS

  • No call setup at network layer
  • Packets are forwarded using address of the destination host
  • Packets are forwarded independently
  • Packets between same source-dest pair may take different paths
  • addressing
    • Each end-host has unique address
    • Forwarding table maps addresses to outgoing link

packet

  • data types: packet
    • On sending side, encapsulate segment into packets
    • Transmit the packet through the network
    • Network layer protocols exist on all routers (and hosts) for this purpose
    • On receiving side, deliver packets to transport layer

routing

  • Routing (Control Plane)
    • Involves all routers in a network
    • Creates a forwarding table to determine end-to-end paths taken by packets
    • Uses routing algorithms
  • Forwarding (Data Plane)
    • Move packets from router’s incoming interface to appropriate outgoing interface
    • An action in a single router
    • use forwarding table
  • Connection Setup: setup route states before sending packets

format

  • packet-handling operations at each router
    • forward with destination of address
    • forward independently
  • format
    • Version specifies IPv4
    • Header length (in 32-bit words)
    • Type of Service
    • Datagram length (Header + data) 20bytes+data
    • ID, Flags, Offset: Used for fragmentation at router
      • 1 DF Don't fragament
      • 2 MF more fragament
      • ID unique
    • Time-to-Live: Decremented at each router, Datagram dropped if zero
    • Protocol
      • Used by receiver to determine which transport protocol should get packet
    • Header checksum: Calculated only on header
      • Must be recomputed at each router: because ttl changes
    • use checksum because other protocol maybe involved
    • Data: Encapsulated TCP/UDP segment . ICMP data

ipv4

  • prefix notation: range of subnet 128.2.101.64/26
    • 6 bit free
    • example: 223.1.17.0/25 for /24 half, 223.1.17.128/26 for 64, 223.1.17.192/26 for 64
  • forwarding tables:
    • put prefix matching in destination prefix
    • match the leading bits of destination address to the longest listed prefix: longest matching prefix rule
  • CIDR classless interdomain routing

ICMP

  • single ip packet
    • no reliability
    • type/ code for echo/unreachable....
  • traceroute:
    • send nth udp segments has TTL of n
    • replies with ICMP time exceeded
  • is a network-layer protocol
    • Messages used for communication between routers and end-hosts
    • Messages sent in an IP packet - Just like a UDP segment
    • Messages require special processing by the IP layer software on each router

forwarding table

dijkstra

  • 每次更新新加入的点到未加入点的距离。每次从未加入点中选一个距离到已加入的set里最小的
    • short path tree
    • use dijkstra's to get routing table
    • O(n^2)

bellman-ford

  • Each node periodically sends its own distance vector estimates to neighbors
  • When a node x receives a new DV estimate from a neighbor v, uses B-F
  • Dx(y) ←minv{c(x,v)+Dv(y)} for each y ∈ N
  • The estimate Dx(y) converges to the actual dx(y) for minor, natural conditions

AS

  • A collection of physical networks with a unif
    • ISP, A Corporate network, A Campus networ
  • An AS may get an AS number (ASN)
    • ASNs represent units of routing policy
  • AS can have one/many/none ASN

BGP

  • function
    • Obtain network reachability information from neighboring AS
    • Propagate the reachability information to all routers internal to the AS
    • Determine “good” routes to subnets based on the reachability information and on AS policy
    • Advertise its existence to the rest of the Internet!
  • Uses path vector routing algorithm
  • Is heavily policy-based
  • Principles of Operation
    • A BGP session is established between routers (TCP)
    • exchange route UPDATE messages while connection is ALIVE
    • message
      • open: set up session
      • keepalive: confirms liveness to neighbor
      • notificatoin: signals an error before
      • UPDATE: Primary message to communicate information about routes
        • Announce or withdraw routes
        • Route = prefix + path attributes
    • eBGP runs between ASes
    • iBGP within AS

DHCP

  • Dynamic Host Configuration Protocol (IP)
  • information carried: a pool of IP addresses, a repository of network details
    • Provides these details upon request or by default
  • methods of communication : broadcast, Send to 255.255.255.255, UDP, port 67
  • leases : Used for dynamic allocation, Solution for control of when an address can be given to another client
    • Server allows use of addr for a set period, Client will need to reacquire permission before lease period expires(automatically)
  • message format:
    • type: discover, offer, request, ack, release
    • xid: Random transaction value (client 发,用于定位client)
    • chaddr: client hardware identifier
    • siaddr: server’s IP address
    • yiaddr: “your” address
    • options: lots of optional parameters
  • the discovery process
    • broadcast first, Multiple servers may respond
    • Client chooses whichever offer it wishes
    • DHCP Request / Ack is repeated to renew a lease

NAT

  • Network Address Translation
    • router manage a subnet
    • map one address space to another
  • benefits
    • Work-around to the impending exhaustion of IP addresses
    • Also allows for simple address allocation for the subnet
    • “Security”: internal network structure obscured
  • objections
    • IPv6 should be used to solve addressing problem
    • Objection 2: Violates end-to-end principle
    • Objection 3: Routers shouldn’t process packets higher than network layer
    • Objection 4: Using port numbers to address hosts
  • operations
    • hosts on private network use "non-routable" ip addresses (10.0.0.0/8 172.16.0.0/16 192.168.0.0/16)
    • these addresses are not unique, restricted to the private subnet
    • Router shows a single external IP address
    • Translation table maps external IP / port combinations to internal IP / port
    • rewrite all packets in each direction, changing based on translation table
      • Other fixes also needed to the packet
    • Packet Fix-up
      • Fix checksums
      • Router must do more than simply change address/port values
  • port forwarding.
    • NAT Address Translation Table
    • Translation table is normally initialized by internal traffic
    • Port forwarding specifies values ahead of time

tool

  • ping: send one packets and cal RTT
  • traceroute: will send 3 packets to each router it.

Backlinks