SlideShare a Scribd company logo
Computer Networks


                            Network Layer




Network Layer (2-89-90)                       4-1
Chapter 4 Outline

       4.1 Introduction and Network Service Models
       4.2 Routing Principles
       4.3 Hierarchical Routing
       4.4 Routing in the Internet
       4.5 The Internet (IP) Protocol
       4.6 What’s Inside a Router
       4.7 IPv6
       4.8 Multicast Routing
       4.9 Mobility



Network Layer (2-89-90)                              4-3
Network Layer Functions
                                    application
      transport packet from        transport
                                     network             network
                                                         data link
       sending to receiving hosts    data link
                                     physical            physical

      network layer protocols in
       every host, router

     three important functions:
      path determination: route
        taken by packets from source
        to dest. (Routing Algorithms)               application
                                                    transport
      forwarding: move packets                      network
                                                     data link
        from router’s input to                       physical

        appropriate router output
      call setup: some network
        architectures require router
        call setup along path before
        data flows
Network Layer (2-89-90)                                           4-4
Network Service Model

                Q: What service model for
                   “channel” transporting
                   packets from sender to        The most important
                   receiver?                     abstraction provided
                                                  by network layer:
                Services
                 guaranteed bandwidth?            virtual circuit
                 preservation of inter-packet           or
                  timing (no jitter)?                datagram?
                 loss-free delivery?
                 in-order delivery?
                 congestion feedback to
                  sender?


Network Layer (2-89-90)                                                 4-5
Virtual circuits

                 “source-to-destination path behaves much like
                                telephone circuit”
                    performance-wise
                    network actions along source-to-destination path


         call setup, teardown for each call before data can flow
         each packet carries VC identifier (not destination host ID)
         every router on source-destination path maintains “state”
          for each passing connection
                transport-layer connection only involved two end systems
           Link and router resources (bandwidth, buffers) may be
            allocated to VC (dedicated resources = predictable service)
                to get circuit-like performance.

Network Layer (2-89-90)                                                     4-6
VC implementation

         A VC consists of:
            1.    path from source to destination
            2.    VC numbers, one number for each link along path
            3.    entries in forwarding tables in routers along path


         Packet belonging to VC carries VC number (rather
          than destination address)

         VC number can be changed on each link.
                 New VC number comes from forwarding table



Network Layer (2-89-90)                                                4-7
Forwarding table
                           VC number
                                  12   a       22         32

                                   1       3
                                       2

               Interface number

                Routers maintain connection state information!

                           Forwarding table in router a
     Incoming interface    Incoming VC #       Outgoing interface   Outgoing VC #
          1                12                       3               22
          2                63                       1               18
          3                 7                       2               17
          1                97                       3               87
          …                …                        …                …
Network Layer (2-89-90)                                                         4-8
Virtual Circuits: Signaling Protocols


          used to setup, maintain teardown VC
          used in ATM, frame-relay, X.25
          not used in today’s Internet
                                           6. Receive data
                                                            application
                                           3. Accept call
                                                            transport
                                           2. Incoming call network
                                                              data link
                   5. Data flow begins                        physical
                   4. Call connected
       application 1. Initiate call
       transport
        network
        data link
        physical

Network Layer (2-89-90)                                                   4-9
Datagram networks: the Internet model

          no call setup at network layer
          routers: no state about end-to-end connections
               no network-level concept of “connection”
          packets forwarded using destination host address
               packets between same source-destination
             pair may take different paths                 2. Receive Data application
                                                                            transport
                                                                             network
                                                                             data link
                                                                             physical

       application        1. Send Data
       transport
        network
        data link
        physical

Network Layer (2-89-90)                                                              4-10
Network Layer Service Models:

                                                             Guarantees ?   Congestion
       Network                       Service
    Architecture                     Model      Bandwidth Loss Order Timing feedback

                    Internet         best effort none        no    no       no    no (inferred
                                                                                  via loss)
                               ATM   CBR        constant     yes   yes      yes   no
   UBR: Unspecified bit rate




                                                rate                              congestion
   ABR: Available bit rate
   CBR: Constant bit rate
   VBR: Variable bit rate




                               ATM   VBR        guaranteed   yes   yes      yes   no
                                                rate                              congestion
                               ATM   ABR        guaranteed   no    yes      no    yes
                                                minimum
                               ATM   UBR        none         no    yes      no    no
                Internet model being extended: Integrated services,
                 Differentiated Services
                   Chapter 6


Network Layer (2-89-90)                                                                     4-11
Datagram or VC Network: why?

      Internet (Datagram)               ATM (Virtual Circuit)
       data exchange among              evolved from telephony
        computers                        human conversation:
          “elastic” service, no strict     strict timing, reliability
           timing req.                       requirements
       “smart” end systems                 need for guaranteed
        (computers)                          service
          can adapt, perform            “dumb” end systems
           control, error recovery          telephones
          simple inside “network”,
                                            complexity inside
           complexity at “edge”
                                             network
       many link types
          different characteristics

          uniform service is
           difficult


Network Layer (2-89-90)                                                   4-17
Buffering in IP routers


                             Router   Internet       Router



                                                              Network
                                                               Network
                                                              Interface
                                                               Interface



        Buffer size                            Dropping packets
              Space for bursts of                   When?
              packets                               What?
              Latency
Network Layer (2-89-90)                                                    4-18
FIFO Queueing in the Router
                       (Drop Tail)



                                         Network
                                          Network
                                         Interface
                                          Interface


              Single queue maintained




Network Layer (2-89-90)                               4-19
FIFO Queueing in the Router
                       (Drop Tail)



                                       Network
                                        Network
                                       Interface
                                        Interface


            Single queue maintained
            Dequeue from head




Network Layer (2-89-90)                             4-20
FIFO Queueing in the Router
                       (Drop Tail)



                                       Network
                                        Network
                                       Interface
                                        Interface


            Single queue maintained
            Dequeue from head
            Enqueue at tail



Network Layer (2-89-90)                             4-21
FIFO Queueing in the Router
                       (Drop Tail)



                                       Network
                                        Network
                                       Interface
                                        Interface


            Single queue maintained
            Dequeue from head
            Enqueue at tail
            When full

Network Layer (2-89-90)                             4-22
FIFO Queueing in the Router
                       (Drop Tail)



                                               Network
                                                Network
                                               Interface
                                                Interface


            Single queue maintained
            Dequeue from head
            Enqueue at tail
            When full drop arriving packet (drop-tail)

Network Layer (2-89-90)                                     4-23
Slow Feedback from Drop Tail

         Feedback comes when buffer is completely full
               … even though the buffer has been filling for a while

         Plus, the filling buffer is increasing RTT
               … and the variance in the RTT

         Might be better to give early feedback
               Get one or two flows to slow down, not all of them
               Get these flows to slow down before it is too late




Network Layer (2-89-90)                                                 4-24
Queue Management


          Performance Degradation in current TCP
           Congestion Control
              Multiple packet loss
              Low link utilization
              Congestion collapse


          The role of the router (i.e., network)
              Control congestion effectively with a network
              Allocate bandwidth fairly




Network Layer (2-89-90)                                        4-25
Active Queue Management


      Goals:

         Better    congestion notification for responsive flows
            (i.e. TCP)

         Maintain        shorter queues

         Fairness        in drops (proportional)




Network Layer (2-89-90)                                            4-26
Random Early Detection (RED)

           Invented by Sally Floyd and Van Jacobson in the
            early 1990s, differs from the DECbit in two major
            ways

           Notification is implicit
                 just drop the packet (TCP will timeout)
                 could make explicit by marking the packet
           Early random drop
                 rather than wait for queue to become full, drop each
                  arriving packet with some drop probability whenever the
                  queue length exceeds some drop level



Network Layer (2-89-90)                                                     4-27
Random Early Detection (RED).


             Basic idea of RED
                  Router notices that the queue is getting build-up.
                  Randomly drops or marks arriving packets (before
                   queue gets full).
                  Packet drop signals a congestion to the source.

             Packet drop probability
                  Drop probability increases as queue length increases
                  If buffer is below some level, don’t drop anything
                  … otherwise, set drop probability as function of queue




Network Layer (2-89-90)                                                     4-28
RED Details
           Compute average queue length (Geometric Moving
            Average)
                                                                     n
               AvgLenn +1 = (1 − α ) × AvgLenn + α × SampleLenn = ∑ α × (1 − α ) n −i SampleLeni
                                                                    i =1


            0 < α < 1 (usually 0.002)
            SampleLen is queue length each time a packet arrives.


                   MaxThreshold
                      MaxTh                    MinTh
                                            MinThreshold




                          SampleLen
                                 AvgLen
Network Layer (2-89-90)                                                                            4-29
RED Details.


           On arrival of a packet:

                   calculate AvgLen
                           if AvgLen <= MinTh then
                                   enqueue arriving packet
                           if MinTh < AvgLen < MaxTh then
                                   calculate probability P
                                   drop arriving packet with probability P
                           if AvgLen => MaxTh then
                                   drop arriving packet



Network Layer (2-89-90)                                                      4-30
RED Details..

           Computing probability P
            if : min Th < AvgLen < max Th
                        max P × ( AvgLen − min Th )
             p AvgLen =
                               max Th − min Th
                         p AvgLen                       minTh        maxTh
            P=
                  1 − count × p AvgLen        1

                                             maxP
                                             p AvgLen
                                                                               AvgLen
                                                                AvgLen


                    count counts how long we've been in minTh < AvgLen < maxTh
                    since we last dropped a packet. i.e. drops are spaced out in
                    time, reducing likelihood of re-entering slow-start.


Network Layer (2-89-90)                                                                 4-31
RED Detail…

           Weighted Running Average Queue Length


                   Average Queue Length          Drop probability


              Max Queue Size
                                                            Forced drop
               Max Threshold
                                                            Probabilistic drops
                Min Threshold
                                                            No drops
                                          Time




Network Layer (2-89-90)                                                           4-32
Properties of RED

         Drops packets before queue is full
               In the hope of reducing the rates of some flows

         Drops packet in proportion to each flow’s rate
               High-rate flows have more packets
               … and, hence, a higher chance of being selected

         Drops are spaced out in time
               Which should help desynchronize the TCP senders

         Tolerant of burstiness in the traffic
               By basing the decisions on average queue length
Network Layer (2-89-90)                                           4-33
Tuning RED

         MaxP is typically set to 0.02, meaning that when the average
          queue size is halfway between the two thresholds, the gateway
          drops roughly one out of 100 packets.

         If traffic is bursty, then MinThreshold should be sufficiently
          large to allow link utilization to be maintained at an acceptably
          high level.

         Difference between two thresholds should be larger than the
          typical increase in the calculated average queue length in one
          RTT;
          setting MaxThreshold to twice MinThreshold is reasonable for
          traffic on today’s Internet.



Network Layer (2-89-90)                                    34                 4-34
Problems With RED

         Hard to get the tunable parameters just right
               How early to start dropping packets?
               What slope for the increase in drop probability?
               What time scale for averaging the queue length?
         Sometimes RED helps but sometimes not
               If the parameters aren’t set right, RED doesn’t help
               And it is hard to know how to set the parameters
         RED is implemented in practice
               But, often not used due to the challenges of tuning right
         Many variations
               With cute names like “Blue” and “FRED”…


Network Layer (2-89-90)                                                     4-35
Explicit Congestion Notification

         Early dropping of packets
               Good: gives early feedback
               Bad: has to drop the packet to give the feedback

         Explicit Congestion Notification
               Router marks the packet with an ECN bit
               … and sending host interprets as a sign of congestion
         Surmounting the challenges
               Must be supported by the end hosts and the routers
               Requires two bits in the IP header (one for the ECN
                mark, and one to indicate the ECN capability)
               Solution: borrow two of the Type-Of-Service bits in the
                IPv4 packet header
Network Layer (2-89-90)                                                   4-36
Chapter 4 Outline

       4.1 Introduction and Network Service Models
       4.2 Routing Principles
               Distance vector routing
               Link state routing
       4.3 Hierarchical Routing
       4.4 Routing in the Internet
       4.5 The Internet (IP) Protocol
       4.6 What’s Inside a Router
       4.7 IPv6
       4.8 Multicast Routing
       4.9 Mobility

Network Layer (2-89-90)                              4-37
The Problem
                “A”                          “B”




                          R


           How does R choose a
           next-hop on the path
           towards host B?



Network Layer (2-89-90)                     CS244a Handout 5   4-38
Interplay between routing, forwarding

                                   routing algorithm


                                local forwarding table
                            dest. net. addr. Output port
                                 65/8        3
                                 128.9/16    2
                                 128.9.16/20 2
                                 128.9.19/24 1




          dest. IP addr. in arriving
          packet’s header
                           128.9.16.14
                                                   1

                                                 3 2




Network Layer (2-89-90)                                    4-39
Graph abstraction


                                                                       5
                                                                            3       w
                                                                        v               5
                                                                   2
                                                           u            2           1       z
                                                                                3
                                                               1                        2
            Graph: G = (N,E)                                           x            y
                                                                            1
            N = set of routers = { u, v, w, x, y, z }

            E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) }


         Remark: Graph abstraction is useful in other network contexts

         Example: P2P, where N is set of peers and E is set of TCP connections


Network Layer (2-89-90)                                                                         4-40
Graph abstraction: costs

         c(x,x’) = cost of link (x,x’)
                                                                     5
         e.g., c(w,z) = 5                                            v
                                                                          3       w
                                                                 2                    5
         cost could always be 1, or                     u            2           1       z
          inversely related to                               1
                                                                              3
                                                                                      2
          bandwidth, or inversely                                    x
                                                                          1
                                                                                  y
          related to congestion

              Cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp)


                   Question: What’s the least-cost path between u and z ?

                   Routing algorithm: algorithm that finds least-cost path


Network Layer (2-89-90)                                                                       4-41
Routing
          Routing protocol
        Goal: determine “good” path                   5            4
        (sequence of routers) thru                                     3       C
                                                              B
       network from source to dest.                       2                        5
                                                 A                     3   1
      Graph abstraction for                                   23                       F
        routing algorithms:                           1                            2
       graph nodes are routers                               D            E
                                                                       1
       graph edges are physical
        links                                    Abstract model of a network
       link cost:
       Delay (Make high speed links            “good” path:
        attractive, but closeness counts),
       $ cost,
                                                     typically means minimum
       Inverse of bandwidth,                         cost path
       Path utilization (congestion level
                                                     other definitions possible
        & queue length),
       Stability (Is path up or down?)
Network Layer (2-89-90)                                                                    4-42
Technique 1: Naïve Approach
             Flood!: Routers forward packets to all ports except
                               the input port.

                                    R


         Advantages:
             Simple.
             Every destination in the network is reachable.
         Disadvantages:
             Some routers receive a packet multiple times.
             Packets can go round in loops forever.
             Inefficient.


Network Layer (2-89-90)                            CS244a Handout 5   4-43
Spanning Trees

         Objective: Find the lowest cost route from each of
                           (R1, …, R7) to R8.

       “A”

                                     R2               R4                R6
                              1                   1            4
          R1
                          2                   2            3
                                                               R7          2
                              R3      R5              2
                                                                    3
                                                                               R8
                                          4
                                                                                       “B”


Network Layer (2-89-90)                                             CS244a Handout 5    4-44
A Spanning Tree

                              1                  1              4
          R1
                          2                  2              3
                                                                R7            2
                              R3        R5            2
                                                                     3
                                                                                  R8
                                         4


           The solution is a spanning tree with R8 as the root of the tree.
           Tree: There are no loops.
           Spanning: All nodes included.
           We’ll see two algorithms that build spanning trees automatically:
                The distributed Bellman-Ford algorithm ( Distance Vector ).

                  Dijkstra’s shortest path first algorithm ( Link State ).
Network Layer (2-89-90)                                              CS244a Handout 5   4-45
Routing protocol requirements
           Minimizing route table spec: Node memory related issue
           Minimizing control message: Overhead in bandwidth
           Robustness
                Retain its correctness in dynamic situation. Should be free
                 of loops, black holes.
           Using optimal paths (optimality)
                Choosing the best path ( in terms of some metrics)
           Stability: Free of oscillations
           Fairness
                Should take the complete topology while computing the
                 path
           Efficiency: Convergence time
           Correctness


Network Layer (2-89-90)                                                        4-46
Design Choices - 1
           Centralized versus Distributed routing
                 Centralized: One node collects information (node has
                  complete topology and link cost) and then installs the
                  routing information in all nodes (Link state algorithm).

                 Distributed: All nodes co-operate to form the rooting
                  table.

           Source based versus hop by hop
                 Source routing: data packet contains the hop list.

                 Hop by hop: Each hop takes decision based on its routing
                  table about the next hop (Distance vector algorithm)



Network Layer (2-89-90)                                                      4-47
Design Choices - 2
            Stochastic versus deterministic
                 Stochastic: Routing table contains multiple path
                  information. Next hop is chosen randomly.
                  Advantage: load distribution.
                 Deterministic: always follow same path.
                 Single versus multiple path
                         Router can use multiple paths for a single destination


            Dynamic versus Static
                 Dynamic: Routing dependent on the current network
                  state routes update more quickly
                   
                     periodic update
                   
                     in response to link cost changes
                    Static: Routes update slowly over time.


Network Layer (2-89-90)                                                            4-48
Assumptions About Router

         Router knows address of each neighbor.
         Router can communicate the information with its
          neighbors.
         Router tells its neighbors its best idea of distance
          to every other router in the network.
         Router receives these distance vectors from its
          neighbors.
         Router updates its notion of best path to each
          destination, and the next hop for this destination.



Network Layer (2-89-90)                                          4-49
Distance Table Inside Router
         Distance Table data structure
                        row for each possible destination.
                        column for each directly-attached neighbor router.
                        example: in router x, for dest. y via neighbor z.
                        This table is made based on exchanged information about
                         distance metric and calculation.
                                           cost to dest. via
                         x
                    D ()              z          z’       z’                                                                 z’



                                                                       Distance Vector=Routing table
                                                                                                       z’’
                                                                                                                  x
                              y        1        14        5    z,1
                                                                                                                                  y’
           destination




                             y’       7          5        8    z’,5                                           z
                                                                                                        y’’                   y
                             y’’      6          9        4    z’’,4

                                                               z’,4                                                   y’’’
                          y’’’        4          2       11
                                   Distance table in X
Network Layer (2-89-90)                                                                                                                4-50
Routers Information Exchange

         Routers exchange information periodically of
          known:
            distance metric (costs)
            routing table (distance vector)


         Exchange timing:
            whenever a link fails
            Whenever a routing table entry changes.




Network Layer (2-89-90)                                  4-51
Distance Vector Routing Algorithm

       Iterative:
                                    Distance Table data structure
        continues until no
         nodes exchange info.
                                     each node has its own:
        self-terminating: no         row for each possible destination
         “signal” to stop             column for each directly-
                                      attached neighbor to node
       Asynchronous:
                                     example: in node X, for dest. Y
          nodes need not
                                      via neighbor Z: DX(Y,Z)
           exchange info/iterate
           in lock step!
                                         X                       Z
       distributed:                     D (Y,Z) = c(X,Z) + minw {D (Y,w)}
          each node                distance from X to Y, via Z as next hop
           communicates only with
           directly-attached
           neighbors
Network Layer (2-89-90)                                                     4-52
Distance Table: example
                                                                                     neighbor: j
                                        1       C
                           B                                                     A       B         D
                   7
                               8                    2
             A                                                             A     1      14         5




                                                        destination: i
                   1                            D                          B     7       8         5
                            E
                          source 2                                         C     6       9         4
          E’s neighbor                      A                              D     4      11         2
          B’s neighbor                                                                       E
                                                                          Distance table:   D(i, j)
                                    B
                                   D (A,C)
                                   C                                      E
                                                                         D (A,B)=
                                                    D
                                            B                                                    B
                   E       c(E,B)                                        = c(E,B) + minw{D (A,w)}
                                                    …                    = 8 + 6 = 14

Network Layer (2-89-90)                                                                                4-53
Distance table gives routing table

                           cost to destination via
                       E                                                  Outgoing link
               D ()            A        B      D                    E
                                                                   D ()    to use, cost

                           A    1     14        5                   A         A,1
         destination




                                                     destination
                           B    7       8       5                   B        D,5

                           C    6       9       4                   C        D,4

                           D    4     11        2                   D        D,4

                           Distance table                               Routing table
                                                                         of node E

Network Layer (2-89-90)                                                                   4-54
Meaning of Distance Vector

           A router using distance vector routing protocols
            knows 2 things:
                Distance to final destination
                                                                  E     Outgoing link
                Vector, or direction, traffic                   D ()    to use, cost
                 should be directed.
                                                                  A        A,1
                                       1   C




                                                   destination
                               B
                          7                                       B        D,5
                                   8           2
                  A
                                                                  C        D,4
                          1                D
                                E
                              source 2
                                                                  D        D,4

Network Layer (2-89-90)                                                                 4-55
Distance Vector Routing: overview


       Iterative, asynchronous:
         each local iteration caused
                                        Each node:
         by:                            wait for (change in local link
        local link cost change         cost or message from
        message from neighbor: its     neighbor)
         least cost path change
         from neighbor
       Distributed:                     recompute distance table
          each node notifies
           neighbors only when its
                                        if least cost path to any
           least cost path to any
                                        destination has changed,
           destination changes
               neighbors then notify
                                        notify neighbors
                their neighbors if
                necessary
Network Layer (2-89-90)                                                  4-56
A Link-State Routing Algorithm

                Dijkstra’s algorithm (global)
                   net topology, link costs known to all
                    nodes
                      accomplished via “link state

                       broadcast”
                      all nodes have same information

                   computes least cost paths from one
                    node (‘source”) to all other nodes
                      gives routing table for that node

                   iterative: after k iterations, know least
                    cost path to k destinations.

Network Layer (2-89-90)                                         4-65
Notation:
                                         5            5
        N: set of nodes whose                            3       C
                                                 B
         least cost path                     2                        5
         definitively known          A           23
                                                          3   1           F
      c(i,j): link cost from node        1                            2
         i to j. cost infinite if                D            E
                                                          1
         not direct neighbors
                                    Example: N: A, B, C, D, E, F
       p(v): nodes along path
         from source to v                        C(A,C)=5; C(C,A)=5
       D(v): current value of                   C(B,D)=2; C(D,B)=3
                                                 …
         cost of path from
         source to destination                   Source=A
                                                 p(F): A-D-E-F
         v.                                      D(F)=4

Network Layer (2-89-90)                                                       4-66
Dijsktra’s Algorithm
                                                                    v
   n = number of nodes (except the source)




           1 Initialization:
           2 N = {A}                               D(v)             c(w,v)
           3 for all nodes v
           4    if v adjacent to A
                                                                   w
           5      then D(v) = c(A,v)
           6      else D(v) = infinity            A
           7                                                    D(w)
           8 Loop
           9   find w not in N such that D(w) is a minimum
           10 add w to N
 n(n+1)/2) 11 update D(v) for all v adjacent to w and not in N:
   times 12       D(v) = min( D(v), D(w) + c(w,v) )
           13 /* new cost to v is either old cost to v or known
           14 shortest path cost to w plus cost from w to v */
           15 until all nodes in N

Network Layer (2-89-90)                                                 4-67
Dijkstra’s Algorithm: example

     computes least cost paths from node A to all other nodes

  Step        start N     D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E) D(F),p(F)
     0              A        2,A-B     5,A-C     1,A-D   infinity   infinity
     1            AD         2,A-B 4,A-D-C        1,A-D 2,A-D-E     infinity
     2           ADE         2,A-B 3,A-D-E-C      1,A-D  2,A-D-E 4,A-D-E-F
     3          ADEB         2,A-B 3,A-D-E-C     1,A-D   2,A-D-E 4,A-D-E-F
     4        ADEBC          2,A-B 3,A-D-E-C      1,A-D  2,A-D-E 4,A-D-E-F
     5       ADEBCF          2,A-B   3,A-D-E-C           1,A-D       2,A-D-E    4,A-D-E-F

                                             5
   D(v): Distance (cost) of A to v.                        3
   P(v): nodes along path fromA to v.                B           C
                                                 2                      5
                                         A                 3     1
                                                     2                      F
                                             1                         2
                                                     D           E
                                                            1
Network Layer (2-89-90)                                                                4-68
Dijkstra’s Algorithm: discussion2

        Oscillations possibility:
           Suppose link costs are equal to
            the load carried on the link, or               A
                                                       1
            the delay that experienced.        D               1+e
                                                                         B
                                                       0        0
           Link costs are not symmetric, 1        0
                                                           C         e
            c(A,B) equals c(B,A) only if the                                 1
            load on both directions on the               e
            AB link is the same.               Fig. a- Initial routing
           Nodes B and D originates a unit
            of traffic destined for A.
           Node C originates e unit for A.


Network Layer (2-89-90)                                                      4-70
Discussion2 (cont.)

     … oscillations possible:                                1
                                                                       A
         Algorithm is run: C                        D                     1+e
                                                                                       B
          determines (Fig. a) the                        0
                                                              0                0
                                                                                   e
                                            1                      C
          clockwise path to A has a cost                                                   1
          of 1, while the
          counterclockwise path to A                          e
                                                    Fig. a- Initial routing
          has a cost of 1 + e. Hence C ’s
          least-cost path to A is now
                                                                   A
          clockwise.                                  2+e                      0
          Similarly, B determines that             D                              B
          its new least-cost path to A is                    1+e           1
                                                      0                        0
          also clockwise, resulting in          1                  C                       1
          costs shown in Fig. b.                                       e
                                                    Fig. b- B, C find better
                                                     path to A is clockwise

Network Layer (2-89-90)                                                                        4-71
Discussion2 (cont.)

                                                                       A
      … oscillations possible:                                 0                   2+e
                                                       D                                   B
                                                                   0           0
         When algorithm is run next,         1            1           C           1+e
                                                                                                   1
          nodes B, C, and D all detect a                                   e
          zero-cost path to A in the           Fig. c- B, C, D find better
                                              path to A is counterclockwise
          counterclockwise direction,
          and all route their traffic to                                   A
          the counterclockwise routes.                     2+e                         0
                                                        D                                      B
         The next time the LS                                     1+e             1
          algorithm is run, B, C, and D all       1            0                       0
                                                                           C                       1
          then route their traffic to the                                      e
          clockwise routes.                           Fig. d- B, C, D find better
                                                        path to A is clockwise
Network Layer (2-89-90)                                                                                4-72
Dijkstra’s Algorithm: discussion2

      To prevent such oscillations:
      Solution1 :link costs not depend on the amount of traffic carried ,an
       unacceptable solution since one goal of routing is to avoid highly congested
       (for example, high-delay) links.

      Solution2 :all routers do not run the LS algorithm at the same time
       (a reasonable solution).
         Routers run the LS algorithm with the same periodicity, the
           execution instance of the algorithm would not be the same at
           each node.
         Researchers have noted: Routers in the Internet can self-
           synchronize among themselves. That is, even though they
           initially execute the algorithm with the same period but at
           different instants of time, the algorithm execution instance can
           eventually become, and remain, synchronized at the routers.
         Avoid such self-synchronization: Introduce randomization into
           the period between execution instants of the algorithm at each
           node.

Network Layer (2-89-90)                                                           4-73
Comparison of the DV and the LS

         Distance vector:
               Each router sends distance-vector, but to its neighbours
               The distance-vector contains the estimated distance to
                all other nodes
               Older method.
         Link-state:
               Each router sends link-state distance-vector to all
                others
               The link-state distance-vector contains the distance to
                the neighbours, only
               The distance value to the neighbour (called link-state) is
                accurate
               Recent method.


Network Layer (2-89-90)                                                      4-74
Chapter 4 Outline

       4.1 Introduction and Network Service Models
       4.2 Routing Principles
       4.3 Hierarchical Routing
       4.4 Routing in the Internet
       4.5 The Internet (IP) Protocol
       4.6 What’s Inside a Router
       4.7 IPv6
       4.8 Multicast Routing
       4.9 Mobility

Network Layer (2-89-90)                              4-75
Hierarchical Routing


                The routing study thus far was idealized
                 all routers identical
                 network “flat”

                … not true in practice
      scale: with 200 million               administrative
           destinations (hosts):
       can’t store all dest’s in routing
                                              autonomy:
        tables (memory limitation)!          internet = network of
       routing table exchange would          networks
        leave no bandwidth left for          each network admin may
        sending data packets!                 want to control routing in its
          DV algorithm that iterated         own network
           among large number of
           routers never converge!
Network Layer (2-89-90)                                                        4-76
Hierarchical Routing

          aggregate routers into          gateway routers
           regions, “autonomous             special routers in AS
           systems” (AS)                    run intra-AS routing
          routers in same AS                protocol with all other
                                             routers in AS
           run same routing
                                            also responsible for
           protocol                          routing to destinations
               “intra-AS” routing           outside AS
                protocol                       run inter-AS routing
               routers in different AS          protocol with other
                can run different intra-         gateway routers
                AS routing protocol




Network Layer (2-89-90)                                                4-77
Routing in the Internet


         The Internet is split into Autonomous Systems
          (AS’s)
              Examples of AS’s: Stanford (32), HP (71), MCI Worldcom (17373)
              Try: “MCI Worldcom” in http://ws.arin.net/whois/


         Within an AS, the administrator chooses an Interior
          Gateway Protocol (IGP) (Intra AS)
              Examples of IGPs: RIP (rfc 1058), OSPF (rfc 1247).


         Between AS’s, the Internet uses an Exterior
          Gateway Protocol (Inter ASs)
              AS’s today use the Border Gateway Protocol, BGP-4 (rfc 1771).


Network Layer (2-89-90)                                                         4-78
Intra-AS and Inter-AS routing
                 C.b
                                                       B.a           Gateways:
                              A.a                                        •perform inter-AS
                 b                       A.c                     c       routing amongst
     a                                                                   themselves
                                                       a
                                                                     b
                              a                                          •perform intra-AS
         C
                          d                                  B           routers with other
                                          c                              routers in their
               A               b
                                                                         AS
                                                                         ▪Routers in an AS
                                    Intra-AS          Inter-AS           have information
                                     Routing           Routing
    Inter/intra-AS                  Algorithm         Algorithm          about routing paths
         routing in                                                      within that AS.
       gateway A.c
                                           Routing Table

                                   DL           DL           DL
                                   PHL          PHL          PHL
      To/from A.b                                                        To/from B.a and A.a
                                      To/from A.d
Network Layer (2-89-90)                                                                        4-79
Intra-AS and Inter-AS routing

                                                       ng
                          C.b                     routi B
                                               S and      B.a
                                          ter-A n A
                                    A.a In twee
                                         be                                 Host2
                          b                 A.c                     c
                a                                         a
                                                                        b
                  C                 a                           B
                                d                        Intra-AS routing
                                            c
                              A     b                    within AS B
                                Intra-AS routing
                      Host1     within AS A




Network Layer (2-89-90)                                                             4-80
Forwarding Tables

                Forwarding table configured by both intra-
                 and inter-AS routing algorithm.
                Intra-AS sets entries for internal
                 destinations.
                Inter-AS & intra-As sets entries for
                 external destinations.




Network Layer (2-89-90)                                       4-81
Inter-AS Tasks

          Suppose router in AS1                 AS1 must:
           receives datagram destined            1. learn which dests are
           outside of AS1:                          reachable through AS2,
             router should forward                 which through AS3
              packet to gateway                  2. propagate this
              router, but which one?                reachability info to all
                                                    routers in AS1
                                                 Job of inter-AS routing!


                                3b                              2c
                     3a
                                                           2a
                                                                     2b
                          AS3             1a
                                     1d                         AS2
                                                1c
                            AS1            1b


Network Layer (2-89-90)                                                        4-82
Example: Setting forwarding table in router 1d

        Suppose AS1 learns (via inter-AS protocol) that subnet x
         reachable via AS3 (gateway 1a) but not via AS2.
        Inter-AS protocol propagates reachability info to all internal
         routers.
        router 1d determines from intra-AS routing info that its
         interface I is on the least cost path to 1a.
           installs forwarding table entry (x,I)




                          3a
                                     3b   …          x
                                                              2a
                                                                   2c

                                                                        2b
                               AS3             1a
                                          1d                       AS2
                                                         1c
                                 AS1            1b


Network Layer (2-89-90)                                                      4-83
Example: Choosing among multiple ASes

             Now suppose AS1 learns from inter-AS protocol that
              subnet x is reachable from AS3 and from AS2.

             To configure forwarding table, router 1d must determine
              towards which gateway it should forward packets for dest
              x.
                this is also job of inter-AS routing protocol!




                                     3b   …          x        …..        2c
                          3a
                                                                    2a
                                                                              2b
                               AS3             1a
                                          1d                             AS2
                                                         1c
                                 AS1            1b


Network Layer (2-89-90)                                                            4-84
Example: Choosing among multiple ASes
        now suppose AS1 learns from inter-AS protocol that
         subnet x is reachable from AS3 and from AS2.
        to configure forwarding table, router 1d must
         determine towards which gateway it should forward
         packets for dest x.
           this is also job of inter-AS routing protocol!
        hot potato routing: send packet towards closest of
         two routers.


                             Use routing info     Hot potato routing:       Determine from
  Learn from inter-AS        from intra-AS
                                                      Choose the         forwarding table the
  protocol that subnet    protocol to determine                         interface I that leads
                           costs of least-cost         gateway
   x is reachable via                                                   to least-cost gateway.
                              paths to each         that has the             Enter (x,I) in
    multiple gateways        of the gateways      smallest least cost      forwarding table




Network Layer (2-89-90)                                                                          4-85
Chapter 4 Outline

       4.1 Introduction and Network Service Models
       4.2 Routing Principles
       4.3 Hierarchical Routing
       4.4 Routing in the Internet
            4.5.1 Intra-AS routing: RIP and OSPF

            4.5.2 Inter-AS routing: BGP

       4.5 The Internet (IP) Protocol
       4.6 What’s Inside a Router?
       4.7 IPv6
       4.8 Multicast Routing
       4.9 Mobility
Network Layer (2-89-90)                              4-86
Routing in the Internet
                    (RC1812) Requirements for IP Version 4 Routers


         The Global Internet consists of Autonomous Systems
          (AS) interconnected with each other:
               Stub AS: small corporation: one connection to other AS’s
               Multihomed AS: large corporation (no transit): multiple
                connections to other AS’s
               Transit AS: provider, hooking many AS’s together

         Two-level routing:
               Intra-AS: administrator responsible for choice of routing
                algorithm within network
               Inter-AS: unique standard for inter-AS routing.



Network Layer (2-89-90)                                                     4-87
TCP/IP protocol stack

                             mime
                      ftp http smtp telnet            snmp tftp rtp dns …


                     Transmission Control Pr. (TCP)         User Datagram Pr. (UDP)



               …    igmp   icmp                                    rip   ospf   bgp    …
                                   Internet Protocol (IP)

                                                                         arp    rarp


                Ethernet, Wireless, token ring, FDDI, ATM, Frame relay, SNA, X25




Network Layer (2-89-90)                                                                    4-88
Routing Protocols in the Internet-1
                                  Transport layer: TCP, UDP

                      Routing protocols




                                                                                 Network layer
                                                 Control protocols
                      • path selection:
                                                 ICMP, IGMP, …           …
                          RIP, OSPF, BGP, IGRP

                          forwarding    IP protocol
                             table      •addressing conventions
                                        •datagram format
                                        •packet handling conventions

                                             Link layer
                                            physical layer

                            ICMP: Internet Control Message Protocol, RFC792
                            IGMP: Internet Group Management Protocol, RFC 2236




Network Layer (2-89-90)                                                                    4-89
Internet Routing Protocol
      Intra-AS: administrator responsible for choice of
       routing algorithm within network
         Also known as Interior Gateway Protocols (IGP)
         Most common Intra-AS routing protocols:
               RIP: Routing Information Protocol (RFCs1058,2453)
                    – It is a distance vector protocol.
                    – Routing updates are exchanged between neighbors app. Every 30sec.


               OSPF: Open Shortest Path First (RFC2328) (Open Spec.)
               IGRP: Interior Gateway Routing Protocol (Cisco proprietary)
                    – These are link-state protocol that uses flooding of link information and a
                      Dijkstra least-cost path algorithm.
    Inter-AS: unique standard for inter-AS routing:
   BGP (RFC1771)

Network Layer (2-89-90)                                                                        4-90
Border Gateway Protocol (BGP-4)

         BGP is not a link-state or distance-vector routing
          protocol.
               Instead, BGP uses “Path vector”
         BGP advertises complete paths (a list of AS’s).
               Also called AS_PATH (this is the path vector)
               Example of path advertisement:
            “The network 171.64/16 can be reached via the path {AS1, AS5, AS13}”.
         Paths with loops are detected locally and ignored.
         Local policies pick the preferred path among
          options.
         When a link/router fails, the path is “withdrawn”.



Network Layer (2-89-90)                                                             4-91
Internet AS Hierarchy

          Intra-AS border (exterior gateway) routers


                                  C.b
                                                        B.a

                              C             A.a
                                  b               A.c         c
                          a
                                                        a
                                                                  b
                                            a
                                  A     d                         B
                                                  c
                                             b




                          Inter-AS (interior gateway) routers
Network Layer (2-89-90)                                               4-92
Why different Intra- and Inter-AS routing ?

      Policy:
          Inter-AS: admin wants control over how its traffic
           routed, who routes through its net.
          Intra-AS: single admin, so no policy decisions needed
      Scale:
       hierarchical routing saves table size, reduced update
        traffic
      Performance:
       Intra-AS: can focus on performance
       Inter-AS: policy may dominate over performance



Network Layer (2-89-90)                                            4-93
Chapter 4 outline
       4.1 Introduction and Network Service Models
       4.2 Routing Principles
       4.3 Hierarchical Routing
       4.4 Routing in the Internet
       4.5 The Internet (IP) Protocol
             4.4.1 IPv4 addressing
             4.4.2 Moving a datagram from source to destination
             4.4.3 IP address,
             4.4.4 Address depletion
             4.4.5 NAT: Network Address Translation
             4.4.6 Datagram format
             4.4.7 IP fragmentation
             4.4.8 IP Services
             4.4.9 ICMP: Internet Control Message Protocol
             4.4.10 DHCP: Dynamic Host Configuration Protocol

       4.6 What’s Inside a Router
       4.7 IPv6
       4.8 Multicast Routing
       4.9 Mobility
Network Layer (2-89-90)                                            4-94
IP Addressing: Introduction

         IP address: 32-bit                    223.1.1.1

          identifier for host,                                         223.1.2.1
                                                223.1.1.2
          router interface                            223.1.1.4   223.1.2.9
         interface: connection                                        223.1.2.2
          between host/router                   223.1.1.3 223.1.3.27

          and physical link
              router’s typically have
               multiple interfaces             223.1.3.1            223.1.3.2
              host may have multiple
               interfaces
              IP addresses
               associated with each 223.1.1.1 = 11011111 00000001 00000001 00000001
               interface
                                                    223       1          1         1


Network Layer (2-89-90)                                                            4-95
IP Addressing

         IP address:                      223.1.1.1

              network part (high                                223.1.2.1
                                           223.1.1.2
               order bits)                        223.1.1.4   223.1.2.9
              host part (low order
               bits)                       223.1.1.3   223.1.3.27
                                                                    223.1.2.2

         What’s a network ?
                                                               LAN
          (from IP address
          perspective)                     223.1.3.1                223.1.3.2
            device interfaces with

             same network part of
             IP address
            can physically reach
                                      network consisting of 3 IP networks
             each other without
             intervening router

Network Layer (2-89-90)                                                         4-96
223.1.1.2
                 IP Addressing
     How to find the                      223.1.1.1                   223.1.1.4

       networks?
                                                        223.1.1.3
      Detach each
       interface from                         223.1.9.2         223.1.7.0
       router, host
      create “islands of
       isolated networks          223.1.9.1                                   223.1.7.1
                                                  223.1.8.1    223.1.8.0

                                      223.1.2.6                           223.1.3.27
     Interconnected
     system consisting    223.1.2.1               223.1.2.2   223.1.3.1                223.1.3.2
     of six networks.


Network Layer (2-89-90)                                                                      4-97
Getting a datagram from source to dest.

                                          forwarding table in A
                                         Dest. Net. Next Router Nhops
                                          223.1.1                       1
   IP datagram:                           223.1.2       223.1.1.4       2
                                          223.1.3       223.1.1.4       2
      misc source dest
                              data
     fields IP addr IP addr
                                     A 223.1.1.1
       datagram remains                                        223.1.2.1
        unchanged, as it travels           223.1.1.2
                                                223.1.1.4   223.1.2.9
        source to destination
       addr fields of interest      B
                                                      223.1.3.27 223.1.2.2   E
        here                             223.1.1.3
                                          223.1.3.1              223.1.3.2




Network Layer (2-89-90)                                                      4-98
Getting a datagram from source to dest.

                                              forwarding table in A
      misc                                    Dest. Net. Next Router Nhops
                                data
     fields 223.1.1.1 223.1.1.3
                                              223.1.1                          1
                                              223.1.2       223.1.1.4          2
    Starting at A, send IP                    223.1.3       223.1.1.4          2
      datagram addressed to B:
     look up net. address of B in
                                        A 223.1.1.1
      forwarding table
     find B is on same net. as A                                  223.1.2.1
                                              223.1.1.2
     link layer will send datagram                223.1.1.4   223.1.2.9

      directly to B inside link-layer   B
                                                         223.1.3.27 223.1.2.2      E
      frame
                                            223.1.1.3
         B and A are directly
                                             223.1.3.1              223.1.3.2
          connected


Network Layer (2-89-90)                                                            4-99
Getting a datagram from source to dest.

                                              forwarding table in A
       misc                                   Dest. Net. Next Router Nhops
                                 data
      fields 223.1.1.1 223.1.2.3
                                               223.1.1                          1
                                               223.1.2       223.1.1.4          2
     Starting at A, dest. E:
                                               223.1.3       223.1.1.4          2
        look up network address of E
         in forwarding table
                                          A 223.1.1.1
        E on different network
            A, E not directly attached                             223.1.2.1
                                              223.1.1.2
                                                   223.1.1.4    223.1.2.9
        routing table: next hop
         router to E is 223.1.1.4         B
                                                          223.1.3.27 223.1.2.2      E
        link layer sends datagram to      223.1.1.3
         router 223.1.1.4 inside link-
                                                                     223.1.3.2
         layer frame                          223.1.3.1

        datagram arrives at 223.1.1.4
        continued…..
Network Layer (2-89-90)                                                             4-100
Getting a datagram from source to dest.

                                         forwarding table in router
       misc                             Dest. Net Router Nhops Interface
                                 data
      fields 223.1.1.1 223.1.2.3
                                        223.1.1           -      1      223.1.1.4
    Arriving at 223.1.4,                223.1.2           -      1      223.1.2.9
                                        223.1.3           -      1
      destined for 223.1.2.2                                             223.1.3.27

     look up network address of E
                                         A 223.1.1.1
      in router’s forwarding table
     E on same network as router’s                                  223.1.2.1
                                               223.1.1.2
                                                                223.1.2.9
      interface 223.1.2.9                           223.1.1.4

         router, E directly attached    B
                                                          223.1.3.27 223.1.2.2      E
     link layer sends datagram to           223.1.1.3
      223.1.2.2 inside link-layer                                    223.1.3.2
                                              223.1.3.1
      frame via interface 223.1.2.9
     datagram arrives at 223.1.2.2

Network Layer (2-89-90)                                                          4-101
IP Addresses: Class-full
      given notion of “network”, let’s re-examine IP addresses:
      “class-full” addressing:

    class                            format                       range
                                                               1.0.0.0 to
      A         0 Network                 Host                 126.255.255.255
                                                                                 N.H.H.H

                                                               128.0.0.0 to
      B         10         Network               Host
                                                               191.255.255.255
                                                                                 N.N.H.H

                                                               192.0.0.0 to
       C        110           Network                   Host
                                                               223.255.255.255
                                                                                 N.N.N.H

                                                               224.0.0.0 to
      D         1110           multicast address
                                                               239.255.255.255
                                                               240.0.0.0 to
      E         11110          experimentation
                                                               247.255.255.255
                                     32 bits
Network Layer (2-89-90)                                                             4-102
Class-full Summary
                                     The Class System
                                 Number of             Decimal                 Number of
          Address                          Number of               Number of
                     Application Network               Address                  Possible
           Class                           Host Bits               Networks
                                   Bits                 Range                    Host
                       Large
          Class A                  8 bits   24 bits     1 - 126      126       16,777,214
                      Networks
                      Medium-
          Class B                 16 bits   16 bits    128 - 191    65,534      65,534
                       sized
                       Small
          Class C                 24 bits    8 bits    192 - 223   2,097,152      254
                      Networks




Network Layer (2-89-90)                                                                     4-103
Private or Non-Routable addresses

         Some addresses are reserved for use on local networks that are
          not connected to the Internet
         Routers do not consider these addresses to be valid Internet
          addresses, and will not route a packet to any of them
         These addresses may be used on private networks (not directly
          connected to the Internet).
         10.0.0.0/8 —» 10.0.0.0 to 10.255.255.255 (a single class A net)
         172.16.0.0/12 —» 172.16.0.0 to 172.31.255.255 (contiguous
          class Bs)
         192.168.0.0/16 —» 192.168.0.0 to 192.168.255.255 (contiguous
          class Cs)

Network Layer (2-89-90)                                                     4-104
Special Purpose IP Addresses

          Several Addresses within the classes are
             reserved for special use.
               0.0.0.0 :Source IP Addr. Just after Boot
               network part of dest. Addr.= 0 :Source and
                Destination are in same network.
               Dest. Addr.=255.255.255.255 :Broadcast in
                Sender’s network.
               host part of Dest.=111… : Broadcast in
                destination network.
               Dest. Addr. = 127.anything : Loop Back




Network Layer (2-89-90)                                      4-105
Special Purpose Addresses-List
       Address Block      Present Use                        Reference
           0.0.0.0/8      "This" Network                       [RFC1700, page 4]
           10.0.0.0/8     Private-Use Networks                 [RFC1918]
           14.0.0.0/8     Public-Data Networks                 [RFC1700, page 181]
           24.0.0.0/8     Cable Television Networks
           39.0.0.0/8     Reserved, subject to allocation      [RFC1797]
           127.0.0.0/8    Loop back                            [RFC1700, page 5]
            128.0.0.0/16  Reserved but subject to allocation
           169.254.0.0/16 Link Local –
           172.16.0.0/12 Private-Use Networks                  [RFC1918]
           191.255.0.0/16 Reserved but subject to allocation –
           192.0.0.0/24 Reserved but subject to allocation –
           192.0.2.0/24 Test-Net
           192.88.99.0/24 6to4 Relay Anycast                   [RFC3068]
           192.168.0.0/16 Private-Use Networks                 [RFC1918]
           198.18.0.0/15 Network Interconnect Device Benchmark Testing [RFC2544]
           223.255.255.0/24 Reserved but subject to allocation –
           224.0.0.0/4    Multicast                            [RFC3171]
           240.0.0.0/4    Reserved for Future Use              [RFC1700]



Network Layer (2-89-90)                                                              4-106
Address depletion

         In 1991 IAB identified 3 dangers
               Running out of class B addresses
               Increase in nets has resulted in routing table explosion
               Increase in net/hosts exhausting 32 bit address space

         Four strategies to address
               Creative address space allocation {RFC 2050}
               Private addresses {RFC 1918}, Network Address
                Translation (NAT) {RFC 1631}
               Classless Inter-Domain Routing (CIDR) {RFC 1519}
               IP version 6 (IPv6) {RFC 1883}



Network Layer (2-89-90)                                                    4-107
Creative IP address allocation

         Class A addresses 64 – 127 reserved
               Handle on individual basis
         Class B only assigned given a demonstrated need
         Class C
               divided up into 8 blocks allocated to regional authorities
               208-223 remains unassigned and unallocated
         Three main registries handle assignments
               APNIC – Asia & Pacific www.apnic.net
               ARIN – N. & S. America, Caribbean & sub-Saharan Africa
                www.arin.net
               RIPE – Europe and surrounding areas www.ripe.net



Network Layer (2-89-90)                                                      4-108
NAT: Network Address Translation-1


         Motivation: local network uses just one IP address
          as far as outside word is concerned:
            no need to be allocated range of addresses
             from ISP: - just one IP address is used 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).

Network Layer (2-89-90)                                          4-109
Private IP Network

         Private IP network is an IP network that is not
          directly connected to the Internet.
         IP addresses in a private network can be assigned
          arbitrarily.
               Not registered and not guaranteed to be globally unique.


         Generally, private networks use addresses from
          the following experimental address ranges (non-
          routable addresses):
               10.0.0.0 – 10.255.255.255
               172.16.0.0 – 172.31.255.255
               192.168.0.0 – 192.168.255.255

Network Layer (2-89-90)                                                    4-110
NAT: Network Address Translation-2


      Implementation: NAT router must:
          outgoing datagrams: replace (source IP address, port #)
           of every outgoing datagram to (NAT IP address, new
           port #)
            . . . remote clients/servers will respond using (NAT IP
               address, new port #) as destination addr.

               remember (in NAT translation table) every (source IP
                address, port #) to (NAT IP address, new port #)
                translation pair

               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

Network Layer (2-89-90)                                                   4-111
NAT: Network Address Translation-3

                                              local network
                    rest of               Private IP Network
                   Internet               (e.g., home network)
                                                 10.0.0/24         10.0.0.1

                                        10.0.0.4
                                                                       10.0.0.2

                          138.76.29.7

                                                                       10.0.0.3


      All datagrams leaving local        Datagrams with source or
   network have same single source       destination in this network
        NAT IP public address:            have 10.0.0/24 address
             138.76.29.7,                     (private address)
    different source port numbers

Network Layer (2-89-90)                                                      4-112
NAT: Network Address Translation-4

                                NAT translation table
2: NAT router                                                                1: host 10.0.0.1
                            WAN side addr    LAN side addr
changes datagram                                                             sends datagram to
                              138.76.29.7, 5001 10.0.0.1, 3345               128.119.40, 80
source addr from
                               ……                          ……
10.0.0.1, 3345 to
138.76.29.7, 5001,                                            S: 10.0.0.1, 3345
updates table                                                 D: 128.119.40.186, 80
                                                                                        10.0.0.1
                                                                        1
                           S: 138.76.29.7, 5001
                     2     D: 128.119.40.186, 80   10.0.0.4
                                                                                         10.0.0.2
                                138.76.29.7         S: 128.119.40.186, 80
                                                    D: 10.0.0.1, 3345        4
                   S: 128.119.40.186, 80
                   D: 138.76.29.7, 5001    3                                       10.0.0.3
                                                   4: NAT router
                3: Reply arrives                   changes datagram
                dest. address:                     dest addr from
                138.76.29.7, 5001                  138.76.29.7, 5001 to 10.0.0.1, 3345

Network Layer (2-89-90)                                                                     4-113
NAT: Network Address Translation-4


         16-bit port-number field:
               232 = 65,536 simultaneous connections with a
                single LAN-side address!

         NAT is controversial:
               routers should only process up to layer 3
               violates end-to-end argument
                  
                      NAT possibility must be taken into account by app
                      designers, eg. P2P applications.
                  
                      address shortage should instead be solved by IPv6


Network Layer (2-89-90)                                                   4-114
Nat & Applications

         IP address in application data:
            Applications that carry IP addresses in the

             payload of the application data generally do not
             work across a private-public network boundary.

               Some NAT devices inspect the payload of
                widely used application layer protocols and, if
                an IP address is detected in the application-
                layer header or the application payload,
                translate the address according to the address
                translation table.

Network Layer (2-89-90)                                           4-115
Example: NAT & FTP
                                           Public Network

                                                                         FTP Client
                  FTP Server                        No NAT Device
   Public Address                                                                 Public Address
    147.202.71.22                                                                  207.3.18.98




                                     PORT 207.3.18.98, 1107

                                     200 Port Command Successful

                                              RETR file1

                                     150 Opening Data Connection

                                        Establish Data Connection


                     Client gives its IP address and port number for data connection.
                     Server starts data connection.
Network Layer (2-89-90)                                                                     4-116
Example: NAT & FTP
                          Public Network                                Private Network
                                                    NAT Device with         FTP Client
                  FTP Server                          FTP Support
   Public Address                                                                    Private Address
    147.202.71.22                                                                         10.0.1.1
                                                Public Address
                                                 207.3.18.98

   PORT command
   in IP packet must              PORT 207.3.18.98,1107
                                   PORT 207.3.18.98,1107         PORT 10.0.1.1, 1107
                                                                  PORT 10.0.1.1, 1107
   be modified.
                              200 Port Command Successful
                               200 Port Command Successful       200 Port Command Successful
                                                                  200 Port Command Successful

                                             RETR file1
                                              RETR file1         RETR file1
                                                                  RETR file1

                               150 Opening Data Connection
                                150 Opening Data Connection      150 Opening Data Connection
                                                                  150 Opening Data Connection


                               Establish Data Connection
                               Establish Data Connection         Establish Data Connection
                                                                 Establish Data Connection



Network Layer (2-89-90)                                                                         4-117
NAT Traversal Problem

         Client wants to connect to
          server with address 10.0.0.1
                                                                                10.0.0.1
               server address 10.0.0.1 local  Client
                to LAN (client can’t use it as
                destination addr)                              NAT
                                                              router 10.0.0.4
               only one externally visible
                NATted address: 138.76.29.7
         Solution 1: statically                138.76.29.7
          configure NAT to forward
          incoming connection
          requests at given port to
          server
               e.g., connection request at:
                (123.76.29.7, port 80) always
                forwarded to (10.0.0.1 port
                1405)
Network Layer (2-89-90)                                                              4-118
NAT traversal problem

         Solution 2: Universal Plug and
          Play (UPnP) Internet Gateway                               10.0.0.1
          Device (IGD) Protocol allows                   IGD
          NATted host to:                           NAT
            learn public IP address               router 10.0.0.4

             (138.76.29.7)
            add/remove port mappings      138.76.29.7

             (with lease times)
            i.e., automate static NAT

             port map configuration



Network Layer (2-89-90)                                                   4-119
NAT traversal problem

          Solution 3: relaying (used in Skype)
             NATted client establishes connection to relay

             External client connects to relay

             relay bridges packets between to connections



                                                                             NATted Host

               2. connection to                 1. connection to                  10.0.0.1
               relay initiated                  relay initiated
               by client                        by NATted host
                                                                       10.0.0.4
                                  3. relaying
    Client                        established
                                                               NAT
                                                138.76.29.7   router


Network Layer (2-89-90)                                                                 4-120
IP addressing: CIDR

          Classful addressing:
               inefficient use of address space, address space exhaustion
               e.g., class B net allocated enough addresses for 65K hosts,
                even if only 2K hosts in that network
          CIDR: Classless Inter Domain Routing                   (RFC1519)
               network portion of address of arbitrary length
               address format: a.b.c.d/x, where x is # bits in network
                portion of address

                              network                     host
                                part                      part
                 11001000 00010111 00010000 00000000
                                 200.23.16.0/23
Network Layer (2-89-90)                                                       4-121
Subnet Mask-1

         A subnet mask is applied to the host bits to
          determine how the network is subnetted,
               e.g. if the host is: 137.138.28.228, and the subnet mask
                is 255.255.255.0 then the right hand 8 bits are for the
                host (255 is decimal for all bits set in an octet)




Network Layer (2-89-90)                                                    4-122
Bit Masks and Subnet Masks
            In a production environment this prefix typically
            varies in length from 8 to 30 bits

     /8 = 255.0.0.0          /16 = 255.255.0.0       /24 = 255.255.255.0
     /9 = 255.128.0.0        /17 = 255.255.128.0     /25 = 255.255.255.128
     /10 = 255.192.0.0       /18 = 255.255.192.0     /26 = 255.255.255.192
     /11 = 255.224.0.0       /19 = 255.255.224.0     /27 = 255.255.255.224
     /12 = 255.240.0.0       /20 = 255.255.240.0     /28 = 255.255.255.240
     /13 = 255.248.0.0       /21 = 255.255.248.0     /29 = 255.255.255.248
     /14 = 255.252.0.0       /22 = 255.255.252.0     /30 = 255.255.255.252
     /15 = 255.254.0.0       /23 = 255.255.254.0     /31 = not usable
                                                     /32 = not usable



          /30 yields two usable hosts and is used for WAN connections


Network Layer (2-89-90)                                                 4-123
Prefix Equivalents
                    Network Prefix    Equivalent Number of Class Addresses        Number of Hosts

                          /27                    1/8th of a Class C                     32
                          /26                    1/4th of a Class C                     64

                          /25                     1/2 of a Class C                     128
                          /24                        1 Class C                         256
                          /23                        2 Class C                         512
                          /22                        4 Class C                         1,024
                          /21                        8 Class C                         2,048
                          /20                       16 Class C                         4,096
                          /19                       32 Class C                         8,192

                          /18                       64 Class C                        16,384
                          /17                       128 Class C                       32,768
                          /16                256 Class C or 1 Class B                 65,536
                          /15                512 Class C or 2 Class B                 131,072
                          /14               1,024 Class C or 4 Class B                262,144
                          /13                2048 Class C or 8 Class B                524,288
                          /12               4096 Class C or 16 Class B               1,048,576
                          /11               8192 Class C or 32 Class B               2,097,152
                          /10               16384 Class C or 64 Class B              4,194,304
                          /9               32768 Class C or 128 Class B              8,388,608
                          /8         65,536 Class C or 256 Class B or 1 Class A     16,777,216


Network Layer (2-89-90)                                                                             4-124
Protocols


              Class-full Routing Protocols   Classless Routing Protocol
              RIP version1                   RIP version2
              IGPR                           EIGPR
              EGP                            OSPF
              BGP3                           BGP4
                                             IS-IS




Network Layer (2-89-90)                                                   4-125
Examples




Network Layer (2-89-90)              4-126
Subnetting:(Extended Network Prefix)

      Q: How an organization gets network part of IP addr?
      A: It gets allocated portion of its ISP’s address
        space.

                                             The ISP have been allocated the address block

    ISP's block           11001000 00010111 00010000 00000000                 200.23.16.0/20

    Organization 0        11001000 00010111 00010000 00000000                 200.23.16.0/23
    Organization 1        11001000 00010111 00010010 00000000                 200.23.18.0/23
    Organization 2        11001000 00010111 00010100 00000000                 200.23.20.0/23
     ...                            …..                  ….                        ….
    Organization 7        11001000 00010111 00011110 00000000                 200.23.30.0/23

                                 The ISP divides the block into 8 smaller addr.
                               blocks (subnets) and gives them to 8 organization.


Network Layer (2-89-90)                                                                        4-127
Hierarchical addressing: route aggregation

                Hierarchical addressing allows efficient
                advertisement of routing information:

         Organization 0                            route aggregation or
             200.23.16.0/23                        route summarization.
         Organization 1                               “Send me anything
              200.23.18.0/23                          with addresses
                                                      beginning
         Organization 2                ISP1           200.23.16.0/20”
              200.23.20.0/23   .
                               .   200.23.16.0/20
                          .    .                                             Internet
                          .
         Organization 7   .
             200.23.30.0/23
                                        ISP2             “Send me anything
                                   199.31.0.0/16         with addresses
                                                         beginning
                                                         199.31.0.0/16”


Network Layer (2-89-90)                                                                 4-128
Hierarchical addressing: more specific routes
                    ISP2 has a more specific route to Organization 1
         The routers in Internet use a longest prefix matching rule, and route
         toward ISP2, as it advertises the longest (more specific) address prefix
         that matches the destination address. 

         Organization 0
             200.23.16.0/23
                                                    “Send me anything
                                                    with addresses
                                                    beginning
         Organization 2                             200.23.16.0 /20”
              200.23.20.0/23   .                      20 bits
                               .        ISP1
                          .    .
                          .                                                Internet
         Organization 7   .
             200.23.30.0/23

                                                     “Send me anything
                                       ISP2
         Organization 1                              with addresses
                                                     beginning 199.31.0.0/16
             200.23.18.0/23                          or 200.23.18.0 /23”
                                                          23 bits


Network Layer (2-89-90)                                                               4-129
Subnet Mask

    ISP's block       11001000 00010111 00010000 00000000         200.23.16.0/20
    ISP’s subnet mask 11111111 11111111 11110000 00000000         255.255.240.0


    Organization 0        11001000 00010111 00010000 00000000    200.23.16.0/23
    Organization 1        11001000 00010111 00010010 00000000    200.23.18.0/23
    Organization 2        11001000 00010111 00010100 00000000    200.23.20.0/23
     ...                           …..                 ….           ….
    Organization 7   11001000 00010111 00011110 00000000 200.23.30.0/23
    Or’s subnet mask 11111111 11111111 11111110 00000000 255.255.254.0



               Network part of an IP address= subnet mask & IP address




Network Layer (2-89-90)                                                        4-130
CIDR: Subneting Example

       You are assigned the CIDR address 200.32.108.0 /22 and
       you must support the network shown in the diagram.
       Create an addressing scheme that will meet the diagram
        requirements.

                                      100 computers




                     300 computers                    100 computers

                                     100 computers




Network Layer (2-89-90)                                               4-131
CIDR: Subneting Example
                             (Questions)

           Given the CIDR address 200.32.108.0 /22
                  How many Class C networks do we have? 4 classes
                  How many host addresses do we have? 4x254 addresses
                  What is the largest LAN requirement? 300 addresses

           Host required - 300, 100, 100, 100, and 3 WAN links




Network Layer (2-89-90)                                                  4-132
200.32.108.0 /22
                      0               0




  200.32.108.0/24                                  200.32. 110.0/24

                                                   200.32.
                                                   110.0


                                255          255
                      0               0




 200.32. 109.0/24                                  200.32. 111.0/24
                                                   200.32. 111.0



                                255          255


Network Layer (2-89-90)                                        4-133
0                                        0




  200.32.108.0/24                                                        200.32. 110.0/24

                                                                         200.32.




                                      200.32.108.0 /23
                                                                         110.0
                          300 hosts
                                                         255       255
                      0                                        0




 200.32. 109.0/24                                                        200.32. 111.0/24

                                                                         200.32. 111.0



                                                         255       255


Network Layer (2-89-90)                                                             4-134
0                                        0                                        128




                                                                                                                          200.32.110.128 /25
                                                                               200.32.110.0 /25


                                                                                                              100 hosts
                                                                   100 hosts
  200.32.108.0/24                                                                                                                                    200.32. 110.0/24




                                      200.32.108.0 /23
                          300 hosts
                                                         255                                      127                                          255
                      0                                        0




 200.32. 109.0/24                                                                                                                                    200.32. 111.0/24




                                                         255                                                                                   255


Network Layer (2-89-90)                                                                                                                                         4-135
0                                        0                                        128




                                                                                                                          200.32.110.128 /25
                                                                               200.32.110.0 /25


                                                                                                              100 hosts
                                                                   100 hosts
     200.32.108.0                                                                                                                                    200.32.
                                                                                                                                                     110.0




                                      200.32.108.0 /23
                          300 hosts
                                                         255                                      127                                          255
                      0                                        0                                        128




                                                                               200.32.111.0 /25
                                                                   100 hosts
     200.32. 109.0                                                                                                                                   200.32. 111.0




                                                         255                                      127                                          255


Network Layer (2-89-90)                                                                                                                                         4-136
0                                        0                                        128




                                                                                                                          200.32.110.128 /25
                                                                               200.32.110.0 /25


                                                                                                              100 hosts
                                                                   100 hosts
     200.32.108.0                                                                                                                                    200.32.
                                                                                                                                                     110.0




                                      200.32.108.0 /23
                          300 hosts
                                                         255                                      127                                          255
                      0                                        0                                        128




                                                                               200.32.111.0 /25
                                                                   100 hosts
                                                                                                                                               191
     200.32. 109.0                                                                                      192               224                        200.32. 111.0


                                                                                                                                               239
                                                                                                                          240 248
                                                                                                                           243 251                         WAN
                                                                                                                          244 252                          links /30
                                                         255                                      127             223 247 255


Network Layer (2-89-90)                                                                                                                                         4-137
CIDR: Subneting Example
                                    (Results)
                          Given the CIDR address 200.32.108.0 /22
                                          200.32.111.0 /25
                                            1/2 Class C

                                           100 computers



                             200.32.111.240 /30      200.32.111.248 /30


             300 computers               200.32.111.244 /30
                                                                    100 computers
          200.32.108.0 /23
            2 Class C’s                                           200.32.110.128 /25
                                           100 computers             1/2 Class C
                                         200.32.110.0 /25
                                           1/2 Class C

Network Layer (2-89-90)                                                                4-138
Supernetting Example-1
     Company XYZ needs to address 400 hosts.
     Its ISP gives them two contiguous Class C addresses:
          207.21.54.0/24
          207.21.55.0/24
     Company XYZ can use a prefix of 207.21.54.0 /23 to supernet these two
      contiguous networks. (Yielding 510 hosts)
     207.21.54.0 /23
          207.21.54.0/24
          207.21.55.0/24




                                   23 bits in common


Network Layer (2-89-90)                                                       4-139
Supernetting Example-2
             addressing authority of ISP, include XYZ,
            be advertised to Internet as a single supernt




Network Layer (2-89-90)                                     4-140
CIDR and the Provider
                          example of route aggregation


                                        advertising address: a.b.c.d/x




Network Layer (2-89-90)                                                  4-141
TCP/IP protocol stack

                             mime
                      ftp http smtp telnet            snmp tftp rtp dns …


                     Transmission Control Pr. (TCP)         User Datagram Pr. (UDP)



               …    igmp   icmp                                    rip   ospf   bgp    …
                                   Internet Protocol (IP)

                                                                         arp    rarp


                Ethernet, Wireless, token ring, FDDI, ATM, Frame relay, SNA, X25




Network Layer (2-89-90)                                                                    4-142
IP: The waist of the hourglass

     IP is the waist of the       Network Applications
      hourglass of the Internet
                                  http, smtp, ftp, dns, …
      protocol architecture
                                        tcp, udp
                                           IP
     Multiple higher-layer
      protocols                     Data Link Protocols
     Multiple lower-layer        Physical Layer Protocols
      protocols

     Only one protocol at the
      network layer.


Network Layer (2-89-90)                              143     4-143
IP datagram format
       IP protocol version                          32 bits
           Number[4bits]
                                                                               total datagram
              header length              head. “type” of
                                     ver                     length            length (1Byte)
            (4Bytes)[4bits]               len service
                                                               fragment        fragmentation/
  “type” of data: Priority [3bits]   16-bit identifier flags
                      Delay[1bit]
                                                                 offset        Reassembly/
                                     time to upper Checksum: 1’s add of
               Throughput[1bit]                                                DF, MF Flags
                 Reliability[1bit]     live     layer 16bits words in header
                                                                                upper layer
                                          32 bit source IP address
             max number                                                         protocol
          remaining hops                32 bit destination IP address           to deliver
        (decremented at                                                         payload to
            each router)                       Options (if any)                 (rfc 1700)
                                                                                  1 :ICMP
                                                     data                         6 :TCP
    how much overhead                          (variable length,                  17 :UDP
       with TCP?
                                                typically a TCP
     20 bytes of TCP                                                      e.g. timestamp,
                                               or UDP segment)
     20 bytes of IP                                                       record route
     = 40 bytes + app                                                     taken, specify
                                     A packet is unique in Internet by:    list of routers
       layer overhead                Id + S. IP Add + D. IP Add + Upper L. to visit.
Network Layer (2-89-90)                                                                     4-144
IP Fragmentation & Reassembly

    network links have MTU
     (max.transfer size) - largest
     possible link-level frame.
       different link types,
                                                   fragmentation:
         different MTUs                            in: one large datagram
    large IP datagram divided                     out: 3 smaller datagrams
     (“fragmented”) within net
       one datagram becomes

         several datagrams
                                      reassembly
       “reassembled” only at final

         destination
       IP header bits used to

         identify, order related
         fragments




Network Layer (2-89-90)                                              4-145
IP Fragmentation and Reassembly
                                                                  data
                                             20 Byte            0……….3979
                                    length ID fragflag offset
    Example                         =4000 =x     =0      =0
     4000 byte                              4000 Bytes

      datagram
                                                                     0……….1479
     MTU = 1500 bytes
                                        length ID fragflag offset
                                        =1500 =x     =1      =0

                                                                    1480…2959
     One large datagram becomes         length ID fragflag offset
             3 smaller datagrams.       =1500 =x     =1    =1480


                                        length ID fragflag offset
                                        =1040 =x     =0    =2960



Network Layer (2-89-90)                                                          4-146
IP Service - 1
        Delivery service of IP is minimal.

        IP provide provides an unreliable connectionless best
         effort service (also called: “datagram service”).
              Unreliable: IP does not make an attempt to recover lost
               packets
              Connectionless: Each packet (“datagram”) is handled
               independently. IP is not aware that packets between hosts
               may be sent in a logical sequence
              Best effort: IP does not make guarantees on the service (no
               throughput guarantee, no delay guarantee,…)

        Consequences:
              Higher layer protocols have to deal with losses or with
               duplicate packets.
              Higher layer protocols have to deal with losses or with
               duplicate packets.

Network Layer (2-89-90)                                                      4-147
IP Service - 2

         IP supports the following services:
                  
                      one-to-one        (unicast)
                  
                      one-to-all        (broadcast)
                  
                      one-to-several    (multicast)


         IP multicast also supports a many-to-many service.
         IP multicast requires support of other protocols
          (IGMP, multicast routing)




Network Layer (2-89-90)                                   148   4-148
ICMP: Internet Control Message Protocol

       Used by hosts & routers to
                                         Type   Code description
        communicate network-level        0      0    echo reply (ping)
        information                      3      0    dest. network unreachable
          error reporting:              3      1     dest host unreachable
            unreachable host, network,   3      2     dest protocol unreachable
            port, protocol               3      3     dest port unreachable
                                         3      6     dest network unknown
          echo request/reply (used
                                         3      7     dest host unknown
            by ping)                     4      0     source quench (congestion
       network-layer “above” IP:                     control - not used)
          ICMP msgs carried in IP
                                         8      0     echo request (ping)
                                         9      0     route advertisement
            datagrams                    10     0      router discovery
       ICMP message: type, code plus    11     0     TTL expired
        first 8 bytes of IP datagram     12     0      bad IP header
        causing error



Network Layer (2-89-90)                                                           4-149
Traceroute and ICMP

         Source sends series of            When ICMP message
          UDP segments to dest               arrives, source calculates
               First has TTL =1             RTT
               Second has TTL=2, etc.      Traceroute does this 3
               Unlikely port number         times
         When nth datagram arrives        Stopping criterion
          to nth router:                    UDP segment eventually
               Router discards datagram     arrives at destination host
               And sends to source an      Destination returns ICMP
                ICMP message (type 11,       “host unreachable” packet
                code 0)
                                             (type 3, code 3)
               Message includes name of    When source gets this
                router& IP address
                                             ICMP, stops.


Network Layer (2-89-90)                                                    4-150
IP addresses: how to get one?

       Q: How does host get IP address?

          IP addr. is configures into host by admin. in a file
             Wintel: control-panel->network->configuration-

              >tcp/ip->properties
             UNIX: /etc/rc.config



          DHCP: Dynamic Host Configuration Protocol     (RFC2131):

           dynamically get address from as server
             “plug-and-play”




Network Layer (2-89-90)                                               4-151
IP addressing: ICANN


      Q: How does an ISP get block of addresses?

      A: ICANN: Internet Corporation for Assigned
            Names and Numbers
             allocates addresses

             manages DNS

             assigns domain names, resolves disputes




Network Layer (2-89-90)                                 4-152
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.
         Support for mobile users who want to join network.


      DHCP overview:
               host broadcasts “DHCP discover” msg
               DHCP server responds with “DHCP offer” msg
               host requests IP address: “DHCP request” msg
               DHCP server sends address: “DHCP ack” msg
Network Layer (2-89-90)                                          4-153
DHCP client-server scenario


                                                  DHCP
                                                  server
                                                               223.1.2.1
                          A 223.1.1.1

                               223.1.1.2
                                     223.1.1.4   223.1.2.9

                          B
                                          223.1.3.27    223.1.2.2          arriving DHCP
                              223.1.1.3                             E      client needs
                                                                           address in this
                              223.1.3.1                223.1.3.2
                                                                           network




Network Layer (2-89-90)                                                                      4-154
DHCP client-server scenario
                                                                              arriving
           DHCP server: 223.1.2.5                                              client
                                             DHCP discover
                                              src : 0.0.0.0, 68
                                              dest.: 255.255.255.255,67
                                              yiaddr: 0.0.0.0
                                              transaction ID: 654

                                                 DHCP offer
                                                  src: 223.1.2.5, 67
                                                  dest: 255.255.255.255, 68
                                                  yiaddrr: 223.1.2.4
                                                  transaction ID: 654
                                                  Lifetime: 3600 secs
                            DHCP request
                              src: 0.0.0.0, 68
                              dest:: 255.255.255.255, 67
                              yiaddrr: 223.1.2.4
                              transaction ID: 655
                              Lifetime: 3600 secs
                                                DHCP ACK
                                                 src: 223.1.2.5, 67
                                                 dest: 255.255.255.255, 68
                                                 yiaddrr: 223.1.2.4
                                                 transaction ID: 655
                    time                         Lifetime: 3600 secs



Network Layer (2-89-90)                                                                  4-155
Chapter 4 Outline

       4.1 Introduction and Network Service Models
       4.2 Routing Principles
       4.3 Hierarchical Routing
       4.4 Routing in the Internet
       4.5 The Internet (IP) Protocol
       4.6 What’s Inside a Router?
       4.7 IPv6
       4.8 Multicast Routing
       4.9 Mobility

Network Layer (2-89-90)                              4-156
Router Architecture Overview

       Two key router functions:
          run routing algorithms/protocol (RIP, OSPF, BGP)
          switching datagrams from incoming to outgoing link




Network Layer (2-89-90)                                         4-157
Input Port Functions
                                                        Data link layer:
                               Physical layer:
                                                         e.g., Ethernet
                          bit-level reception
                                                         see chapter 5




     - function: lookup output port using routing table in input port memory
     - goal: complete input port processing at ‘line speed’
     - Queuing (buffering): if datagrams arrive faster than forwarding rate into
         switch fabric

Network Layer (2-89-90)                                                        4-158
Input Port Queuing (Buffering)

         Fabric slower than input ports combined -> queuing may occur
          at input queues
         Head-of-the-Line (HOL) blocking: queued datagram at front of
          queue prevents others in queue from moving forward
         queuing delay and loss due to input buffer overflow!




Network Layer (2-89-90)                                                  4-159
Three Types of Switching Fabrics




Network Layer (2-89-90)                       4-160
Switching Via Memory

        First generation routers:
         packet copied by system’s (single) CPU
         speed limited by memory bandwidth (2 bus
         crossings per datagram)

                           Input Port            Output Port
                                        Memory




                                                           System Bus


       Modern routers:
        input port processor performs lookup, copy into
        memory
        Cisco Catalyst 8500
Network Layer (2-89-90)                                                 4-161
Switching Via a Bus




        datagram from input port memory
         to output port memory via a shared
         bus
        bus contention: switching speed
         limited by bus bandwidth
        1 Gbps bus, Cisco 1900: sufficient
         speed for access and enterprise
         routers (not regional or backbone)


Network Layer (2-89-90)                         4-162
Switching Via An Interconnection Network


         overcome bus bandwidth limitations
         Banyan networks, 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 Gbps through the
          interconnection network



Network Layer (2-89-90)                                      4-163
Output Ports




          Buffering required when datagrams arrive from fabric
           faster than the transmission rate
          Scheduling discipline chooses among queued datagrams for
           transmission
          queuing (delay) and loss due to output port buffer overflow!

Network Layer (2-89-90)                                                   4-164
How much buffering?

       RFC 3439 rule of thumb:
       average buffering = “typical” RTT X link
        capacity C
               e.g., RTT=250 msec and C = 10 Gps link:
                Buffer=2.5 Gbit.

         Recent recommendation: with N flows,
                      RTT. C
          buffering =
                              N



Network Layer (2-89-90)                                   4-165
Chapter 4 Outline

       4.1 Introduction and Network Service Models
       4.2 Routing Principles
       4.3 Hierarchical Routing
       4.4 Routing in the Internet
       4.5 The Internet (IP) Protocol
       4.6 What’s Inside a Router?
       4.7 IPv6
       4.8 Multicast Routing
       4.9 Mobility

Network Layer (2-89-90)                              4-166
IPv6

       Initial motivation: 32-bit address space
        completely allocated by 2008.
       Additional motivation:
               header format helps speed processing/forwarding
               header changes to facilitate QoS
               new “anycast” address: route to “best” of several
                replicated servers
         IPv6 datagram format:
               fixed-length 40 byte header
               no fragmentation allowed

Network Layer (2-89-90)                                             4-167
IPv6 Header

               Priority: identify priority among datagrams in flow
               Flow Label: identify datagrams in same “flow.”
                            (concept of“flow” not well defined).
               Next header: identify upper layer protocol for data




Network Layer (2-89-90)                                              4-168
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, e.g. “Packet Too Big”
               multicast group management functions




Network Layer (2-89-90)                                           4-169
Transition From IPv4 To IPv6

         Not all routers can be upgraded simultaneous
               no “flag days”
               How will the network operate with mixed IPv4 and
                IPv6 routers?
         Two proposed approaches:
               Dual Stack: some routers with dual stack (v6, v4)
                can “translate” between formats
               Tunneling: IPv6 carried as payload in IPv4
                datagram among IPv4 routers



Network Layer (2-89-90)                                             4-170
Dual Stack Approach

                          A              B             C      D               E              F

                     IPv6               IPv6          IPv4   IPv4          IPv6          IPv6

                              Flow: X        Src:A                  Src:A         Flow: ??
                              Src: A         Dest: F                Dest: F       Src: A
                              Dest: F                                             Dest: F


                              data             data                 data          data

                          A-to-B:            B-to-C:                B-to-C:       B-to-C:
                           IPv6               IPv4                   IPv4          IPv6




Network Layer (2-89-90)                                                                          4-171
Tunneling-Analogy
                          A      B                E     F
     Logical view:                      tunnel

                          IPv6   IPv6            IPv6   IPv6




        Analogy:




Network Layer (2-89-90)                                        4-172
Tunneling-Physical View
                           A             B                                              E             F
                                                              tunnel
     Logical view:
                          IPv6           IPv6                                        IPv6          IPv6

                           A              B               C              D              E             F
   Physical view:
                          IPv6           IPv6          IPv4            IPv4          IPv6          IPv6

                               Flow: X        Src:B                           Src:B         Flow: X
                               Src: A         Dest: E                         Dest: E       Src: A
                               Dest: F                                                      Dest: F
                                                Flow: X                       Flow: X
                                                Src: A                        Src: A
                               data             Dest: F                       Dest: F       data


                                                data                          data


                               A-to-B:         B-to-C:                      B-to-C:         E-to-F:
                                IPv6         IPv6 inside                  IPv6 inside        IPv6
                                                IPv4                         IPv4
Network Layer (2-89-90)                                                                                   4-173
Chapter 4 Outline

       4.1 Introduction and Network Service Models
       4.2 Routing Principles
       4.3 Hierarchical Routing
       4.4 Routing in the Internet
       4.5 The Internet (IP) Protocol
       4.6 What’s Inside a Router?
       4.7 IPv6
       4.8 Multicast Routing
       4.9 Mobility

Network Layer (2-89-90)                              4-174
Unicast

         In unicast routing, the router forwards the
          received packet through only one of its interfaces.




Network Layer (2-89-90)                                         4-175
Multicast
           In multicast routing, the router may forward the
            received packet through several of its interfaces.




Network Layer (2-89-90)                                          4-176
Multicast: one sender to many receivers

         Multicast: act of sending datagram to multiple
          receivers with single “transmit” operation
            analogy: one teacher to many students



         How to achieve multicast:
              Multiple unicasts
              Application-Layer Multicast
              Network multicast




Network Layer (2-89-90)                                    4-177
Multicasts

         Multiple unicast (One-to-All unicast)
               Using an underlying unicast network layer
               Duplicated at the sender transport layer
         Application-layer multicast
               Involving the receivers in the replication and forwarding
                of data.
         Explicit multicast
               Network player supports multicast
               Data is replicated at the network router




Network Layer (2-89-90)                                                     4-178
1- Multiple Unicasts

         Source sends 3 unicast
          datagrams,
         One addressed to each
          of 3 receivers




                                                 Source




Network Layer (2-89-90)                                   4-179
2- Application-layer Multicast

         End systems involved
          in multicast copy and
          forward unicast
          datagrams among
          themselves
         example: p2p file
          sharing




Network Layer (2-89-90)                       4-180
3- Network Multicast

         Router actively
          participate in                      ♪
                                                      ♪
          multicast, making
          copies of packets as
          needed and forwarding                           ♪
                                          ♪
          towards multicast
          receivers
         Multicast routers ♪             ♪               ♪
          duplicate and forward                   ♪
          multicast datagrams



Network Layer (2-89-90)                                       4-181
Multicast Uses

        Bulk data transfer (software updates, mailing list
         distribution, stock updates)
        Streamed Continuous Media (audio/visual
         conferences)
        Shared Application Data (shared whiteboard)
        Interactive Gaming or Simulations (very intensive)




Network Layer (2-89-90)                                       4-182
Internet Multicast Service Model

         Multicast group concept:
          use of indirection
            Sending host (source)

             addresses IP
             datagram to multicast     multicast
                                         group
             group.                  226.17.30.197
            Routers forward

             multicast datagrams                     Source
             to hosts that have
             “joined” that
             multicast group


Network Layer (2-89-90)                                   4-183
Multicast Groups

        Class D Internet addresses reserved for multicast:
                1110      Multicast Group Address (ID) -24 bits

        Host group semantics:
                
                    anyone can “join” (receive) multicast group
                
                    anyone can send to multicast group
                
                    no network-layer identification to hosts of members

        Needed: infrastructure to deliver multicast-addressed
         datagrams to all hosts that have joined that multicast
         group.


Network Layer (2-89-90)                                                   4-184
Joining a Multicast Group: Two-Step Process

        Local: host informs local multicast router of desire to
         join a group:
             IGMP (Internet Group Management Protocol)
        Wide Area: local router interacts with other routers
         to receive multicast datagram flow:
             many protocols (e.g., DVMRP, MOSPF, PIM)

                               ♪:router with attached group member
                          IGMP                         IGMP
                                 ♪                      ♪
                                     DVMRP or MOSPF or PIM       IGMP
                                                             ♪
                                                      ♪
                                                      IGMP
                     multicast group
Network Layer (2-89-90)                                                 4-185
IGMP: Internet Group Management Protocol

          Host: sends IGMP report when application joins
           multicast group.
             IP_ADD_MEMBERSHIP socket option

             host need not explicitly “unjoin” group when

              leaving
          Router: sends IGMP query at regular intervals
             host belonging to a multicast group must reply

              to query


                                       IGMP Report

                          IGMP Query



Network Layer (2-89-90)                                        4-186
IGMP
       IGMP-v1                              IGMP-v2: additions include
        router: Host                        group-specific Query
         Membership Query                    Leave Group message
         Message broadcast on                      last host replying to Query
         LAN to all hosts                           can send explicit Leave
        host: Host                                 Group message
         Membership Report                         router performs group-
                                                    specific query to see if any
         message to indicate
                                                    hosts left in group
         group membership                          RFC 2236
                randomized delay
                 before responding          IGMP-v3: under development as
                implicit leave via no          Internet draft
                 reply to Query
          RFC 1112
Network Layer (2-89-90)                                                       4-187
IGMP v2 Message Types

       IGMP Message Type         Sent By                     Purpose
           Membership query:      Router    Query multicast groups joined by attached
                 General                                      hosts
           Membership query:      Router    Query if specific multicast group joined by
                 Specific                                attached hosts
           Membership report       Host    Report host wants to join or is joined to given
                                                         multicast group
               Leave Group         Host         Report leaving given multicast group




                                                    Report


                               Query




Network Layer (2-89-90)                                                                      4-188
IGMP Message Format




Network Layer (2-89-90)                    Computer Networks   4-189
Multicast Routing

      Objectives
       Every member receives EXACTLY ONE copy of
        the packet
       Non-members receive nothing
       No loops in route
       Optimal path from source to each destination.

      Terminology
       Spanning Tree: Source is the root, group members
        are the leaves.
       Shortest Path Spanning Tree: Each path from root
        to a leaf is the shortest according to some metric

Network Layer (2-89-90)                                      4-190
Multicast Connections
         Goal: find a tree (or trees) connecting routers
          having local multicast group members
               tree: not all paths between routers used
               Group-shared tree: same tree used by all group members
               Source-based tree: different tree from each sender to
                receivers

                                                        ♪
                     ♪         ♪
                                                ♪
                                                              ♪
                                                    ♪
                                            ♪
                                       ♪
                Group- Shared tree
Network Layer (2-89-90)                                                  4-191
Tree Approaches

          Source-based tree: one tree per source
               shortest path trees
               reverse path forwarding
          Group-shared tree: group uses one tree
               minimal spanning (Steiner)
               center-based trees
                                    ♪, ♪: sources
                                                            ♪
                          ♪   ♪
                                                    ♪
                                                                ♪
                                                        ♪
                                              ♪
                                       ♪
                Source-based trees
Network Layer (2-89-90)                                             4-192
Shortest Path TreeSource-Based

         Multicast forwarding tree: tree of shortest path
          routes from source to all receivers
               Dijkstra’s algorithm.


                          R1       ♪           Source
                          1
                                       2                     ♪:router with attached
                                           ♪   R4            group member
                    R2
                                           5
                                                         i
                    3          4                   R5        link used for forwarding,
                                                             i indicates order link
                ♪                              6             added by algorithm
          R3
                                                    R7
                                   ♪ R6

Network Layer (2-89-90)                                                                  4-193
Reverse Path ForwardingSource-Based


          Rely on router’s knowledge of unicast shortest path
           from it to sender
          Each router has simple forwarding behavior:
             if (multicast datagram received on incoming link
              on shortest path back to center)
             then flood datagram onto all outgoing links
             else ignore datagram




Network Layer (2-89-90)                                          4-194
Reverse Path Forwarding: Example

         Result is a source-specific reverse Shortest Path
          Tree
         May be a bad choice with asymmetric links.

                          R1   ♪          Source

                                                    ♪:router with attached
                                      ♪   R4        group member
                   R2


                                          R5        datagram will not be
                                                    Forwarded
          R3   ♪
                                               R7   datagram will be
                               ♪ R6                 forwarded

Network Layer (2-89-90)                                                      4-195
Reverse Path Forwarding: Pruning
         Forwarding tree contains sub-trees with no
          multicast group members
               No need to forward datagrams down sub-tree
               “prune” messages sent upstream by router with no
                downstream group members


                          R1   ♪              Source

                                                            ♪:router with attached
                                          ♪   R4            group member
                    R2
                                      P
                                                        P   prune message
                                              R5

                ♪                             P             links with multicast
          R3
                                                   R7       forwarding
                               ♪ R6
Network Layer (2-89-90)                                                              4-196
Shared-Tree: Steiner Tree

          Steiner Tree: minimum cost tree connecting all
           routers with attached group members
          problem is NP-complete
          excellent heuristics exists
          not used in practice:
               computational complexity
               information about entire network needed
               monolithic: rerun whenever a router needs to
                join/leave




Network Layer (2-89-90)                                        4-197
Center-Based Trees

          Single delivery tree shared by all
          One router identified as “center” of tree
          to join:
               edge router sends unicast join-message addressed to
                center router
               join-message “processed” by intermediate routers and
                forwarded towards center
               join-message either hits existing tree branch for this
                center, or arrives at center
               path taken by join-message becomes new branch of tree
                for this router



Network Layer (2-89-90)                                                  4-198
Center-Based Trees

         Suppose R6 chosen as center:


                              R1   ♪               Source

                                       3                         ♪:router with attached
                                               ♪   R4            group member
                  R2

                                                             1   path order in which
                                                   R5
                                           2                     join messages
             ♪            1                        P             generated
        R3
                                                        R7
                                   ♪ R6


Network Layer (2-89-90)                                                                   4-199
Multicast Routing Protocols




Network Layer (2-89-90)                         4-200
DVMRP - 1


          DVMRP: distance vector multicast routing
           protocol, RFC1075
          flood and prune: reverse path forwarding, source-
           based tree
               RPF tree based on DVMRP’s own routing tables
                constructed by communicating DVMRP routers
               no assumptions about underlying unicast
               initial datagram to multicast group flooded everywhere
                via RPF
               routers not wanting group: send upstream prune
                messages.



Network Layer (2-89-90)                                                  4-201
DVMRP - 1

         Soft state: DVMRP router periodically (1 min.)
          “forgets” branches are pruned:
               multicast data again flows down unpruned branch
               downstream router: reprune or else continue to receive data
         Routers can quickly redraft to tree
               following IGMP join at leaf
         Odds and ends
               commonly implemented in commercial routers
               Mbone routing done using DVMRP.




Network Layer (2-89-90)                                                       4-202
Tunneling

       Q: How to connect “islands” of multicast routers in a
         “sea” of unicast routers?
                  ♪                           ♪   ♪                      ♪



                                   ♪                           ♪
                          physical topology           logical topology

       multicast datagram encapsulated inside “normal” (non-
        multicast-addressed) datagram.
       normal IP datagram sent thru “tunnel” via regular IP unicast to
        receiving multicast router.
       receiving multicast router unencapsulates to get multicast
        datagram
Network Layer (2-89-90)                                                      4-203
PIM: Protocol Independent Multicast


        Not dependent on any specific underlying unicast
         routing algorithm (works with all)
        Two different multicast distribution scenarios:
           1-Dense                 2-Sparse:
            group members          # networks with group
             densely packed, in      members small wrt #
             “close” proximity.      interconnected networks
            bandwidth more         group members “widely
             plentiful               dispersed”
                                    bandwidth not plentiful


Network Layer (2-89-90)                                        4-204
Consequences of Sparse-Dense Dichotomy:


      Dense:                         Sparse:
         group membership by           no membership until
          routers assumed until          routers explicitly join
          routers explicitly prune      receiver- driven
         data-driven construction       construction of multicast
          on multicast tree (e.g.,       tree (e.g., center-based)
          RPF)                          bandwidth and non-group-
         bandwidth and non-             router processing
          group-router processing        conservative
          profligate



Network Layer (2-89-90)                                          4-205
PIM- Dense Mode


       Flood-and-prune RPF, similar to DVMRP but:

        underlying unicast protocol provides RPF info
         for incoming datagram
        less complicated (less efficient) downstream
         flood than DVMRP reduces reliance on
         underlying routing algorithm
        has protocol mechanism for router to detect it
         is a leaf-node router



Network Layer (2-89-90)                                   4-206
PIM - Sparse Mode

         center-based approach                                    ♪
                                                              R1
         router sends join msg
          to rendezvous point                                      join       ♪
                                                  R2                              R4
          (RP)
               intermediate routers
                                                                                  R5
                update state and                                       join
                forward join                  ♪        join                       P
                                         R3
         after joining via RP,                                    ♪ R6                R7

          router can switch to
                                         all data multicast
          source-specific tree           from rendezvous
                                                                          rendezvous
                                                                             point
               increased performance:          point
                less concentration,
                shorter paths
Network Layer (2-89-90)                                                                 4-207
PIM - Sparse Mode

      sender(s):                                                   ♪
                                                              R1
       unicast data to RP,
        which distributes down                                     join       ♪
                                                  R2                              R4
        RP-rooted tree
       RP can extend mcast
                                                                                  R5
                                                                       join
        tree upstream to
                                              ♪        join                       P
        source                           R3
                                                                                       R7
       RP can send stop msg
                                                                   ♪ R6
        if no attached                   all data multicast
                                                                          rendezvous
        receivers                        from rendezvous
                                                                             point
                                                point
               “no one is listening!”


Network Layer (2-89-90)                                                                 4-208
Chapter 4 roadmap

       4.1 Introduction and Network Service Models
       4.2 Routing Principles
       4.3 Hierarchical Routing
       4.4 Routing in the Internet
       4.5 The Internet (IP) Protocol
       4.6 What’s Inside a Router?
       4.7 IPv6
       4.8 Multicast Routing
       4.9 Mobility

Network Layer (2-89-90)                              4-209
What is mobility?

          spectrum of mobility, from the network perspective:


        no mobility                                   high mobility




       mobile user, using    mobile user,    mobile user, passing
       same access point     connecting/     through multiple
                             disconnecting   access point while
                             from network    maintaining ongoing
                             using DHCP.     connections (like cell
                                             phone)


Network Layer (2-89-90)                                               4-210
Mobility: Vocabulary

       home network: permanent      home agent: entity that will
       “home” of mobile             perform mobility functions on
       (e.g., 128.119.40/24)
                                    behalf of mobile, when mobile
                                    is remote




                                     wide area
                                     network
    Permanent address:
    address in home
    network, can always be
    used to reach mobile
    e.g., 128.119.40.186          correspondent




Network Layer (2-89-90)                                             4-211
Mobility: more vocabulary

                                                            visited network: network
                     Permanent address: remains             in which mobile currently
                     constant (e.g., 128.119.40.186)        resides (e.g., 79.129.13/24)

                              Care-of-address: address
                              in visited network.
                              (e.g., 79,129.13.2)


                                                wide area
                                                network

                                                                    home agent: entity in
                                                                    visited network that
                                                                    performs mobility
      correspondent: wants                                          functions on behalf
      to communicate with                                           of mobile.
      mobile
Network Layer (2-89-90)                                                                4-212
How do you contact a mobile friend:


     Consider friend frequently changing   I wonder where
       addresses, how do you find her?     Ali moved to?
         search all phone
          books?
         call her parents?
         expect her to let you
          know where he/she is?




Network Layer (2-89-90)                                4-213
Mobility: approaches

           Let routing handle it: routers advertise permanent
            address of mobile-nodes-in-residence via usual
            routing table exchange.
              routing tables indicate where each mobile located

              no changes to end-systems

           Let end-systems handle it:
              indirect routing: communication from

               correspondent to mobile goes through home
               agent, then forwarded to remote
              direct routing: correspondent gets foreign

               address of mobile, sends directly to mobile

Network Layer (2-89-90)                                        4-214
Mobility: approaches

           Let routing handle it: routers advertise permanent
            address of mobile-nodes-in-residence via usual
                                  not
                                scalable
            routing table exchange.
                              to millions of
              routing tables indicate where each mobile located
                                 mobiles
              no changes to end-systems

           let end-systems handle it:
              indirect routing: communication from

               correspondent to mobile goes through home
               agent, then forwarded to remote
              direct routing: correspondent gets foreign

               address of mobile, sends directly to mobile

Network Layer (2-89-90)                                        4-215
Mobility: registration

                                                        visited network
                    home network


                                                                1
                                         2
                                     wide area
                                     network
                                                              mobile contacts
                          foreign agent contacts home         foreign agent on
                          agent home: “this mobile is         entering visited
                          resident in my network”             network

           End result:
            Foreign agent knows about mobile
            Home agent knows location of mobile
Network Layer (2-89-90)                                                     4-216
Mobility via Indirect Routing

                                                     foreign agent
                                                     receives packets,
                          home agent intercepts      forwards to mobile
                          packets, forwards to                            visited
                          foreign agent                                   network
     home
     network
                                                                    3
                                         wide area
                                         network
                                               2
                                  1
           correspondent                                     4
           addresses packets
                                                                 mobile replies
           using home address
                                                                 directly to
           of mobile
                                                                 correspondent


Network Layer (2-89-90)                                                       4-217
Indirect Routing: comments

          Mobile uses two addresses:
             permanent address: used by correspondent (hence

              mobile location is transparent to correspondent)
             care-of-address: used by home agent to forward

              datagrams to mobile
          foreign agent functions may be done by mobile itself
          triangle routing: correspondent-home-network-
           mobile
             inefficient when

            correspondent, mobile
            are in same network

Network Layer (2-89-90)                                       4-218
Forwarding datagrams to remote mobile


                                                        foreign-agent-to-mobile packet
           packet sent by home agent to foreign            dest: 128.119.40.186
           agent: a packet within a packet

           dest: 79.129.13.2     dest: 128.119.40.186




   Permanent address:
   128.119.40.186

                                                                   Care-of address:
                                                                        79.129.13.2
                  dest: 128.119.40.186
                 packet sent by
                 correspondent

Network Layer (2-89-90)                                                               4-219
Indirect Routing: moving between networks


          suppose mobile user moves to another
           network
                registers with new foreign agent
                new foreign agent registers with home agent
                home agent update care-of-address for mobile
                packets continue to be forwarded to mobile (but
                 with new care-of-address)
          Mobility, changing foreign networks
           transparent: on going connections can be
           maintained!

Network Layer (2-89-90)                                            4-220
Mobility via Direct Routing

                                                      foreign agent
                                                      receives packets,
                          correspondent forwards      forwards to mobile
                          to foreign agent                                 visited
                                                                           network
     home
     network                                                         4
                                          wide area
                                  2       network
                                                      3
           correspondent              1                       4
           requests, receives
                                                                  mobile replies
           foreign address of
                                                                  directly to
           mobile
                                                                  correspondent


Network Layer (2-89-90)                                                        4-221
Mobility via Direct Routing: comments


        overcome triangle routing problem
        non-transparent to correspondent:
         correspondent must get care-of-address
         from home agent
                What happens if mobile changes networks?




Network Layer (2-89-90)                                     4-222
Mobile IP

       RFC 3220
       has many features we’ve seen:
               home agents, foreign agents, foreign-agent
                registration, care-of-addresses, encapsulation
                (packet-within-a-packet)
         three components to standard:
               agent discovery
               registration with home agent
               indirect routing of datagrams


Network Layer (2-89-90)                                          4-223
Mobile IP: agent discovery

          agent advertisement: foreign/home agents advertise
           service by broadcasting ICMP messages (typefield = 9)
                           0               8             16          24

                               type = 9    code = 0               checksum
                                           =9                     =9
    H,F bits: home                                                                     standard
    and/or foreign agent                         router address                       ICMP fields


    R bit: registration
    required               type = 16           length         sequence #
                                                           RBHFMGV
                               registration lifetime                      reserved
                                                             bits                    mobility agent
                                                                                     advertisement
                                          0 or more care-of-                           extension

                                              addresses
Network Layer (2-89-90)                                                                               4-224
Mobile IP: registration example

                                                                         visited network: 79.129.13/24
       home agent            foreign agent
     HA: 128.119.40.7       COA: 79.129.13.2      ICMP agent adv.                      Mobile agent
                                                   COA: 79.129.13.2                  MA: 128.119.40.186
                                                   ….

                                                  registration req.
                          registration req.
                                                   COA: 79.129.13.2
                           COA: 79.129.13.2        HA: 128.119.40.7
                           HA: 128.119.40.7        MA: 128.119.40.186
                           MA: 128.119.40.186      Lifetime: 9999
                           Lifetime: 9999          identification:714
                           identification: 714     ….
                           encapsulation format
                           ….


                          registration reply
                 time      HA: 128.119.40.7
                                                  registration reply
                           MA: 128.119.40.186
                           Lifetime: 4999          HA: 128.119.40.7
                           Identification: 714     MA: 128.119.40.18 6
                           encapsulation format    Lifetime: 4999
                           ….                      Identification: 714
                                                   ….


Network Layer (2-89-90)                                                                              4-225
Network Layer: summary

      What we’ve covered:
       network layer services
       routing principles: link state and
        distance vector
       hierarchical routing
       IP
       Internet routing protocols RIP,
        OSPF, BGP
       what’s inside a router?
       IPv6
       mobility


Network Layer (2-89-90)                      4-226

More Related Content

PDF
Chapter4[one.]
PPT
Networing basics
ZIP
2 applications.key
PPT
circuit-packet
PDF
Seamless and Secured wide Fidelity enhancement in moving vehicles Using Eeack...
PDF
Networking lecture 4 Data Link Layer by Mamun sir
PDF
Advanced Computing Techonologies
PPT
High speed Networking
Chapter4[one.]
Networing basics
2 applications.key
circuit-packet
Seamless and Secured wide Fidelity enhancement in moving vehicles Using Eeack...
Networking lecture 4 Data Link Layer by Mamun sir
Advanced Computing Techonologies
High speed Networking

What's hot (20)

PDF
Transmitting urgent data using ANKM method.
PPT
ZIP
4 network.key
ZIP
3 transport.key
PPT
high speed network
PDF
Internet of things protocols for resource constrained applications
DOCX
บทที่ 2 Mobile Aplication
PPTX
PDF
Use of NS-2 to Simulate MANET Routing Algorithms
PDF
CS6003 ADHOC & SENSOR NETWORKS
PPTX
PPT
Packet switching
PPT
CCNA PPP and Frame Relay
PDF
Software-Defined Networking Changes for the Paradigm for Mission-Critical Ope...
PPTX
Ch 02 (1)
PPT
Ieee 802.11 standard
PDF
Advanced Networking on GloMoSim
ZIP
5 data link-lan.key
ZIP
1 introduction.key
Transmitting urgent data using ANKM method.
4 network.key
3 transport.key
high speed network
Internet of things protocols for resource constrained applications
บทที่ 2 Mobile Aplication
Use of NS-2 to Simulate MANET Routing Algorithms
CS6003 ADHOC & SENSOR NETWORKS
Packet switching
CCNA PPP and Frame Relay
Software-Defined Networking Changes for the Paradigm for Mission-Critical Ope...
Ch 02 (1)
Ieee 802.11 standard
Advanced Networking on GloMoSim
5 data link-lan.key
1 introduction.key
Ad

Viewers also liked (8)

PPTX
Network Layer Part 4
PPT
Computer network (Lecture 2)
PPT
Computer network (Lecture 1)
PPT
2008118090324 hk
PPTX
Ch 20 UNICAST ROUTING SECTION 2
PPT
Multicasting and multicast routing protocols
PPT
I Pv6 Addressing
PPT
Multicast Routing Protocols
Network Layer Part 4
Computer network (Lecture 2)
Computer network (Lecture 1)
2008118090324 hk
Ch 20 UNICAST ROUTING SECTION 2
Multicasting and multicast routing protocols
I Pv6 Addressing
Multicast Routing Protocols
Ad

Similar to Chp4 (20)

PPT
PPTX
Chapter_4_V7.01 Network Layer Batch 3.pptx
PPT
5. telecomm & network security
PDF
Lecture14
PPT
Chapter4 Network
PDF
05 network
PDF
Chapter8 6up
PPTX
packets between same source-dest pair may take different paths
PPTX
Basic networking 07-2012
PDF
Wireless network basics
PPTX
Module_3_Part_3.pptx
PDF
4. network layer
PPT
Unit i packet switching networks
PDF
Chapter4 network layer
PPT
Computer Networking network layer chapter 4
PPT
Chapter_4_V6.11 Network layer.ppt
PPTX
Chapter 1 overview-stij3053 - Network Design
PPT
Cn osi model
PPTX
OSI REFRENCE MODEL by- Mujmmil Shaikh
PDF
Network protocols
Chapter_4_V7.01 Network Layer Batch 3.pptx
5. telecomm & network security
Lecture14
Chapter4 Network
05 network
Chapter8 6up
packets between same source-dest pair may take different paths
Basic networking 07-2012
Wireless network basics
Module_3_Part_3.pptx
4. network layer
Unit i packet switching networks
Chapter4 network layer
Computer Networking network layer chapter 4
Chapter_4_V6.11 Network layer.ppt
Chapter 1 overview-stij3053 - Network Design
Cn osi model
OSI REFRENCE MODEL by- Mujmmil Shaikh
Network protocols

Chp4

  • 1. Computer Networks Network Layer Network Layer (2-89-90) 4-1
  • 2. Chapter 4 Outline 4.1 Introduction and Network Service Models 4.2 Routing Principles 4.3 Hierarchical Routing 4.4 Routing in the Internet 4.5 The Internet (IP) Protocol 4.6 What’s Inside a Router 4.7 IPv6 4.8 Multicast Routing 4.9 Mobility Network Layer (2-89-90) 4-3
  • 3. Network Layer Functions application  transport packet from transport network network data link sending to receiving hosts data link physical physical  network layer protocols in every host, router three important functions:  path determination: route taken by packets from source to dest. (Routing Algorithms) application transport  forwarding: move packets network data link from router’s input to physical appropriate router output  call setup: some network architectures require router call setup along path before data flows Network Layer (2-89-90) 4-4
  • 4. Network Service Model Q: What service model for “channel” transporting packets from sender to The most important receiver? abstraction provided by network layer: Services  guaranteed bandwidth? virtual circuit  preservation of inter-packet or timing (no jitter)? datagram?  loss-free delivery?  in-order delivery?  congestion feedback to sender? Network Layer (2-89-90) 4-5
  • 5. Virtual circuits “source-to-destination path behaves much like telephone circuit”  performance-wise  network actions along source-to-destination path  call setup, teardown for each call before data can flow  each packet carries VC identifier (not destination host ID)  every router on source-destination path maintains “state” for each passing connection  transport-layer connection only involved two end systems  Link and router resources (bandwidth, buffers) may be allocated to VC (dedicated resources = predictable service)  to get circuit-like performance. Network Layer (2-89-90) 4-6
  • 6. VC implementation  A VC consists of: 1. path from source to destination 2. VC numbers, one number for each link along path 3. entries in forwarding tables in routers along path  Packet belonging to VC carries VC number (rather than destination address)  VC number can be changed on each link.  New VC number comes from forwarding table Network Layer (2-89-90) 4-7
  • 7. Forwarding table VC number 12 a 22 32 1 3 2 Interface number Routers maintain connection state information! Forwarding table in router a Incoming interface Incoming VC # Outgoing interface Outgoing VC # 1 12 3 22 2 63 1 18 3 7 2 17 1 97 3 87 … … … … Network Layer (2-89-90) 4-8
  • 8. Virtual Circuits: Signaling Protocols  used to setup, maintain teardown VC  used in ATM, frame-relay, X.25  not used in today’s Internet 6. Receive data application 3. Accept call transport 2. Incoming call network data link 5. Data flow begins physical 4. Call connected application 1. Initiate call transport network data link physical Network Layer (2-89-90) 4-9
  • 9. Datagram networks: the Internet model  no call setup at network layer  routers: no state about end-to-end connections  no network-level concept of “connection”  packets forwarded using destination host address  packets between same source-destination pair may take different paths 2. Receive Data application transport network data link physical application 1. Send Data transport network data link physical Network Layer (2-89-90) 4-10
  • 10. Network Layer Service Models: Guarantees ? Congestion Network Service Architecture Model Bandwidth Loss Order Timing feedback Internet best effort none no no no no (inferred via loss) ATM CBR constant yes yes yes no UBR: Unspecified bit rate rate congestion ABR: Available bit rate CBR: Constant bit rate VBR: Variable bit rate ATM VBR guaranteed yes yes yes no rate congestion ATM ABR guaranteed no yes no yes minimum ATM UBR none no yes no no  Internet model being extended: Integrated services, Differentiated Services  Chapter 6 Network Layer (2-89-90) 4-11
  • 11. Datagram or VC Network: why? Internet (Datagram) ATM (Virtual Circuit)  data exchange among  evolved from telephony computers  human conversation:  “elastic” service, no strict  strict timing, reliability timing req. requirements  “smart” end systems  need for guaranteed (computers) service  can adapt, perform  “dumb” end systems control, error recovery  telephones  simple inside “network”,  complexity inside complexity at “edge” network  many link types  different characteristics  uniform service is difficult Network Layer (2-89-90) 4-17
  • 12. Buffering in IP routers Router Internet Router Network Network Interface Interface  Buffer size  Dropping packets Space for bursts of  When? packets  What? Latency Network Layer (2-89-90) 4-18
  • 13. FIFO Queueing in the Router (Drop Tail) Network Network Interface Interface  Single queue maintained Network Layer (2-89-90) 4-19
  • 14. FIFO Queueing in the Router (Drop Tail) Network Network Interface Interface  Single queue maintained  Dequeue from head Network Layer (2-89-90) 4-20
  • 15. FIFO Queueing in the Router (Drop Tail) Network Network Interface Interface  Single queue maintained  Dequeue from head  Enqueue at tail Network Layer (2-89-90) 4-21
  • 16. FIFO Queueing in the Router (Drop Tail) Network Network Interface Interface  Single queue maintained  Dequeue from head  Enqueue at tail  When full Network Layer (2-89-90) 4-22
  • 17. FIFO Queueing in the Router (Drop Tail) Network Network Interface Interface  Single queue maintained  Dequeue from head  Enqueue at tail  When full drop arriving packet (drop-tail) Network Layer (2-89-90) 4-23
  • 18. Slow Feedback from Drop Tail  Feedback comes when buffer is completely full  … even though the buffer has been filling for a while  Plus, the filling buffer is increasing RTT  … and the variance in the RTT  Might be better to give early feedback  Get one or two flows to slow down, not all of them  Get these flows to slow down before it is too late Network Layer (2-89-90) 4-24
  • 19. Queue Management  Performance Degradation in current TCP Congestion Control  Multiple packet loss  Low link utilization  Congestion collapse  The role of the router (i.e., network)  Control congestion effectively with a network  Allocate bandwidth fairly Network Layer (2-89-90) 4-25
  • 20. Active Queue Management  Goals:  Better congestion notification for responsive flows (i.e. TCP)  Maintain shorter queues  Fairness in drops (proportional) Network Layer (2-89-90) 4-26
  • 21. Random Early Detection (RED)  Invented by Sally Floyd and Van Jacobson in the early 1990s, differs from the DECbit in two major ways  Notification is implicit  just drop the packet (TCP will timeout)  could make explicit by marking the packet  Early random drop  rather than wait for queue to become full, drop each arriving packet with some drop probability whenever the queue length exceeds some drop level Network Layer (2-89-90) 4-27
  • 22. Random Early Detection (RED).  Basic idea of RED  Router notices that the queue is getting build-up.  Randomly drops or marks arriving packets (before queue gets full).  Packet drop signals a congestion to the source.  Packet drop probability  Drop probability increases as queue length increases  If buffer is below some level, don’t drop anything  … otherwise, set drop probability as function of queue Network Layer (2-89-90) 4-28
  • 23. RED Details  Compute average queue length (Geometric Moving Average) n AvgLenn +1 = (1 − α ) × AvgLenn + α × SampleLenn = ∑ α × (1 − α ) n −i SampleLeni i =1 0 < α < 1 (usually 0.002) SampleLen is queue length each time a packet arrives. MaxThreshold MaxTh MinTh MinThreshold SampleLen AvgLen Network Layer (2-89-90) 4-29
  • 24. RED Details.  On arrival of a packet: calculate AvgLen if AvgLen <= MinTh then enqueue arriving packet if MinTh < AvgLen < MaxTh then calculate probability P drop arriving packet with probability P if AvgLen => MaxTh then drop arriving packet Network Layer (2-89-90) 4-30
  • 25. RED Details..  Computing probability P if : min Th < AvgLen < max Th max P × ( AvgLen − min Th ) p AvgLen = max Th − min Th p AvgLen minTh maxTh P= 1 − count × p AvgLen 1 maxP p AvgLen AvgLen AvgLen count counts how long we've been in minTh < AvgLen < maxTh since we last dropped a packet. i.e. drops are spaced out in time, reducing likelihood of re-entering slow-start. Network Layer (2-89-90) 4-31
  • 26. RED Detail…  Weighted Running Average Queue Length Average Queue Length Drop probability Max Queue Size Forced drop Max Threshold Probabilistic drops Min Threshold No drops Time Network Layer (2-89-90) 4-32
  • 27. Properties of RED  Drops packets before queue is full  In the hope of reducing the rates of some flows  Drops packet in proportion to each flow’s rate  High-rate flows have more packets  … and, hence, a higher chance of being selected  Drops are spaced out in time  Which should help desynchronize the TCP senders  Tolerant of burstiness in the traffic  By basing the decisions on average queue length Network Layer (2-89-90) 4-33
  • 28. Tuning RED  MaxP is typically set to 0.02, meaning that when the average queue size is halfway between the two thresholds, the gateway drops roughly one out of 100 packets.  If traffic is bursty, then MinThreshold should be sufficiently large to allow link utilization to be maintained at an acceptably high level.  Difference between two thresholds should be larger than the typical increase in the calculated average queue length in one RTT; setting MaxThreshold to twice MinThreshold is reasonable for traffic on today’s Internet. Network Layer (2-89-90) 34 4-34
  • 29. Problems With RED  Hard to get the tunable parameters just right  How early to start dropping packets?  What slope for the increase in drop probability?  What time scale for averaging the queue length?  Sometimes RED helps but sometimes not  If the parameters aren’t set right, RED doesn’t help  And it is hard to know how to set the parameters  RED is implemented in practice  But, often not used due to the challenges of tuning right  Many variations  With cute names like “Blue” and “FRED”… Network Layer (2-89-90) 4-35
  • 30. Explicit Congestion Notification  Early dropping of packets  Good: gives early feedback  Bad: has to drop the packet to give the feedback  Explicit Congestion Notification  Router marks the packet with an ECN bit  … and sending host interprets as a sign of congestion  Surmounting the challenges  Must be supported by the end hosts and the routers  Requires two bits in the IP header (one for the ECN mark, and one to indicate the ECN capability)  Solution: borrow two of the Type-Of-Service bits in the IPv4 packet header Network Layer (2-89-90) 4-36
  • 31. Chapter 4 Outline 4.1 Introduction and Network Service Models 4.2 Routing Principles  Distance vector routing  Link state routing 4.3 Hierarchical Routing 4.4 Routing in the Internet 4.5 The Internet (IP) Protocol 4.6 What’s Inside a Router 4.7 IPv6 4.8 Multicast Routing 4.9 Mobility Network Layer (2-89-90) 4-37
  • 32. The Problem “A” “B” R How does R choose a next-hop on the path towards host B? Network Layer (2-89-90) CS244a Handout 5 4-38
  • 33. Interplay between routing, forwarding routing algorithm local forwarding table dest. net. addr. Output port 65/8 3 128.9/16 2 128.9.16/20 2 128.9.19/24 1 dest. IP addr. in arriving packet’s header 128.9.16.14 1 3 2 Network Layer (2-89-90) 4-39
  • 34. Graph abstraction 5 3 w v 5 2 u 2 1 z 3 1 2 Graph: G = (N,E) x y 1 N = set of routers = { u, v, w, x, y, z } E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) } Remark: Graph abstraction is useful in other network contexts Example: P2P, where N is set of peers and E is set of TCP connections Network Layer (2-89-90) 4-40
  • 35. Graph abstraction: costs  c(x,x’) = cost of link (x,x’) 5  e.g., c(w,z) = 5 v 3 w 2 5  cost could always be 1, or u 2 1 z inversely related to 1 3 2 bandwidth, or inversely x 1 y related to congestion Cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp) Question: What’s the least-cost path between u and z ? Routing algorithm: algorithm that finds least-cost path Network Layer (2-89-90) 4-41
  • 36. Routing Routing protocol Goal: determine “good” path 5 4 (sequence of routers) thru 3 C B network from source to dest. 2 5 A 3 1 Graph abstraction for 23 F routing algorithms: 1 2  graph nodes are routers D E 1  graph edges are physical links Abstract model of a network  link cost:  Delay (Make high speed links  “good” path: attractive, but closeness counts),  $ cost,  typically means minimum  Inverse of bandwidth, cost path  Path utilization (congestion level  other definitions possible & queue length),  Stability (Is path up or down?) Network Layer (2-89-90) 4-42
  • 37. Technique 1: Naïve Approach Flood!: Routers forward packets to all ports except the input port. R Advantages:  Simple.  Every destination in the network is reachable. Disadvantages:  Some routers receive a packet multiple times.  Packets can go round in loops forever.  Inefficient. Network Layer (2-89-90) CS244a Handout 5 4-43
  • 38. Spanning Trees Objective: Find the lowest cost route from each of (R1, …, R7) to R8. “A” R2 R4 R6 1 1 4 R1 2 2 3 R7 2 R3 R5 2 3 R8 4 “B” Network Layer (2-89-90) CS244a Handout 5 4-44
  • 39. A Spanning Tree 1 1 4 R1 2 2 3 R7 2 R3 R5 2 3 R8 4  The solution is a spanning tree with R8 as the root of the tree.  Tree: There are no loops.  Spanning: All nodes included.  We’ll see two algorithms that build spanning trees automatically:  The distributed Bellman-Ford algorithm ( Distance Vector ).  Dijkstra’s shortest path first algorithm ( Link State ). Network Layer (2-89-90) CS244a Handout 5 4-45
  • 40. Routing protocol requirements  Minimizing route table spec: Node memory related issue  Minimizing control message: Overhead in bandwidth  Robustness  Retain its correctness in dynamic situation. Should be free of loops, black holes.  Using optimal paths (optimality)  Choosing the best path ( in terms of some metrics)  Stability: Free of oscillations  Fairness  Should take the complete topology while computing the path  Efficiency: Convergence time  Correctness Network Layer (2-89-90) 4-46
  • 41. Design Choices - 1  Centralized versus Distributed routing  Centralized: One node collects information (node has complete topology and link cost) and then installs the routing information in all nodes (Link state algorithm).  Distributed: All nodes co-operate to form the rooting table.  Source based versus hop by hop  Source routing: data packet contains the hop list.  Hop by hop: Each hop takes decision based on its routing table about the next hop (Distance vector algorithm) Network Layer (2-89-90) 4-47
  • 42. Design Choices - 2  Stochastic versus deterministic  Stochastic: Routing table contains multiple path information. Next hop is chosen randomly. Advantage: load distribution.  Deterministic: always follow same path.  Single versus multiple path  Router can use multiple paths for a single destination  Dynamic versus Static  Dynamic: Routing dependent on the current network state routes update more quickly  periodic update  in response to link cost changes  Static: Routes update slowly over time. Network Layer (2-89-90) 4-48
  • 43. Assumptions About Router  Router knows address of each neighbor.  Router can communicate the information with its neighbors.  Router tells its neighbors its best idea of distance to every other router in the network.  Router receives these distance vectors from its neighbors.  Router updates its notion of best path to each destination, and the next hop for this destination. Network Layer (2-89-90) 4-49
  • 44. Distance Table Inside Router  Distance Table data structure  row for each possible destination.  column for each directly-attached neighbor router.  example: in router x, for dest. y via neighbor z.  This table is made based on exchanged information about distance metric and calculation. cost to dest. via x D () z z’ z’ z’ Distance Vector=Routing table z’’ x y 1 14 5 z,1 y’ destination y’ 7 5 8 z’,5 z y’’ y y’’ 6 9 4 z’’,4 z’,4 y’’’ y’’’ 4 2 11 Distance table in X Network Layer (2-89-90) 4-50
  • 45. Routers Information Exchange  Routers exchange information periodically of known:  distance metric (costs)  routing table (distance vector)  Exchange timing:  whenever a link fails  Whenever a routing table entry changes. Network Layer (2-89-90) 4-51
  • 46. Distance Vector Routing Algorithm Iterative: Distance Table data structure  continues until no nodes exchange info.  each node has its own:  self-terminating: no row for each possible destination “signal” to stop column for each directly- attached neighbor to node Asynchronous:  example: in node X, for dest. Y  nodes need not via neighbor Z: DX(Y,Z) exchange info/iterate in lock step! X Z distributed: D (Y,Z) = c(X,Z) + minw {D (Y,w)}  each node distance from X to Y, via Z as next hop communicates only with directly-attached neighbors Network Layer (2-89-90) 4-52
  • 47. Distance Table: example neighbor: j 1 C B A B D 7 8 2 A A 1 14 5 destination: i 1 D B 7 8 5 E source 2 C 6 9 4 E’s neighbor A D 4 11 2 B’s neighbor E Distance table: D(i, j) B D (A,C) C E D (A,B)= D B B E c(E,B) = c(E,B) + minw{D (A,w)} … = 8 + 6 = 14 Network Layer (2-89-90) 4-53
  • 48. Distance table gives routing table cost to destination via E Outgoing link D () A B D E D () to use, cost A 1 14 5 A A,1 destination destination B 7 8 5 B D,5 C 6 9 4 C D,4 D 4 11 2 D D,4 Distance table Routing table of node E Network Layer (2-89-90) 4-54
  • 49. Meaning of Distance Vector  A router using distance vector routing protocols knows 2 things:  Distance to final destination E Outgoing link  Vector, or direction, traffic D () to use, cost should be directed. A A,1 1 C destination B 7 B D,5 8 2 A C D,4 1 D E source 2 D D,4 Network Layer (2-89-90) 4-55
  • 50. Distance Vector Routing: overview Iterative, asynchronous: each local iteration caused Each node: by: wait for (change in local link  local link cost change cost or message from  message from neighbor: its neighbor) least cost path change from neighbor Distributed: recompute distance table  each node notifies neighbors only when its if least cost path to any least cost path to any destination has changed, destination changes  neighbors then notify notify neighbors their neighbors if necessary Network Layer (2-89-90) 4-56
  • 51. A Link-State Routing Algorithm Dijkstra’s algorithm (global)  net topology, link costs known to all nodes  accomplished via “link state broadcast”  all nodes have same information  computes least cost paths from one node (‘source”) to all other nodes  gives routing table for that node  iterative: after k iterations, know least cost path to k destinations. Network Layer (2-89-90) 4-65
  • 52. Notation: 5 5  N: set of nodes whose 3 C B least cost path 2 5 definitively known A 23 3 1 F c(i,j): link cost from node 1 2 i to j. cost infinite if D E 1 not direct neighbors Example: N: A, B, C, D, E, F  p(v): nodes along path from source to v C(A,C)=5; C(C,A)=5  D(v): current value of C(B,D)=2; C(D,B)=3 … cost of path from source to destination Source=A p(F): A-D-E-F v. D(F)=4 Network Layer (2-89-90) 4-66
  • 53. Dijsktra’s Algorithm v n = number of nodes (except the source) 1 Initialization: 2 N = {A} D(v) c(w,v) 3 for all nodes v 4 if v adjacent to A w 5 then D(v) = c(A,v) 6 else D(v) = infinity A 7 D(w) 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N n(n+1)/2) 11 update D(v) for all v adjacent to w and not in N: times 12 D(v) = min( D(v), D(w) + c(w,v) ) 13 /* new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v */ 15 until all nodes in N Network Layer (2-89-90) 4-67
  • 54. Dijkstra’s Algorithm: example computes least cost paths from node A to all other nodes Step start N D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E) D(F),p(F) 0 A 2,A-B 5,A-C 1,A-D infinity infinity 1 AD 2,A-B 4,A-D-C 1,A-D 2,A-D-E infinity 2 ADE 2,A-B 3,A-D-E-C 1,A-D 2,A-D-E 4,A-D-E-F 3 ADEB 2,A-B 3,A-D-E-C 1,A-D 2,A-D-E 4,A-D-E-F 4 ADEBC 2,A-B 3,A-D-E-C 1,A-D 2,A-D-E 4,A-D-E-F 5 ADEBCF 2,A-B 3,A-D-E-C 1,A-D 2,A-D-E 4,A-D-E-F 5 D(v): Distance (cost) of A to v. 3 P(v): nodes along path fromA to v. B C 2 5 A 3 1 2 F 1 2 D E 1 Network Layer (2-89-90) 4-68
  • 55. Dijkstra’s Algorithm: discussion2 Oscillations possibility:  Suppose link costs are equal to the load carried on the link, or A 1 the delay that experienced. D 1+e B 0 0  Link costs are not symmetric, 1 0 C e c(A,B) equals c(B,A) only if the 1 load on both directions on the e AB link is the same. Fig. a- Initial routing  Nodes B and D originates a unit of traffic destined for A.  Node C originates e unit for A. Network Layer (2-89-90) 4-70
  • 56. Discussion2 (cont.) … oscillations possible: 1 A  Algorithm is run: C D 1+e B determines (Fig. a) the 0 0 0 e 1 C clockwise path to A has a cost 1 of 1, while the counterclockwise path to A e Fig. a- Initial routing has a cost of 1 + e. Hence C ’s least-cost path to A is now A clockwise. 2+e 0  Similarly, B determines that D B its new least-cost path to A is 1+e 1 0 0 also clockwise, resulting in 1 C 1 costs shown in Fig. b. e Fig. b- B, C find better path to A is clockwise Network Layer (2-89-90) 4-71
  • 57. Discussion2 (cont.) A … oscillations possible: 0 2+e D B 0 0  When algorithm is run next, 1 1 C 1+e 1 nodes B, C, and D all detect a e zero-cost path to A in the Fig. c- B, C, D find better path to A is counterclockwise counterclockwise direction, and all route their traffic to A the counterclockwise routes. 2+e 0 D B  The next time the LS 1+e 1 algorithm is run, B, C, and D all 1 0 0 C 1 then route their traffic to the e clockwise routes. Fig. d- B, C, D find better path to A is clockwise Network Layer (2-89-90) 4-72
  • 58. Dijkstra’s Algorithm: discussion2   To prevent such oscillations:  Solution1 :link costs not depend on the amount of traffic carried ,an unacceptable solution since one goal of routing is to avoid highly congested (for example, high-delay) links.  Solution2 :all routers do not run the LS algorithm at the same time (a reasonable solution).  Routers run the LS algorithm with the same periodicity, the execution instance of the algorithm would not be the same at each node.  Researchers have noted: Routers in the Internet can self- synchronize among themselves. That is, even though they initially execute the algorithm with the same period but at different instants of time, the algorithm execution instance can eventually become, and remain, synchronized at the routers.  Avoid such self-synchronization: Introduce randomization into the period between execution instants of the algorithm at each node. Network Layer (2-89-90) 4-73
  • 59. Comparison of the DV and the LS  Distance vector:  Each router sends distance-vector, but to its neighbours  The distance-vector contains the estimated distance to all other nodes  Older method.  Link-state:  Each router sends link-state distance-vector to all others  The link-state distance-vector contains the distance to the neighbours, only  The distance value to the neighbour (called link-state) is accurate  Recent method. Network Layer (2-89-90) 4-74
  • 60. Chapter 4 Outline 4.1 Introduction and Network Service Models 4.2 Routing Principles 4.3 Hierarchical Routing 4.4 Routing in the Internet 4.5 The Internet (IP) Protocol 4.6 What’s Inside a Router 4.7 IPv6 4.8 Multicast Routing 4.9 Mobility Network Layer (2-89-90) 4-75
  • 61. Hierarchical Routing The routing study thus far was idealized  all routers identical  network “flat” … not true in practice scale: with 200 million administrative destinations (hosts):  can’t store all dest’s in routing autonomy: tables (memory limitation)!  internet = network of  routing table exchange would networks leave no bandwidth left for  each network admin may sending data packets! want to control routing in its  DV algorithm that iterated own network among large number of routers never converge! Network Layer (2-89-90) 4-76
  • 62. Hierarchical Routing  aggregate routers into gateway routers regions, “autonomous  special routers in AS systems” (AS)  run intra-AS routing  routers in same AS protocol with all other routers in AS run same routing  also responsible for protocol routing to destinations  “intra-AS” routing outside AS protocol  run inter-AS routing  routers in different AS protocol with other can run different intra- gateway routers AS routing protocol Network Layer (2-89-90) 4-77
  • 63. Routing in the Internet  The Internet is split into Autonomous Systems (AS’s)  Examples of AS’s: Stanford (32), HP (71), MCI Worldcom (17373)  Try: “MCI Worldcom” in http://ws.arin.net/whois/  Within an AS, the administrator chooses an Interior Gateway Protocol (IGP) (Intra AS)  Examples of IGPs: RIP (rfc 1058), OSPF (rfc 1247).  Between AS’s, the Internet uses an Exterior Gateway Protocol (Inter ASs)  AS’s today use the Border Gateway Protocol, BGP-4 (rfc 1771). Network Layer (2-89-90) 4-78
  • 64. Intra-AS and Inter-AS routing C.b B.a Gateways: A.a •perform inter-AS b A.c c routing amongst a themselves a b a •perform intra-AS C d B routers with other c routers in their A b AS ▪Routers in an AS Intra-AS Inter-AS have information Routing Routing Inter/intra-AS Algorithm Algorithm about routing paths routing in within that AS. gateway A.c Routing Table DL DL DL PHL PHL PHL To/from A.b To/from B.a and A.a To/from A.d Network Layer (2-89-90) 4-79
  • 65. Intra-AS and Inter-AS routing ng C.b routi B S and B.a ter-A n A A.a In twee be Host2 b A.c c a a b C a B d Intra-AS routing c A b within AS B Intra-AS routing Host1 within AS A Network Layer (2-89-90) 4-80
  • 66. Forwarding Tables  Forwarding table configured by both intra- and inter-AS routing algorithm.  Intra-AS sets entries for internal destinations.  Inter-AS & intra-As sets entries for external destinations. Network Layer (2-89-90) 4-81
  • 67. Inter-AS Tasks  Suppose router in AS1 AS1 must: receives datagram destined 1. learn which dests are outside of AS1: reachable through AS2,  router should forward which through AS3 packet to gateway 2. propagate this router, but which one? reachability info to all routers in AS1 Job of inter-AS routing! 3b 2c 3a 2a 2b AS3 1a 1d AS2 1c AS1 1b Network Layer (2-89-90) 4-82
  • 68. Example: Setting forwarding table in router 1d  Suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1a) but not via AS2.  Inter-AS protocol propagates reachability info to all internal routers.  router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1a.  installs forwarding table entry (x,I) 3a 3b … x 2a 2c 2b AS3 1a 1d AS2 1c AS1 1b Network Layer (2-89-90) 4-83
  • 69. Example: Choosing among multiple ASes  Now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2.  To configure forwarding table, router 1d must determine towards which gateway it should forward packets for dest x.  this is also job of inter-AS routing protocol! 3b … x ….. 2c 3a 2a 2b AS3 1a 1d AS2 1c AS1 1b Network Layer (2-89-90) 4-84
  • 70. Example: Choosing among multiple ASes  now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2.  to configure forwarding table, router 1d must determine towards which gateway it should forward packets for dest x.  this is also job of inter-AS routing protocol!  hot potato routing: send packet towards closest of two routers. Use routing info Hot potato routing: Determine from Learn from inter-AS from intra-AS Choose the forwarding table the protocol that subnet protocol to determine interface I that leads costs of least-cost gateway x is reachable via to least-cost gateway. paths to each that has the Enter (x,I) in multiple gateways of the gateways smallest least cost forwarding table Network Layer (2-89-90) 4-85
  • 71. Chapter 4 Outline 4.1 Introduction and Network Service Models 4.2 Routing Principles 4.3 Hierarchical Routing 4.4 Routing in the Internet  4.5.1 Intra-AS routing: RIP and OSPF  4.5.2 Inter-AS routing: BGP 4.5 The Internet (IP) Protocol 4.6 What’s Inside a Router? 4.7 IPv6 4.8 Multicast Routing 4.9 Mobility Network Layer (2-89-90) 4-86
  • 72. Routing in the Internet (RC1812) Requirements for IP Version 4 Routers  The Global Internet consists of Autonomous Systems (AS) interconnected with each other:  Stub AS: small corporation: one connection to other AS’s  Multihomed AS: large corporation (no transit): multiple connections to other AS’s  Transit AS: provider, hooking many AS’s together  Two-level routing:  Intra-AS: administrator responsible for choice of routing algorithm within network  Inter-AS: unique standard for inter-AS routing. Network Layer (2-89-90) 4-87
  • 73. TCP/IP protocol stack mime ftp http smtp telnet snmp tftp rtp dns … Transmission Control Pr. (TCP) User Datagram Pr. (UDP) … igmp icmp rip ospf bgp … Internet Protocol (IP) arp rarp Ethernet, Wireless, token ring, FDDI, ATM, Frame relay, SNA, X25 Network Layer (2-89-90) 4-88
  • 74. Routing Protocols in the Internet-1 Transport layer: TCP, UDP Routing protocols Network layer Control protocols • path selection: ICMP, IGMP, … … RIP, OSPF, BGP, IGRP forwarding IP protocol table •addressing conventions •datagram format •packet handling conventions Link layer physical layer ICMP: Internet Control Message Protocol, RFC792 IGMP: Internet Group Management Protocol, RFC 2236 Network Layer (2-89-90) 4-89
  • 75. Internet Routing Protocol  Intra-AS: administrator responsible for choice of routing algorithm within network  Also known as Interior Gateway Protocols (IGP)  Most common Intra-AS routing protocols:  RIP: Routing Information Protocol (RFCs1058,2453) – It is a distance vector protocol. – Routing updates are exchanged between neighbors app. Every 30sec.  OSPF: Open Shortest Path First (RFC2328) (Open Spec.)  IGRP: Interior Gateway Routing Protocol (Cisco proprietary) – These are link-state protocol that uses flooding of link information and a Dijkstra least-cost path algorithm.  Inter-AS: unique standard for inter-AS routing: BGP (RFC1771) Network Layer (2-89-90) 4-90
  • 76. Border Gateway Protocol (BGP-4)  BGP is not a link-state or distance-vector routing protocol.  Instead, BGP uses “Path vector”  BGP advertises complete paths (a list of AS’s).  Also called AS_PATH (this is the path vector)  Example of path advertisement: “The network 171.64/16 can be reached via the path {AS1, AS5, AS13}”.  Paths with loops are detected locally and ignored.  Local policies pick the preferred path among options.  When a link/router fails, the path is “withdrawn”. Network Layer (2-89-90) 4-91
  • 77. Internet AS Hierarchy Intra-AS border (exterior gateway) routers C.b B.a C A.a b A.c c a a b a A d B c b Inter-AS (interior gateway) routers Network Layer (2-89-90) 4-92
  • 78. Why different Intra- and Inter-AS routing ? Policy:  Inter-AS: admin wants control over how its traffic routed, who routes through its net.  Intra-AS: single admin, so no policy decisions needed Scale:  hierarchical routing saves table size, reduced update traffic Performance:  Intra-AS: can focus on performance  Inter-AS: policy may dominate over performance Network Layer (2-89-90) 4-93
  • 79. Chapter 4 outline 4.1 Introduction and Network Service Models 4.2 Routing Principles 4.3 Hierarchical Routing 4.4 Routing in the Internet 4.5 The Internet (IP) Protocol  4.4.1 IPv4 addressing  4.4.2 Moving a datagram from source to destination  4.4.3 IP address,  4.4.4 Address depletion  4.4.5 NAT: Network Address Translation  4.4.6 Datagram format  4.4.7 IP fragmentation  4.4.8 IP Services  4.4.9 ICMP: Internet Control Message Protocol  4.4.10 DHCP: Dynamic Host Configuration Protocol 4.6 What’s Inside a Router 4.7 IPv6 4.8 Multicast Routing 4.9 Mobility Network Layer (2-89-90) 4-94
  • 80. IP Addressing: Introduction  IP address: 32-bit 223.1.1.1 identifier for host, 223.1.2.1 223.1.1.2 router interface 223.1.1.4 223.1.2.9  interface: connection 223.1.2.2 between host/router 223.1.1.3 223.1.3.27 and physical link  router’s typically have multiple interfaces 223.1.3.1 223.1.3.2  host may have multiple interfaces  IP addresses associated with each 223.1.1.1 = 11011111 00000001 00000001 00000001 interface 223 1 1 1 Network Layer (2-89-90) 4-95
  • 81. IP Addressing  IP address: 223.1.1.1  network part (high 223.1.2.1 223.1.1.2 order bits) 223.1.1.4 223.1.2.9  host part (low order bits) 223.1.1.3 223.1.3.27 223.1.2.2  What’s a network ? LAN (from IP address perspective) 223.1.3.1 223.1.3.2  device interfaces with same network part of IP address  can physically reach network consisting of 3 IP networks each other without intervening router Network Layer (2-89-90) 4-96
  • 82. 223.1.1.2 IP Addressing How to find the 223.1.1.1 223.1.1.4 networks? 223.1.1.3  Detach each interface from 223.1.9.2 223.1.7.0 router, host  create “islands of isolated networks 223.1.9.1 223.1.7.1 223.1.8.1 223.1.8.0 223.1.2.6 223.1.3.27 Interconnected system consisting 223.1.2.1 223.1.2.2 223.1.3.1 223.1.3.2 of six networks. Network Layer (2-89-90) 4-97
  • 83. Getting a datagram from source to dest. forwarding table in A Dest. Net. Next Router Nhops 223.1.1 1 IP datagram: 223.1.2 223.1.1.4 2 223.1.3 223.1.1.4 2 misc source dest data fields IP addr IP addr A 223.1.1.1  datagram remains 223.1.2.1 unchanged, as it travels 223.1.1.2 223.1.1.4 223.1.2.9 source to destination  addr fields of interest B 223.1.3.27 223.1.2.2 E here 223.1.1.3 223.1.3.1 223.1.3.2 Network Layer (2-89-90) 4-98
  • 84. Getting a datagram from source to dest. forwarding table in A misc Dest. Net. Next Router Nhops data fields 223.1.1.1 223.1.1.3 223.1.1 1 223.1.2 223.1.1.4 2 Starting at A, send IP 223.1.3 223.1.1.4 2 datagram addressed to B:  look up net. address of B in A 223.1.1.1 forwarding table  find B is on same net. as A 223.1.2.1 223.1.1.2  link layer will send datagram 223.1.1.4 223.1.2.9 directly to B inside link-layer B 223.1.3.27 223.1.2.2 E frame 223.1.1.3  B and A are directly 223.1.3.1 223.1.3.2 connected Network Layer (2-89-90) 4-99
  • 85. Getting a datagram from source to dest. forwarding table in A misc Dest. Net. Next Router Nhops data fields 223.1.1.1 223.1.2.3 223.1.1 1 223.1.2 223.1.1.4 2 Starting at A, dest. E: 223.1.3 223.1.1.4 2  look up network address of E in forwarding table A 223.1.1.1  E on different network  A, E not directly attached 223.1.2.1 223.1.1.2 223.1.1.4 223.1.2.9  routing table: next hop router to E is 223.1.1.4 B 223.1.3.27 223.1.2.2 E  link layer sends datagram to 223.1.1.3 router 223.1.1.4 inside link- 223.1.3.2 layer frame 223.1.3.1  datagram arrives at 223.1.1.4  continued….. Network Layer (2-89-90) 4-100
  • 86. Getting a datagram from source to dest. forwarding table in router misc Dest. Net Router Nhops Interface data fields 223.1.1.1 223.1.2.3 223.1.1 - 1 223.1.1.4 Arriving at 223.1.4, 223.1.2 - 1 223.1.2.9 223.1.3 - 1 destined for 223.1.2.2 223.1.3.27  look up network address of E A 223.1.1.1 in router’s forwarding table  E on same network as router’s 223.1.2.1 223.1.1.2 223.1.2.9 interface 223.1.2.9 223.1.1.4  router, E directly attached B 223.1.3.27 223.1.2.2 E  link layer sends datagram to 223.1.1.3 223.1.2.2 inside link-layer 223.1.3.2 223.1.3.1 frame via interface 223.1.2.9  datagram arrives at 223.1.2.2 Network Layer (2-89-90) 4-101
  • 87. IP Addresses: Class-full given notion of “network”, let’s re-examine IP addresses: “class-full” addressing: class format range 1.0.0.0 to A 0 Network Host 126.255.255.255 N.H.H.H 128.0.0.0 to B 10 Network Host 191.255.255.255 N.N.H.H 192.0.0.0 to C 110 Network Host 223.255.255.255 N.N.N.H 224.0.0.0 to D 1110 multicast address 239.255.255.255 240.0.0.0 to E 11110 experimentation 247.255.255.255 32 bits Network Layer (2-89-90) 4-102
  • 88. Class-full Summary The Class System Number of Decimal Number of Address Number of Number of Application Network Address Possible Class Host Bits Networks Bits Range Host Large Class A 8 bits 24 bits 1 - 126 126 16,777,214 Networks Medium- Class B 16 bits 16 bits 128 - 191 65,534 65,534 sized Small Class C 24 bits 8 bits 192 - 223 2,097,152 254 Networks Network Layer (2-89-90) 4-103
  • 89. Private or Non-Routable addresses  Some addresses are reserved for use on local networks that are not connected to the Internet  Routers do not consider these addresses to be valid Internet addresses, and will not route a packet to any of them  These addresses may be used on private networks (not directly connected to the Internet).  10.0.0.0/8 —» 10.0.0.0 to 10.255.255.255 (a single class A net)  172.16.0.0/12 —» 172.16.0.0 to 172.31.255.255 (contiguous class Bs)  192.168.0.0/16 —» 192.168.0.0 to 192.168.255.255 (contiguous class Cs) Network Layer (2-89-90) 4-104
  • 90. Special Purpose IP Addresses  Several Addresses within the classes are reserved for special use.  0.0.0.0 :Source IP Addr. Just after Boot  network part of dest. Addr.= 0 :Source and Destination are in same network.  Dest. Addr.=255.255.255.255 :Broadcast in Sender’s network.  host part of Dest.=111… : Broadcast in destination network.  Dest. Addr. = 127.anything : Loop Back Network Layer (2-89-90) 4-105
  • 91. Special Purpose Addresses-List Address Block Present Use Reference 0.0.0.0/8 "This" Network [RFC1700, page 4] 10.0.0.0/8 Private-Use Networks [RFC1918] 14.0.0.0/8 Public-Data Networks [RFC1700, page 181] 24.0.0.0/8 Cable Television Networks 39.0.0.0/8 Reserved, subject to allocation [RFC1797] 127.0.0.0/8 Loop back [RFC1700, page 5] 128.0.0.0/16 Reserved but subject to allocation 169.254.0.0/16 Link Local – 172.16.0.0/12 Private-Use Networks [RFC1918] 191.255.0.0/16 Reserved but subject to allocation – 192.0.0.0/24 Reserved but subject to allocation – 192.0.2.0/24 Test-Net 192.88.99.0/24 6to4 Relay Anycast [RFC3068] 192.168.0.0/16 Private-Use Networks [RFC1918] 198.18.0.0/15 Network Interconnect Device Benchmark Testing [RFC2544] 223.255.255.0/24 Reserved but subject to allocation – 224.0.0.0/4 Multicast [RFC3171] 240.0.0.0/4 Reserved for Future Use [RFC1700] Network Layer (2-89-90) 4-106
  • 92. Address depletion  In 1991 IAB identified 3 dangers  Running out of class B addresses  Increase in nets has resulted in routing table explosion  Increase in net/hosts exhausting 32 bit address space  Four strategies to address  Creative address space allocation {RFC 2050}  Private addresses {RFC 1918}, Network Address Translation (NAT) {RFC 1631}  Classless Inter-Domain Routing (CIDR) {RFC 1519}  IP version 6 (IPv6) {RFC 1883} Network Layer (2-89-90) 4-107
  • 93. Creative IP address allocation  Class A addresses 64 – 127 reserved  Handle on individual basis  Class B only assigned given a demonstrated need  Class C  divided up into 8 blocks allocated to regional authorities  208-223 remains unassigned and unallocated  Three main registries handle assignments  APNIC – Asia & Pacific www.apnic.net  ARIN – N. & S. America, Caribbean & sub-Saharan Africa www.arin.net  RIPE – Europe and surrounding areas www.ripe.net Network Layer (2-89-90) 4-108
  • 94. NAT: Network Address Translation-1  Motivation: local network uses just one IP address as far as outside word is concerned:  no need to be allocated range of addresses from ISP: - just one IP address is used 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). Network Layer (2-89-90) 4-109
  • 95. Private IP Network  Private IP network is an IP network that is not directly connected to the Internet.  IP addresses in a private network can be assigned arbitrarily.  Not registered and not guaranteed to be globally unique.  Generally, private networks use addresses from the following experimental address ranges (non- routable addresses):  10.0.0.0 – 10.255.255.255  172.16.0.0 – 172.31.255.255  192.168.0.0 – 192.168.255.255 Network Layer (2-89-90) 4-110
  • 96. NAT: Network Address Translation-2 Implementation: NAT router must:  outgoing datagrams: replace (source IP address, port #) of every outgoing datagram to (NAT IP address, new port #) . . . remote clients/servers will respond using (NAT IP address, new port #) as destination addr.  remember (in NAT translation table) every (source IP address, port #) to (NAT IP address, new port #) translation pair  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 Network Layer (2-89-90) 4-111
  • 97. NAT: Network Address Translation-3 local network rest of Private IP Network Internet (e.g., home network) 10.0.0/24 10.0.0.1 10.0.0.4 10.0.0.2 138.76.29.7 10.0.0.3 All datagrams leaving local Datagrams with source or network have same single source destination in this network NAT IP public address: have 10.0.0/24 address 138.76.29.7, (private address) different source port numbers Network Layer (2-89-90) 4-112
  • 98. NAT: Network Address Translation-4 NAT translation table 2: NAT router 1: host 10.0.0.1 WAN side addr LAN side addr changes datagram sends datagram to 138.76.29.7, 5001 10.0.0.1, 3345 128.119.40, 80 source addr from …… …… 10.0.0.1, 3345 to 138.76.29.7, 5001, S: 10.0.0.1, 3345 updates table D: 128.119.40.186, 80 10.0.0.1 1 S: 138.76.29.7, 5001 2 D: 128.119.40.186, 80 10.0.0.4 10.0.0.2 138.76.29.7 S: 128.119.40.186, 80 D: 10.0.0.1, 3345 4 S: 128.119.40.186, 80 D: 138.76.29.7, 5001 3 10.0.0.3 4: NAT router 3: Reply arrives changes datagram dest. address: dest addr from 138.76.29.7, 5001 138.76.29.7, 5001 to 10.0.0.1, 3345 Network Layer (2-89-90) 4-113
  • 99. NAT: Network Address Translation-4  16-bit port-number field:  232 = 65,536 simultaneous connections with a single LAN-side address!  NAT is controversial:  routers should only process up to layer 3  violates end-to-end argument  NAT possibility must be taken into account by app designers, eg. P2P applications.  address shortage should instead be solved by IPv6 Network Layer (2-89-90) 4-114
  • 100. Nat & Applications  IP address in application data:  Applications that carry IP addresses in the payload of the application data generally do not work across a private-public network boundary.  Some NAT devices inspect the payload of widely used application layer protocols and, if an IP address is detected in the application- layer header or the application payload, translate the address according to the address translation table. Network Layer (2-89-90) 4-115
  • 101. Example: NAT & FTP Public Network FTP Client FTP Server No NAT Device Public Address Public Address 147.202.71.22 207.3.18.98 PORT 207.3.18.98, 1107 200 Port Command Successful RETR file1 150 Opening Data Connection Establish Data Connection Client gives its IP address and port number for data connection. Server starts data connection. Network Layer (2-89-90) 4-116
  • 102. Example: NAT & FTP Public Network Private Network NAT Device with FTP Client FTP Server FTP Support Public Address Private Address 147.202.71.22 10.0.1.1 Public Address 207.3.18.98 PORT command in IP packet must PORT 207.3.18.98,1107 PORT 207.3.18.98,1107 PORT 10.0.1.1, 1107 PORT 10.0.1.1, 1107 be modified. 200 Port Command Successful 200 Port Command Successful 200 Port Command Successful 200 Port Command Successful RETR file1 RETR file1 RETR file1 RETR file1 150 Opening Data Connection 150 Opening Data Connection 150 Opening Data Connection 150 Opening Data Connection Establish Data Connection Establish Data Connection Establish Data Connection Establish Data Connection Network Layer (2-89-90) 4-117
  • 103. NAT Traversal Problem  Client wants to connect to server with address 10.0.0.1 10.0.0.1  server address 10.0.0.1 local Client to LAN (client can’t use it as destination addr) NAT router 10.0.0.4  only one externally visible NATted address: 138.76.29.7  Solution 1: statically 138.76.29.7 configure NAT to forward incoming connection requests at given port to server  e.g., connection request at: (123.76.29.7, port 80) always forwarded to (10.0.0.1 port 1405) Network Layer (2-89-90) 4-118
  • 104. NAT traversal problem  Solution 2: Universal Plug and Play (UPnP) Internet Gateway 10.0.0.1 Device (IGD) Protocol allows IGD NATted host to: NAT  learn public IP address router 10.0.0.4 (138.76.29.7)  add/remove port mappings 138.76.29.7 (with lease times)  i.e., automate static NAT port map configuration Network Layer (2-89-90) 4-119
  • 105. NAT traversal problem  Solution 3: relaying (used in Skype)  NATted client establishes connection to relay  External client connects to relay  relay bridges packets between to connections NATted Host 2. connection to 1. connection to 10.0.0.1 relay initiated relay initiated by client by NATted host 10.0.0.4 3. relaying Client established NAT 138.76.29.7 router Network Layer (2-89-90) 4-120
  • 106. IP addressing: CIDR  Classful addressing:  inefficient use of address space, address space exhaustion  e.g., class B net allocated enough addresses for 65K hosts, even if only 2K hosts in that network  CIDR: Classless Inter Domain Routing (RFC1519)  network portion of address of arbitrary length  address format: a.b.c.d/x, where x is # bits in network portion of address network host part part 11001000 00010111 00010000 00000000 200.23.16.0/23 Network Layer (2-89-90) 4-121
  • 107. Subnet Mask-1  A subnet mask is applied to the host bits to determine how the network is subnetted,  e.g. if the host is: 137.138.28.228, and the subnet mask is 255.255.255.0 then the right hand 8 bits are for the host (255 is decimal for all bits set in an octet) Network Layer (2-89-90) 4-122
  • 108. Bit Masks and Subnet Masks In a production environment this prefix typically varies in length from 8 to 30 bits /8 = 255.0.0.0 /16 = 255.255.0.0 /24 = 255.255.255.0 /9 = 255.128.0.0 /17 = 255.255.128.0 /25 = 255.255.255.128 /10 = 255.192.0.0 /18 = 255.255.192.0 /26 = 255.255.255.192 /11 = 255.224.0.0 /19 = 255.255.224.0 /27 = 255.255.255.224 /12 = 255.240.0.0 /20 = 255.255.240.0 /28 = 255.255.255.240 /13 = 255.248.0.0 /21 = 255.255.248.0 /29 = 255.255.255.248 /14 = 255.252.0.0 /22 = 255.255.252.0 /30 = 255.255.255.252 /15 = 255.254.0.0 /23 = 255.255.254.0 /31 = not usable /32 = not usable /30 yields two usable hosts and is used for WAN connections Network Layer (2-89-90) 4-123
  • 109. Prefix Equivalents Network Prefix Equivalent Number of Class Addresses Number of Hosts /27 1/8th of a Class C 32 /26 1/4th of a Class C 64 /25 1/2 of a Class C 128 /24 1 Class C 256 /23 2 Class C 512 /22 4 Class C 1,024 /21 8 Class C 2,048 /20 16 Class C 4,096 /19 32 Class C 8,192 /18 64 Class C 16,384 /17 128 Class C 32,768 /16 256 Class C or 1 Class B 65,536 /15 512 Class C or 2 Class B 131,072 /14 1,024 Class C or 4 Class B 262,144 /13 2048 Class C or 8 Class B 524,288 /12 4096 Class C or 16 Class B 1,048,576 /11 8192 Class C or 32 Class B 2,097,152 /10 16384 Class C or 64 Class B 4,194,304 /9 32768 Class C or 128 Class B 8,388,608 /8 65,536 Class C or 256 Class B or 1 Class A 16,777,216 Network Layer (2-89-90) 4-124
  • 110. Protocols Class-full Routing Protocols Classless Routing Protocol RIP version1 RIP version2 IGPR EIGPR EGP OSPF BGP3 BGP4 IS-IS Network Layer (2-89-90) 4-125
  • 112. Subnetting:(Extended Network Prefix) Q: How an organization gets network part of IP addr? A: It gets allocated portion of its ISP’s address space. The ISP have been allocated the address block ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20 Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23 Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23 Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23 ... ….. …. …. Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23 The ISP divides the block into 8 smaller addr. blocks (subnets) and gives them to 8 organization. Network Layer (2-89-90) 4-127
  • 113. Hierarchical addressing: route aggregation Hierarchical addressing allows efficient advertisement of routing information: Organization 0 route aggregation or 200.23.16.0/23 route summarization. Organization 1 “Send me anything 200.23.18.0/23 with addresses beginning Organization 2 ISP1 200.23.16.0/20” 200.23.20.0/23 . . 200.23.16.0/20 . . Internet . Organization 7 . 200.23.30.0/23 ISP2 “Send me anything 199.31.0.0/16 with addresses beginning 199.31.0.0/16” Network Layer (2-89-90) 4-128
  • 114. Hierarchical addressing: more specific routes ISP2 has a more specific route to Organization 1 The routers in Internet use a longest prefix matching rule, and route toward ISP2, as it advertises the longest (more specific) address prefix that matches the destination address.  Organization 0 200.23.16.0/23 “Send me anything with addresses beginning Organization 2 200.23.16.0 /20” 200.23.20.0/23 . 20 bits . ISP1 . . . Internet Organization 7 . 200.23.30.0/23 “Send me anything ISP2 Organization 1 with addresses beginning 199.31.0.0/16 200.23.18.0/23 or 200.23.18.0 /23” 23 bits Network Layer (2-89-90) 4-129
  • 115. Subnet Mask ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20 ISP’s subnet mask 11111111 11111111 11110000 00000000 255.255.240.0 Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23 Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23 Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23 ... ….. …. …. Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23 Or’s subnet mask 11111111 11111111 11111110 00000000 255.255.254.0 Network part of an IP address= subnet mask & IP address Network Layer (2-89-90) 4-130
  • 116. CIDR: Subneting Example  You are assigned the CIDR address 200.32.108.0 /22 and  you must support the network shown in the diagram.  Create an addressing scheme that will meet the diagram requirements. 100 computers 300 computers 100 computers 100 computers Network Layer (2-89-90) 4-131
  • 117. CIDR: Subneting Example (Questions)  Given the CIDR address 200.32.108.0 /22  How many Class C networks do we have? 4 classes  How many host addresses do we have? 4x254 addresses  What is the largest LAN requirement? 300 addresses  Host required - 300, 100, 100, 100, and 3 WAN links Network Layer (2-89-90) 4-132
  • 118. 200.32.108.0 /22 0 0 200.32.108.0/24 200.32. 110.0/24 200.32. 110.0 255 255 0 0 200.32. 109.0/24 200.32. 111.0/24 200.32. 111.0 255 255 Network Layer (2-89-90) 4-133
  • 119. 0 0 200.32.108.0/24 200.32. 110.0/24 200.32. 200.32.108.0 /23 110.0 300 hosts 255 255 0 0 200.32. 109.0/24 200.32. 111.0/24 200.32. 111.0 255 255 Network Layer (2-89-90) 4-134
  • 120. 0 0 128 200.32.110.128 /25 200.32.110.0 /25 100 hosts 100 hosts 200.32.108.0/24 200.32. 110.0/24 200.32.108.0 /23 300 hosts 255 127 255 0 0 200.32. 109.0/24 200.32. 111.0/24 255 255 Network Layer (2-89-90) 4-135
  • 121. 0 0 128 200.32.110.128 /25 200.32.110.0 /25 100 hosts 100 hosts 200.32.108.0 200.32. 110.0 200.32.108.0 /23 300 hosts 255 127 255 0 0 128 200.32.111.0 /25 100 hosts 200.32. 109.0 200.32. 111.0 255 127 255 Network Layer (2-89-90) 4-136
  • 122. 0 0 128 200.32.110.128 /25 200.32.110.0 /25 100 hosts 100 hosts 200.32.108.0 200.32. 110.0 200.32.108.0 /23 300 hosts 255 127 255 0 0 128 200.32.111.0 /25 100 hosts 191 200.32. 109.0 192 224 200.32. 111.0 239 240 248 243 251 WAN 244 252 links /30 255 127 223 247 255 Network Layer (2-89-90) 4-137
  • 123. CIDR: Subneting Example (Results) Given the CIDR address 200.32.108.0 /22 200.32.111.0 /25 1/2 Class C 100 computers 200.32.111.240 /30 200.32.111.248 /30 300 computers 200.32.111.244 /30 100 computers 200.32.108.0 /23 2 Class C’s 200.32.110.128 /25 100 computers 1/2 Class C 200.32.110.0 /25 1/2 Class C Network Layer (2-89-90) 4-138
  • 124. Supernetting Example-1  Company XYZ needs to address 400 hosts.  Its ISP gives them two contiguous Class C addresses:  207.21.54.0/24  207.21.55.0/24  Company XYZ can use a prefix of 207.21.54.0 /23 to supernet these two contiguous networks. (Yielding 510 hosts)  207.21.54.0 /23  207.21.54.0/24  207.21.55.0/24 23 bits in common Network Layer (2-89-90) 4-139
  • 125. Supernetting Example-2 addressing authority of ISP, include XYZ, be advertised to Internet as a single supernt Network Layer (2-89-90) 4-140
  • 126. CIDR and the Provider example of route aggregation advertising address: a.b.c.d/x Network Layer (2-89-90) 4-141
  • 127. TCP/IP protocol stack mime ftp http smtp telnet snmp tftp rtp dns … Transmission Control Pr. (TCP) User Datagram Pr. (UDP) … igmp icmp rip ospf bgp … Internet Protocol (IP) arp rarp Ethernet, Wireless, token ring, FDDI, ATM, Frame relay, SNA, X25 Network Layer (2-89-90) 4-142
  • 128. IP: The waist of the hourglass  IP is the waist of the Network Applications hourglass of the Internet http, smtp, ftp, dns, … protocol architecture tcp, udp IP  Multiple higher-layer protocols Data Link Protocols  Multiple lower-layer Physical Layer Protocols protocols  Only one protocol at the network layer. Network Layer (2-89-90) 143 4-143
  • 129. IP datagram format IP protocol version 32 bits Number[4bits] total datagram header length head. “type” of ver length length (1Byte) (4Bytes)[4bits] len service fragment fragmentation/ “type” of data: Priority [3bits] 16-bit identifier flags Delay[1bit] offset Reassembly/ time to upper Checksum: 1’s add of Throughput[1bit] DF, MF Flags Reliability[1bit] live layer 16bits words in header upper layer 32 bit source IP address max number protocol remaining hops 32 bit destination IP address to deliver (decremented at payload to each router) Options (if any) (rfc 1700) 1 :ICMP data 6 :TCP how much overhead (variable length, 17 :UDP with TCP? typically a TCP  20 bytes of TCP e.g. timestamp, or UDP segment)  20 bytes of IP record route  = 40 bytes + app taken, specify A packet is unique in Internet by: list of routers layer overhead Id + S. IP Add + D. IP Add + Upper L. to visit. Network Layer (2-89-90) 4-144
  • 130. IP Fragmentation & Reassembly  network links have MTU (max.transfer size) - largest possible link-level frame.  different link types, fragmentation: different MTUs in: one large datagram  large IP datagram divided out: 3 smaller datagrams (“fragmented”) within net  one datagram becomes several datagrams reassembly  “reassembled” only at final destination  IP header bits used to identify, order related fragments Network Layer (2-89-90) 4-145
  • 131. IP Fragmentation and Reassembly data 20 Byte 0……….3979 length ID fragflag offset Example =4000 =x =0 =0  4000 byte 4000 Bytes datagram 0……….1479  MTU = 1500 bytes length ID fragflag offset =1500 =x =1 =0 1480…2959 One large datagram becomes length ID fragflag offset 3 smaller datagrams. =1500 =x =1 =1480 length ID fragflag offset =1040 =x =0 =2960 Network Layer (2-89-90) 4-146
  • 132. IP Service - 1  Delivery service of IP is minimal.  IP provide provides an unreliable connectionless best effort service (also called: “datagram service”).  Unreliable: IP does not make an attempt to recover lost packets  Connectionless: Each packet (“datagram”) is handled independently. IP is not aware that packets between hosts may be sent in a logical sequence  Best effort: IP does not make guarantees on the service (no throughput guarantee, no delay guarantee,…)  Consequences:  Higher layer protocols have to deal with losses or with duplicate packets.  Higher layer protocols have to deal with losses or with duplicate packets. Network Layer (2-89-90) 4-147
  • 133. IP Service - 2  IP supports the following services:  one-to-one (unicast)  one-to-all (broadcast)  one-to-several (multicast)  IP multicast also supports a many-to-many service.  IP multicast requires support of other protocols (IGMP, multicast routing) Network Layer (2-89-90) 148 4-148
  • 134. ICMP: Internet Control Message Protocol  Used by hosts & routers to Type Code description communicate network-level 0 0 echo reply (ping) information 3 0 dest. network unreachable  error reporting: 3 1 dest host unreachable unreachable host, network, 3 2 dest protocol unreachable port, protocol 3 3 dest port unreachable 3 6 dest network unknown  echo request/reply (used 3 7 dest host unknown by ping) 4 0 source quench (congestion  network-layer “above” IP: control - not used)  ICMP msgs carried in IP 8 0 echo request (ping) 9 0 route advertisement datagrams 10 0 router discovery  ICMP message: type, code plus 11 0 TTL expired first 8 bytes of IP datagram 12 0 bad IP header causing error Network Layer (2-89-90) 4-149
  • 135. Traceroute and ICMP  Source sends series of  When ICMP message UDP segments to dest arrives, source calculates  First has TTL =1 RTT  Second has TTL=2, etc.  Traceroute does this 3  Unlikely port number times  When nth datagram arrives Stopping criterion to nth router:  UDP segment eventually  Router discards datagram arrives at destination host  And sends to source an  Destination returns ICMP ICMP message (type 11, “host unreachable” packet code 0) (type 3, code 3)  Message includes name of  When source gets this router& IP address ICMP, stops. Network Layer (2-89-90) 4-150
  • 136. IP addresses: how to get one? Q: How does host get IP address?  IP addr. is configures into host by admin. in a file  Wintel: control-panel->network->configuration- >tcp/ip->properties  UNIX: /etc/rc.config  DHCP: Dynamic Host Configuration Protocol (RFC2131): dynamically get address from as server  “plug-and-play” Network Layer (2-89-90) 4-151
  • 137. IP addressing: ICANN Q: How does an ISP get block of addresses? A: ICANN: Internet Corporation for Assigned Names and Numbers  allocates addresses  manages DNS  assigns domain names, resolves disputes Network Layer (2-89-90) 4-152
  • 138. 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.  Support for mobile users who want to join network. DHCP overview:  host broadcasts “DHCP discover” msg  DHCP server responds with “DHCP offer” msg  host requests IP address: “DHCP request” msg  DHCP server sends address: “DHCP ack” msg Network Layer (2-89-90) 4-153
  • 139. DHCP client-server scenario DHCP server 223.1.2.1 A 223.1.1.1 223.1.1.2 223.1.1.4 223.1.2.9 B 223.1.3.27 223.1.2.2 arriving DHCP 223.1.1.3 E client needs address in this 223.1.3.1 223.1.3.2 network Network Layer (2-89-90) 4-154
  • 140. DHCP client-server scenario arriving DHCP server: 223.1.2.5 client DHCP discover src : 0.0.0.0, 68 dest.: 255.255.255.255,67 yiaddr: 0.0.0.0 transaction ID: 654 DHCP offer src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 654 Lifetime: 3600 secs DHCP request src: 0.0.0.0, 68 dest:: 255.255.255.255, 67 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs DHCP ACK src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 655 time Lifetime: 3600 secs Network Layer (2-89-90) 4-155
  • 141. Chapter 4 Outline 4.1 Introduction and Network Service Models 4.2 Routing Principles 4.3 Hierarchical Routing 4.4 Routing in the Internet 4.5 The Internet (IP) Protocol 4.6 What’s Inside a Router? 4.7 IPv6 4.8 Multicast Routing 4.9 Mobility Network Layer (2-89-90) 4-156
  • 142. Router Architecture Overview Two key router functions:  run routing algorithms/protocol (RIP, OSPF, BGP)  switching datagrams from incoming to outgoing link Network Layer (2-89-90) 4-157
  • 143. Input Port Functions Data link layer: Physical layer: e.g., Ethernet bit-level reception see chapter 5 - function: lookup output port using routing table in input port memory - goal: complete input port processing at ‘line speed’ - Queuing (buffering): if datagrams arrive faster than forwarding rate into switch fabric Network Layer (2-89-90) 4-158
  • 144. Input Port Queuing (Buffering)  Fabric slower than input ports combined -> queuing may occur at input queues  Head-of-the-Line (HOL) blocking: queued datagram at front of queue prevents others in queue from moving forward  queuing delay and loss due to input buffer overflow! Network Layer (2-89-90) 4-159
  • 145. Three Types of Switching Fabrics Network Layer (2-89-90) 4-160
  • 146. Switching Via Memory First generation routers:  packet copied by system’s (single) CPU  speed limited by memory bandwidth (2 bus crossings per datagram) Input Port Output Port Memory System Bus Modern routers:  input port processor performs lookup, copy into memory  Cisco Catalyst 8500 Network Layer (2-89-90) 4-161
  • 147. Switching Via a Bus  datagram from input port memory to output port memory via a shared bus  bus contention: switching speed limited by bus bandwidth  1 Gbps bus, Cisco 1900: sufficient speed for access and enterprise routers (not regional or backbone) Network Layer (2-89-90) 4-162
  • 148. Switching Via An Interconnection Network  overcome bus bandwidth limitations  Banyan networks, 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 Gbps through the interconnection network Network Layer (2-89-90) 4-163
  • 149. Output Ports  Buffering required when datagrams arrive from fabric faster than the transmission rate  Scheduling discipline chooses among queued datagrams for transmission  queuing (delay) and loss due to output port buffer overflow! Network Layer (2-89-90) 4-164
  • 150. How much buffering?  RFC 3439 rule of thumb:  average buffering = “typical” RTT X link capacity C  e.g., RTT=250 msec and C = 10 Gps link: Buffer=2.5 Gbit.  Recent recommendation: with N flows, RTT. C buffering = N Network Layer (2-89-90) 4-165
  • 151. Chapter 4 Outline 4.1 Introduction and Network Service Models 4.2 Routing Principles 4.3 Hierarchical Routing 4.4 Routing in the Internet 4.5 The Internet (IP) Protocol 4.6 What’s Inside a Router? 4.7 IPv6 4.8 Multicast Routing 4.9 Mobility Network Layer (2-89-90) 4-166
  • 152. IPv6  Initial motivation: 32-bit address space completely allocated by 2008.  Additional motivation:  header format helps speed processing/forwarding  header changes to facilitate QoS  new “anycast” address: route to “best” of several replicated servers  IPv6 datagram format:  fixed-length 40 byte header  no fragmentation allowed Network Layer (2-89-90) 4-167
  • 153. IPv6 Header Priority: identify priority among datagrams in flow Flow Label: identify datagrams in same “flow.” (concept of“flow” not well defined). Next header: identify upper layer protocol for data Network Layer (2-89-90) 4-168
  • 154. 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, e.g. “Packet Too Big”  multicast group management functions Network Layer (2-89-90) 4-169
  • 155. Transition From IPv4 To IPv6  Not all routers can be upgraded simultaneous  no “flag days”  How will the network operate with mixed IPv4 and IPv6 routers?  Two proposed approaches:  Dual Stack: some routers with dual stack (v6, v4) can “translate” between formats  Tunneling: IPv6 carried as payload in IPv4 datagram among IPv4 routers Network Layer (2-89-90) 4-170
  • 156. Dual Stack Approach A B C D E F IPv6 IPv6 IPv4 IPv4 IPv6 IPv6 Flow: X Src:A Src:A Flow: ?? Src: A Dest: F Dest: F Src: A Dest: F Dest: F data data data data A-to-B: B-to-C: B-to-C: B-to-C: IPv6 IPv4 IPv4 IPv6 Network Layer (2-89-90) 4-171
  • 157. Tunneling-Analogy A B E F Logical view: tunnel IPv6 IPv6 IPv6 IPv6 Analogy: Network Layer (2-89-90) 4-172
  • 158. Tunneling-Physical View A B E F tunnel Logical view: IPv6 IPv6 IPv6 IPv6 A B C D E F Physical view: IPv6 IPv6 IPv4 IPv4 IPv6 IPv6 Flow: X Src:B Src:B Flow: X Src: A Dest: E Dest: E Src: A Dest: F Dest: F Flow: X Flow: X Src: A Src: A data Dest: F Dest: F data data data A-to-B: B-to-C: B-to-C: E-to-F: IPv6 IPv6 inside IPv6 inside IPv6 IPv4 IPv4 Network Layer (2-89-90) 4-173
  • 159. Chapter 4 Outline 4.1 Introduction and Network Service Models 4.2 Routing Principles 4.3 Hierarchical Routing 4.4 Routing in the Internet 4.5 The Internet (IP) Protocol 4.6 What’s Inside a Router? 4.7 IPv6 4.8 Multicast Routing 4.9 Mobility Network Layer (2-89-90) 4-174
  • 160. Unicast  In unicast routing, the router forwards the received packet through only one of its interfaces. Network Layer (2-89-90) 4-175
  • 161. Multicast  In multicast routing, the router may forward the received packet through several of its interfaces. Network Layer (2-89-90) 4-176
  • 162. Multicast: one sender to many receivers  Multicast: act of sending datagram to multiple receivers with single “transmit” operation  analogy: one teacher to many students  How to achieve multicast:  Multiple unicasts  Application-Layer Multicast  Network multicast Network Layer (2-89-90) 4-177
  • 163. Multicasts  Multiple unicast (One-to-All unicast)  Using an underlying unicast network layer  Duplicated at the sender transport layer  Application-layer multicast  Involving the receivers in the replication and forwarding of data.  Explicit multicast  Network player supports multicast  Data is replicated at the network router Network Layer (2-89-90) 4-178
  • 164. 1- Multiple Unicasts  Source sends 3 unicast datagrams,  One addressed to each of 3 receivers Source Network Layer (2-89-90) 4-179
  • 165. 2- Application-layer Multicast  End systems involved in multicast copy and forward unicast datagrams among themselves  example: p2p file sharing Network Layer (2-89-90) 4-180
  • 166. 3- Network Multicast  Router actively participate in ♪ ♪ multicast, making copies of packets as needed and forwarding ♪ ♪ towards multicast receivers  Multicast routers ♪ ♪ ♪ duplicate and forward ♪ multicast datagrams Network Layer (2-89-90) 4-181
  • 167. Multicast Uses  Bulk data transfer (software updates, mailing list distribution, stock updates)  Streamed Continuous Media (audio/visual conferences)  Shared Application Data (shared whiteboard)  Interactive Gaming or Simulations (very intensive) Network Layer (2-89-90) 4-182
  • 168. Internet Multicast Service Model  Multicast group concept: use of indirection  Sending host (source) addresses IP datagram to multicast multicast group group. 226.17.30.197  Routers forward multicast datagrams Source to hosts that have “joined” that multicast group Network Layer (2-89-90) 4-183
  • 169. Multicast Groups  Class D Internet addresses reserved for multicast: 1110 Multicast Group Address (ID) -24 bits  Host group semantics:  anyone can “join” (receive) multicast group  anyone can send to multicast group  no network-layer identification to hosts of members  Needed: infrastructure to deliver multicast-addressed datagrams to all hosts that have joined that multicast group. Network Layer (2-89-90) 4-184
  • 170. Joining a Multicast Group: Two-Step Process  Local: host informs local multicast router of desire to join a group:  IGMP (Internet Group Management Protocol)  Wide Area: local router interacts with other routers to receive multicast datagram flow:  many protocols (e.g., DVMRP, MOSPF, PIM) ♪:router with attached group member IGMP IGMP ♪ ♪ DVMRP or MOSPF or PIM IGMP ♪ ♪ IGMP multicast group Network Layer (2-89-90) 4-185
  • 171. IGMP: Internet Group Management Protocol  Host: sends IGMP report when application joins multicast group.  IP_ADD_MEMBERSHIP socket option  host need not explicitly “unjoin” group when leaving  Router: sends IGMP query at regular intervals  host belonging to a multicast group must reply to query IGMP Report IGMP Query Network Layer (2-89-90) 4-186
  • 172. IGMP IGMP-v1 IGMP-v2: additions include  router: Host  group-specific Query Membership Query  Leave Group message Message broadcast on  last host replying to Query LAN to all hosts can send explicit Leave  host: Host Group message Membership Report  router performs group- specific query to see if any message to indicate hosts left in group group membership  RFC 2236  randomized delay before responding IGMP-v3: under development as  implicit leave via no Internet draft reply to Query  RFC 1112 Network Layer (2-89-90) 4-187
  • 173. IGMP v2 Message Types IGMP Message Type Sent By Purpose Membership query: Router Query multicast groups joined by attached General hosts Membership query: Router Query if specific multicast group joined by Specific attached hosts Membership report Host Report host wants to join or is joined to given multicast group Leave Group Host Report leaving given multicast group Report Query Network Layer (2-89-90) 4-188
  • 174. IGMP Message Format Network Layer (2-89-90) Computer Networks 4-189
  • 175. Multicast Routing Objectives  Every member receives EXACTLY ONE copy of the packet  Non-members receive nothing  No loops in route  Optimal path from source to each destination. Terminology  Spanning Tree: Source is the root, group members are the leaves.  Shortest Path Spanning Tree: Each path from root to a leaf is the shortest according to some metric Network Layer (2-89-90) 4-190
  • 176. Multicast Connections  Goal: find a tree (or trees) connecting routers having local multicast group members  tree: not all paths between routers used  Group-shared tree: same tree used by all group members  Source-based tree: different tree from each sender to receivers ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ Group- Shared tree Network Layer (2-89-90) 4-191
  • 177. Tree Approaches  Source-based tree: one tree per source  shortest path trees  reverse path forwarding  Group-shared tree: group uses one tree  minimal spanning (Steiner)  center-based trees ♪, ♪: sources ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ Source-based trees Network Layer (2-89-90) 4-192
  • 178. Shortest Path TreeSource-Based  Multicast forwarding tree: tree of shortest path routes from source to all receivers  Dijkstra’s algorithm. R1 ♪ Source 1 2 ♪:router with attached ♪ R4 group member R2 5 i 3 4 R5 link used for forwarding, i indicates order link ♪ 6 added by algorithm R3 R7 ♪ R6 Network Layer (2-89-90) 4-193
  • 179. Reverse Path ForwardingSource-Based  Rely on router’s knowledge of unicast shortest path from it to sender  Each router has simple forwarding behavior:  if (multicast datagram received on incoming link on shortest path back to center)  then flood datagram onto all outgoing links  else ignore datagram Network Layer (2-89-90) 4-194
  • 180. Reverse Path Forwarding: Example  Result is a source-specific reverse Shortest Path Tree  May be a bad choice with asymmetric links. R1 ♪ Source ♪:router with attached ♪ R4 group member R2 R5 datagram will not be Forwarded R3 ♪ R7 datagram will be ♪ R6 forwarded Network Layer (2-89-90) 4-195
  • 181. Reverse Path Forwarding: Pruning  Forwarding tree contains sub-trees with no multicast group members  No need to forward datagrams down sub-tree  “prune” messages sent upstream by router with no downstream group members R1 ♪ Source ♪:router with attached ♪ R4 group member R2 P P prune message R5 ♪ P links with multicast R3 R7 forwarding ♪ R6 Network Layer (2-89-90) 4-196
  • 182. Shared-Tree: Steiner Tree  Steiner Tree: minimum cost tree connecting all routers with attached group members  problem is NP-complete  excellent heuristics exists  not used in practice:  computational complexity  information about entire network needed  monolithic: rerun whenever a router needs to join/leave Network Layer (2-89-90) 4-197
  • 183. Center-Based Trees  Single delivery tree shared by all  One router identified as “center” of tree  to join:  edge router sends unicast join-message addressed to center router  join-message “processed” by intermediate routers and forwarded towards center  join-message either hits existing tree branch for this center, or arrives at center  path taken by join-message becomes new branch of tree for this router Network Layer (2-89-90) 4-198
  • 184. Center-Based Trees  Suppose R6 chosen as center: R1 ♪ Source 3 ♪:router with attached ♪ R4 group member R2 1 path order in which R5 2 join messages ♪ 1 P generated R3 R7 ♪ R6 Network Layer (2-89-90) 4-199
  • 185. Multicast Routing Protocols Network Layer (2-89-90) 4-200
  • 186. DVMRP - 1  DVMRP: distance vector multicast routing protocol, RFC1075  flood and prune: reverse path forwarding, source- based tree  RPF tree based on DVMRP’s own routing tables constructed by communicating DVMRP routers  no assumptions about underlying unicast  initial datagram to multicast group flooded everywhere via RPF  routers not wanting group: send upstream prune messages. Network Layer (2-89-90) 4-201
  • 187. DVMRP - 1  Soft state: DVMRP router periodically (1 min.) “forgets” branches are pruned:  multicast data again flows down unpruned branch  downstream router: reprune or else continue to receive data  Routers can quickly redraft to tree  following IGMP join at leaf  Odds and ends  commonly implemented in commercial routers  Mbone routing done using DVMRP. Network Layer (2-89-90) 4-202
  • 188. Tunneling Q: How to connect “islands” of multicast routers in a “sea” of unicast routers? ♪ ♪ ♪ ♪ ♪ ♪ physical topology logical topology  multicast datagram encapsulated inside “normal” (non- multicast-addressed) datagram.  normal IP datagram sent thru “tunnel” via regular IP unicast to receiving multicast router.  receiving multicast router unencapsulates to get multicast datagram Network Layer (2-89-90) 4-203
  • 189. PIM: Protocol Independent Multicast  Not dependent on any specific underlying unicast routing algorithm (works with all)  Two different multicast distribution scenarios: 1-Dense 2-Sparse:  group members  # networks with group densely packed, in members small wrt # “close” proximity. interconnected networks  bandwidth more  group members “widely plentiful dispersed”  bandwidth not plentiful Network Layer (2-89-90) 4-204
  • 190. Consequences of Sparse-Dense Dichotomy: Dense: Sparse:  group membership by  no membership until routers assumed until routers explicitly join routers explicitly prune  receiver- driven  data-driven construction construction of multicast on multicast tree (e.g., tree (e.g., center-based) RPF)  bandwidth and non-group-  bandwidth and non- router processing group-router processing conservative profligate Network Layer (2-89-90) 4-205
  • 191. PIM- Dense Mode Flood-and-prune RPF, similar to DVMRP but:  underlying unicast protocol provides RPF info for incoming datagram  less complicated (less efficient) downstream flood than DVMRP reduces reliance on underlying routing algorithm  has protocol mechanism for router to detect it is a leaf-node router Network Layer (2-89-90) 4-206
  • 192. PIM - Sparse Mode  center-based approach ♪ R1  router sends join msg to rendezvous point join ♪ R2 R4 (RP)  intermediate routers R5 update state and join forward join ♪ join P R3  after joining via RP, ♪ R6 R7 router can switch to all data multicast source-specific tree from rendezvous rendezvous point  increased performance: point less concentration, shorter paths Network Layer (2-89-90) 4-207
  • 193. PIM - Sparse Mode sender(s): ♪ R1  unicast data to RP, which distributes down join ♪ R2 R4 RP-rooted tree  RP can extend mcast R5 join tree upstream to ♪ join P source R3 R7  RP can send stop msg ♪ R6 if no attached all data multicast rendezvous receivers from rendezvous point point  “no one is listening!” Network Layer (2-89-90) 4-208
  • 194. Chapter 4 roadmap 4.1 Introduction and Network Service Models 4.2 Routing Principles 4.3 Hierarchical Routing 4.4 Routing in the Internet 4.5 The Internet (IP) Protocol 4.6 What’s Inside a Router? 4.7 IPv6 4.8 Multicast Routing 4.9 Mobility Network Layer (2-89-90) 4-209
  • 195. What is mobility?  spectrum of mobility, from the network perspective: no mobility high mobility mobile user, using mobile user, mobile user, passing same access point connecting/ through multiple disconnecting access point while from network maintaining ongoing using DHCP. connections (like cell phone) Network Layer (2-89-90) 4-210
  • 196. Mobility: Vocabulary home network: permanent home agent: entity that will “home” of mobile perform mobility functions on (e.g., 128.119.40/24) behalf of mobile, when mobile is remote wide area network Permanent address: address in home network, can always be used to reach mobile e.g., 128.119.40.186 correspondent Network Layer (2-89-90) 4-211
  • 197. Mobility: more vocabulary visited network: network Permanent address: remains in which mobile currently constant (e.g., 128.119.40.186) resides (e.g., 79.129.13/24) Care-of-address: address in visited network. (e.g., 79,129.13.2) wide area network home agent: entity in visited network that performs mobility correspondent: wants functions on behalf to communicate with of mobile. mobile Network Layer (2-89-90) 4-212
  • 198. How do you contact a mobile friend: Consider friend frequently changing I wonder where addresses, how do you find her? Ali moved to?  search all phone books?  call her parents?  expect her to let you know where he/she is? Network Layer (2-89-90) 4-213
  • 199. Mobility: approaches  Let routing handle it: routers advertise permanent address of mobile-nodes-in-residence via usual routing table exchange.  routing tables indicate where each mobile located  no changes to end-systems  Let end-systems handle it:  indirect routing: communication from correspondent to mobile goes through home agent, then forwarded to remote  direct routing: correspondent gets foreign address of mobile, sends directly to mobile Network Layer (2-89-90) 4-214
  • 200. Mobility: approaches  Let routing handle it: routers advertise permanent address of mobile-nodes-in-residence via usual not scalable routing table exchange. to millions of  routing tables indicate where each mobile located mobiles  no changes to end-systems  let end-systems handle it:  indirect routing: communication from correspondent to mobile goes through home agent, then forwarded to remote  direct routing: correspondent gets foreign address of mobile, sends directly to mobile Network Layer (2-89-90) 4-215
  • 201. Mobility: registration visited network home network 1 2 wide area network mobile contacts foreign agent contacts home foreign agent on agent home: “this mobile is entering visited resident in my network” network End result:  Foreign agent knows about mobile  Home agent knows location of mobile Network Layer (2-89-90) 4-216
  • 202. Mobility via Indirect Routing foreign agent receives packets, home agent intercepts forwards to mobile packets, forwards to visited foreign agent network home network 3 wide area network 2 1 correspondent 4 addresses packets mobile replies using home address directly to of mobile correspondent Network Layer (2-89-90) 4-217
  • 203. Indirect Routing: comments  Mobile uses two addresses:  permanent address: used by correspondent (hence mobile location is transparent to correspondent)  care-of-address: used by home agent to forward datagrams to mobile  foreign agent functions may be done by mobile itself  triangle routing: correspondent-home-network- mobile  inefficient when correspondent, mobile are in same network Network Layer (2-89-90) 4-218
  • 204. Forwarding datagrams to remote mobile foreign-agent-to-mobile packet packet sent by home agent to foreign dest: 128.119.40.186 agent: a packet within a packet dest: 79.129.13.2 dest: 128.119.40.186 Permanent address: 128.119.40.186 Care-of address: 79.129.13.2 dest: 128.119.40.186 packet sent by correspondent Network Layer (2-89-90) 4-219
  • 205. Indirect Routing: moving between networks  suppose mobile user moves to another network  registers with new foreign agent  new foreign agent registers with home agent  home agent update care-of-address for mobile  packets continue to be forwarded to mobile (but with new care-of-address)  Mobility, changing foreign networks transparent: on going connections can be maintained! Network Layer (2-89-90) 4-220
  • 206. Mobility via Direct Routing foreign agent receives packets, correspondent forwards forwards to mobile to foreign agent visited network home network 4 wide area 2 network 3 correspondent 1 4 requests, receives mobile replies foreign address of directly to mobile correspondent Network Layer (2-89-90) 4-221
  • 207. Mobility via Direct Routing: comments  overcome triangle routing problem  non-transparent to correspondent: correspondent must get care-of-address from home agent  What happens if mobile changes networks? Network Layer (2-89-90) 4-222
  • 208. Mobile IP  RFC 3220  has many features we’ve seen:  home agents, foreign agents, foreign-agent registration, care-of-addresses, encapsulation (packet-within-a-packet)  three components to standard:  agent discovery  registration with home agent  indirect routing of datagrams Network Layer (2-89-90) 4-223
  • 209. Mobile IP: agent discovery  agent advertisement: foreign/home agents advertise service by broadcasting ICMP messages (typefield = 9) 0 8 16 24 type = 9 code = 0 checksum =9 =9 H,F bits: home standard and/or foreign agent router address ICMP fields R bit: registration required type = 16 length sequence # RBHFMGV registration lifetime reserved bits mobility agent advertisement 0 or more care-of- extension addresses Network Layer (2-89-90) 4-224
  • 210. Mobile IP: registration example visited network: 79.129.13/24 home agent foreign agent HA: 128.119.40.7 COA: 79.129.13.2 ICMP agent adv. Mobile agent COA: 79.129.13.2 MA: 128.119.40.186 …. registration req. registration req. COA: 79.129.13.2 COA: 79.129.13.2 HA: 128.119.40.7 HA: 128.119.40.7 MA: 128.119.40.186 MA: 128.119.40.186 Lifetime: 9999 Lifetime: 9999 identification:714 identification: 714 …. encapsulation format …. registration reply time HA: 128.119.40.7 registration reply MA: 128.119.40.186 Lifetime: 4999 HA: 128.119.40.7 Identification: 714 MA: 128.119.40.18 6 encapsulation format Lifetime: 4999 …. Identification: 714 …. Network Layer (2-89-90) 4-225
  • 211. Network Layer: summary What we’ve covered:  network layer services  routing principles: link state and distance vector  hierarchical routing  IP  Internet routing protocols RIP, OSPF, BGP  what’s inside a router?  IPv6  mobility Network Layer (2-89-90) 4-226

Editor's Notes

  • #24: Simple to implement Efficient hardware implementations available.
  • #109: Class B addresses require demonstrated need: subnetting plan for &gt; 32 subnets, &gt; 4096 hosts 192-193 Multiregional 194-195 Europe 196-197 Others 198-199 N. America 200-201 Central/South America 202-203 Pacific Rim 204-207 Reserved APNIC=Asia pacific Network Information Center ARIN = American Registry for Internet Numbers RIPE NCC = Reseau IP Europeens
  • #132: Objective: Create an addressing scheme using variable length subnet masking (VLSM).
  • #179: It can be implemented in several ways
  • #188: Notes: RFC-1112: S. Deering, “Host Extension for IP Multicasting,” August 1989 RFC 2236: R. Fenner, “Internet Group Management Protocol, Version 2”, November 1997. B. Cain, S. Deering, A. Thyagarajan, “Internet Group Management Protocol, Version 3,” work in progress, draft-ietf-idmr-igmp-v3-00.txt
  • #198: Notes: 1. In computational complexity theory, the complexity class NP-complete (abbreviated NP-C or NPC , NP standing for N ondeterministic P olynomial time) is a class of problems having two properties: - Any given solution to the problem can be verified quickly (in polynomial time); the set of problems with this property is called NP . - If the problem can be solved quickly (in polynomial time), then so can every problem in NP . 2. See L. Wei and D. Estrin, “A Comparison of multicast trees and algorithms,” TR USC-CD-93-560, Dept. Computer Science, University of California, Sept 1993 for a comparison of heuristic approaches.
  • #199: Notes: The earliest discussion of center-based trees for multicast appears to be D. Wall, “Mechanisms for Broadcast and Selective Broadcast,” PhD dissertation, Stanford U., June 1980.
  • #202: Notes: D. Waitzman, S. Deering, C. Partridge, “Distance Vector Multicast Routing Protocol,” RFC 1075, Nov. 1988. The version of DVMRP in use today is considerably enhanced over the RFC1075 spec. A more up-to-date “work-in-progress” defines a version 3 of DVMRP: T. Pusateri, “Distance Vector Multicast Routing Protocol,” work-in-progress, draft-ietf-idmr-v3-05.ps
  • #203: 1. See www.mbone.com/mbone/routers.html for a (slightly outdatet) list of multicast capable routers (supporting DVMPR as well as other protocols) from various vendors. 2. ftp://parcftp.xerox.com/pub/net-research/ipmulti for circa 1996 public copy “mrouted” v3.8 of DVMRP routing software for various workstation routing platforms.
  • #204: Notes: For a general discussion of IP encapsulation, see C. Perkins, “IP Encapsulation within IP,” RFC 2003, Oct. 1996. The book S. Bradner, A Mankin, “Ipng: Internet protocol next generation,” Addison Wesley, 1995 has a very nice discussion of tunneling Tunneling can also be used to connect islands of IPv6 capable routers in a sea IPv4 capable routers. The long term hope is that the sea evaporates leaving only lands of IPv6!
  • #205: Notes: a very readable discussion of the PIM architecture is S. Deering, D. Estrin, D. Faranacci, V. Jacobson, C. Liu, L. Wei, “The PIM Architecture for Wide Area Multicasting,” IEEE/ACM Transactions on Networking, Vol. 4, No. 2, April 1996. D. Estrin et al, PIM-SM: Protocol Specification, RFC 2117, June 1997 S. Deering et al, PIM Version 2, Dense Mode Specification, work in progress, draft-ietf-idmr-pim-dm-05.txt PIM is implemented in Cisco routers and has been deployed in UUnet as part of their streaming multimedia delivery effort. See S. LaPolla, “IP Multicast makes headway among ISPs,” PC Week On-Line, http://www.zdnet.com/pcweek/news/1006/06isp.html