Computer Graphics

Document Sample
Computer Graphics Powered By Docstoc
					                 Routing & Switching
                            Umar Kalim
              Dept. of Communication Systems Engineering



Spring 2007                                        Ref: CSci5211 Univ. of Minnesota   1

Spring 2007              2
                   Who am I?
Umar Kalim
      – Lecturer

Department of Communication Systems
R # 15, AB # 3, St # 9
9280439 x 134

Spring 2007                            3
   What is “Routing & Switching‟ about?
 Graduate-Level Introductory Networking Course
 We‟ll learn about
  Fundamental principles and concepts of routing in computer
  How Internet works
  Introduce some relevant tools used to study networks
       Attempt hands-on experience
  Discuss relevant papers
 Who is it for?
   CSci, CE or EE graduate students who have some basic
     understanding of computer networks

Spring 2007                                                     4
                       Reading material
 Text books:
      – None
 Reference books:
      – Computer Networks: A Systems Approach by Larry L. Peterson.
      – Kurose and Ross “Computer Networking: A Top-Down Approach
        Featuring the Internet”, 3rd Edition, 2004.
      – TCP/IP Illustrated, Volume 1: The Protocols by W. Richard Stevens
      – W. Richard Stevens, Bill Fenner, and Andrew M. Rudoff, "UNIX
        Network Programming, Volume I: The Sockets Networking API", 3rd
        edition, 2003.
      – TCP/IP Protocol Suite by Behrouz A. Forouzan (3rd Edition)
      – Computer Networks by Andrew S. Tanenbaum
 Reference material
      – Selected publications and standards

Spring 2007                                                                 5
              Logistics & Pre-requisites
Lectures & Handouts               Computer Networks
      – Will be available online
Office hours:                     Programming
      – Tuesday:                    Experience
      – 6:00 pm- 7:00 pm             – Java, C, C# or C++

Spring 2007                                                 6
                Grading policy
Assignments           Assignments
     5%                  – Individual
                         – No late submission
     10%               Quizzes
                         – Mostly unannounced
Class participation     – Occasionally announced

Spring 2007                                         7
              Lets begin!

Spring 2007                 8
              Hubs vs. Bridges vs. Routers
 Hubs (aka Repeaters): Layer 1 devices
   – repeat (i.e., regenerate) physical signals
         don’t understand MAC protocols!
         LANs connected by hubs belong to same collision domain
 Bridges (and Layer-2 Switches): Layer 2 devices
   – store and forward layer-2 frames based on MAC addresses
         speak and obey MAC protocols
         bridges segregate LANs into different collision domains
 Routers (and Layer 3 Switches): Layer 3 devices
   – store and forward layer-3 packets based on network layer addresses (e.g.,
      IP addresses)
         rely on data link layer to deliver packets to (directly connected) next
         network layer addresses are logical (i.e. virtual), need to map to MAC
          addresses for packet delivery

Spring 2007                                                                         9
                Switching and Forwarding
   Bridges and Routers: store-and forward devices!
Function Division:
 input interfaces (input ports):
   perform forwarding
   – need to know to which output
       ports to send frames/packets
   – may enqueue packets and perform
 switching Fabric:
   – move frames or packets from input
       ports to output ports
 output interfaces (output ports):
   – may enqueue packets and perform
       scheduling                                   plane
   – Perform MAC to transmit
       frames/packets to next hop
                                         Generic Switch Architecture

  Spring 2007                                                      10
                       Input Port Functions

     Physical layer:
bit-level reception        Decentralized switching:
   Data link layer:         given datagram dest., lookup output port
    e.g., Ethernet           using forwarding table in input port
                            goal: complete input port processing at
                             „line speed‟
                            queuing: if datagrams arrive faster than
                             forwarding rate into switch fabric
    Spring 2007                                                     11
                   Output Ports

Buffering required when datagrams arrive from fabric
 faster than the transmission rate
Scheduling discipline chooses among queued datagrams for

Spring 2007                                            12
                  Generic Switch Architecture
 Input and output interfaces are connected
  through a switching fabric (backplane)                 input interface       output interface
 A backplane can be implemented by
   – shared memory                                                      Inter-
           bridges or low capacity routers (e.g.,                    connection
            PC-based routers)                                          Medium
    – shared bus
           E.g., “low end” routers
    – point-to-point (switched)
      interconnection switching fabric
                                                     C               RI    B    RO            C
           high perform switches (e.g., as used
            in high capacity routers

  Spring 2007                                                                               13
              Three Types of Switching Fabrics

Spring 2007                                      14
              Switching Via Memory
   First generation routers:
    traditional computers with switching under direct
       control of CPU
    packet copied to system‟s memory
    speed limited by memory bandwidth (2 bus
       crossings per datagram)
               Input    Memory        Output
               Port                   Port

                                               System Bus

Spring 2007                                                 15
               Switching Via a Bus

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

 Spring 2007                          16
 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

Spring 2007                                              17
       More on Bridges/Layer 2 Switches
  – look up forwarding table using destination MAC
    address in a layer-2 frame
  – forwarding table: constructed using “self-learning”
“Cut-through” switching optimization
      – only buffer frame header (for output port lookup)
      – then forward remaining bits directly
      – reduced latency, but may forward “bad” packets (why?)
Backpressure flow control
      – input port: 1 Gpbs, output port: 100 Mpbs
      – buffer can only absorb temporary bursts
      – send JAM signal on input power when buffer gets too full!

Spring 2007                                                         18
                 A Few Words about VLAN
 Virtual LAN (VLAN) – defined in IEEE 802.1q
   – Partition a physical LAN into several “logically separate” LANs
               reduce broadcast traffic on physical LAN!
               provide administrative isolation
      – Extend over a WAN (wide area network), e.g.,
        via layer 2 tunnels (e.g., L2TP, MPLS) over IP-based WANs!
 Two types: port-based or MAC address-based
      – each port optionally configured with a VLAN id
      – inbound packets tagged with this “VLAN” id
          require change of data frames, carry “VLAN id” tags
          tagged and untagged frames can co-exist
      – “VLAN-aware” switches forward on ports part of same VLAN
 More complex ! - require administrative configuration
      – static (“manual”) configuration
      – more for info: google search on “VLAN tutorial”

Spring 2007                                                            19
                 Forwarding in Layer 3
Putting in context
What does layer-3 (network layer) do?
      – deliver packets “hop-by-hop” across a network
      – rely on layer-2 to deliver between neighboring hops
Key Network Layer Functions
      – Addressing: need a global (logical) addressing scheme
      – Routing: build “map” of network, find routes, …
      – Forwarding: actual delivery of packets!
Two basic network layer service models
      – datagram: “connectionless”
      – virtual circuit (VC): connection-oriented

Spring 2007                                                     20
              What Does Network Layer Do?
 End-to-end deliver packet from
  sending to receiving hosts,                   application

  “hop-by-hop” thru network                      network
                                                 data link                   network
                                                 physical                    data link
                                                              network                          network
   – A network-wide concern!                                  data link
                                                                             physical          data link

   – Involves every router, host                                             network
                                                                             data link

     in the network                                                          physical      network
                                                                                           data link

Compare:                                                      network
                                                                                   data link
                                                               data link           physical
      – Transport layer                                        physical
               between two end hosts                                      data link
      – Data link layer                                                                     data link

               over a physical link directly
                connecting two (or more)
Spring 2007                                                                                            21
                Network Layer Functions
    Addressing
      – Globally unique address for each routable device
               Logical address, unlike MAC address (as you‟ve seen earlier)
         – Assigned by network operator
               Need to map to MAC address (as you‟ll see later)
    Routing: building a “map” of network
      – Which path to use to forward packets from src to dest
    Forwarding: delivery of packets hop by hop
      – From input port to appropriate output port in a router

          Routing and forwarding depend on network service
           models: datagram vs. virtual circuit

Spring 2007                                                                    22
                      Routing & Forwarding:
                          Logical View of a Router

        B     3   C   5
A       2         1       F
    1                 2
        D         E

Spring 2007                                          23
              Network Service Model
  Q: What service model for
                                  The most important
   “channel” transporting         abstraction provided
   packets from sender to          by network layer:
  guaranteed bandwidth?
  preservation of inter-packet
   timing (no jitter)?                 ? ?
                                      virtual circuit
  loss-free delivery?
  in-order delivery?
  congestion feedback to
Spring 2007                                          24
                Virtual Circuit vs. Datagram
 Objective of both: move packets through routers from source to destination
 Datagram Model:
      – Routing: determine next hop to each destination a priori
      – Forwarding: destination address in packet header, used at each
        hop to look up for next hop
          routes may change during “session”
      – analogy: driving, asking directions at every corner gas station,
        or based on the road signs at every turn
 Virtual Circuit Model:
      – Routing: determine a path from source to each destination
      – “Call” Set-up: fixed path (“virtual circuit”) set up at “call” setup
        time, remains fixed thru “call”
      – Data Forwarding: each packet carries “tag” or “label” (virtual
        circuit id, VCI), which determines next hop
      – routers maintain ”per-call” state

Spring 2007                                                                    25
              Virtual Circuit Switching
 Explicit connection setup (and tear-down)
 Subsequence packets follow same circuit
 Sometimes called connection-oriented model
   still packet switching, not circuit switching!                                   0
                     0                         0                             3
Analogy:        3           1          11 3               1

 phone call              2
                             Switch 1
                                                           Switch 2                 2

                                 5                                     0 Switch 3
Each switch                                                   3         1

 maintains a      Host A                                                                4
                                                                                            Host B
 VC table

Spring 2007                                                                                   26
              Datagram Switching
   No connection setup phase
   Each packet forwarded independently
   Sometimes called connectionless model
                                     Host D

   Analogy: postal              3
                                        0     Switch 1
                                                             Host E
                                                                                           Host F

    system              Host C
                                        2                3
                                                                2 Switch 2


   Each switch                      Host A

    maintains a
    forwarding                                                Host G          0 Switch 3   Host B

    (routing) table                                                    1            3


                                                                           Host H

Spring 2007                                                                                         27
        Forwarding Tables: VC vs. Datagram
   Virtual Circuit                Datagram Forwarding
    Forwarding Table                Table
   a.k.a. VC (Translation) Table
                                        (switch 1)
   (switch 1, port 2)
      VC In VC Out Port Out              Address   Port
                                               A     2
                                               C     3
                                               F     1
                                               G     1
                                              …     …
         5      11       1
         6       8       1
         …      …        …

Spring 2007                                               28
              More on Virtual Circuits
     “source-to-dest path behaves much like telephone circuit”
        (but actually over packet network)
  call setup/teardown for each call before data can flow
       – need special control protocol: “signaling”
       – every router on source-dest path maintains “state” (VCI
         translation table) for each passing call
       – VCI translation table at routers along the path of a call
         “weaving together” a “logical connection” for the call
  link, router resources (bandwidth, buffers) may be reserved and allocated to
   each VC
       – to get “circuit-like” performance

Spring 2007                                                                       29
        Virtual Circuit: Signaling Protocols
     used to setup, maintain teardown VC
     used in ATM, frame-relay, X.25
     used in part of today‟s Internet: Multi-Protocol Label
      Switching (MPLS) operated at “layer 2+1/2” (between data
      link layer and network layer) for “traffic engineering” purpose

 transport 5. Data flow begins               6. Receive data application
  network 4. Call connected                   3. Accept call
  data link 1. Initiate call                 2. incoming call
                                                                 data link

Spring 2007                                                            30
           Virtual Circuit Setup/Teardown
Call Set-Up:
 Source: select a path from source to destination
     – Use routing table (which provides a “map of network”)
 Source: send VC setup request control (“signaling”) packet
   – Specify path for the call, and also the (initial) output VCI
   – perhaps also resources to be reserved, if supported
 Each router along the path:
   – Determine output port and choose a (local) output VCI for the call
        need to ensure that no two distinct VCs leaving the same output port
          have the same VCI!
   – Update VCI translation table (“forwarding table”)
        add an entry, establishing an mapping between incoming VCI & port
          no. and outgoing VCI & port no. for the call

Call Tear-Down: similar, but remove entry instead

 Spring 2007                                                                    31
green call
purple call                                       four “calls” going thru
                                                  the router, each entry
blue call                                         corresponding one call
orange call

VCI translation table (aka “forwarding table”), built at call set-up phase

  1             2                                3       1        2

   2            1                                 1
During data packet forwarding phase, input VCI is used to look up the table,
and is “swapped” w/ output VCI (VCI translation, or “label swapping”)

  Spring 2007                                                                32
               Virtual Circuit: Example
 “call” from host A to host B along path:
  host A router 1 router 2  router 3  host B
•each router along path
                                                                                     Router 4
                                  0 Router 1
maintains an entry for     3        1
the call in its VCI                                     2 Router 2

translation table
                                  2                 3       1
• the entries piece                            11
together a “logical
connection” for the call       Host A

                                                                        0 Router 3
                                                                1           3
                                                                                           Host B

 Spring 2007                                                                                33
         Virtual Circuit Model: Pros and Cons

 Full RTT for connection setup
       – before sending first data packet.
 Setup request carries full destination address
       – each data packet contains only a small identifier
 If a switch or a link in a connection fails
       – new connection needs to be established.
 Provides opportunity to reserve resources.

Spring 2007                                                  34
              ATM Networks

              Study for Reference

Spring 2007                         35
  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-dest pair may take different
        paths, when intermediate routes change!

 data link 1. Send data                  2. Receive data
                                                          data link

 Spring 2007                                                           36
                Datagram Model
There is no round trip delay waiting for connection
 setup; a host can send data as soon as it is ready.

Source host has no way of knowing if the network is
 capable of delivering a packet or if the destination host
 is even up.

Since packets are treated independently, it is possible to
 route around link and node failures.

Since every packet must carry the full address of the
 destination, the overhead per packet is higher than for
 the connection-oriented model.

Spring 2007                                                  37
               Network Layer Service Models:
                                         Guarantees ?
   Network       Service                                Congestion
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
                            rate                              congestion
          ATM    VBR        guaranteed   yes   yes      yes   no
                            rate                              congestion
          ATM    ABR        guaranteed   no    yes      no    yes
          ATM    UBR        none         no    yes      no    no
  Internet model being extended: MPLS, Diffserv

 Spring 2007                                                           38
                 Datagram or VC: Why?
Internet                               ATM
 data exchange among computers         evolved from telephony
                                        human conversation:
      – “elastic” service, no strict       – strict timing, reliability
        timing req.                          requirements
 “smart” end systems (computers)          – need for guaranteed
      – can adapt, perform                   service
                                        “dumb” end systems
        control, error recovery
                                         – telephones
      – simple inside network,           – complexity inside network
        complexity at “edge”           MPLS
 many link types                       evolve from ATM
      – different characteristics          – traffic engineering, fast path
                                             restoration (a priori “backup”
      – uniform service difficult            paths)

Spring 2007                                                                   39
                    IP Addressing: Basics
Globally unique (for “public” IP addresses)
IP address: 32-bit identifier for host, router interface
Interface: connection between host/router and
 physical link
  – router‟s typically have multiple interfaces
  – host may have multiple interfaces
  – IP addresses associated with each interface
Dot notation (for ease of human reading)
     = 11011111 00000001 00000001 00000001

                           223       1        1         1

Spring 2007                                                     40
          IP Addressing: Network vs. Host
 Two-level hierarchy                                                    LAN

    – network part (high order      
    – host part (low order bits)
 What’s a network ?             
(from IP address perspective)                                         link
    – device interfaces with
       same network part of IP                      

    – can physically reach each                
       other without intervening

  Spring 2007                                                                   41
                   “Classful” IP Addressing
     class           77         15          23            31
      A       0 network              host            

       B             network                          to
              10                            host
       C      110         network                  host
       D      1110         multicast address

                               32 bits
        • Disadvantage: 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

Spring 2007                                                                      42
              Classless Addressing: CIDR
   CIDR: Classless InterDomain Routing
   Network portion of address is of arbitrary length
   Addresses allocated in contiguous blocks
    – Number of addresses assigned always power of 2
   Address format: a.b.c.d/x
                   of bits
    – x is number network in network portion of address
                        part               part
              11001000 00010111 00010000 00000000

Spring 2007                                               43
         Representation of Address Blocks
    “Human Readable” address format: a.b.c.d/x
      – x is number of bits in network portion of address
    machine representation of a network (addr block):
         using a combination of
         – first IP of address blocks of the network
         – network mask ( x “1”‟s followed by 32-x “0”‟s

      network w/ address block:
       first IP address of address block:

      11001000 00010111 00010000 00000000
        network mask:
       11111111 11111111 11111110 00000000
Spring 2007                                                 44
                      More Examples
  Three Address Blocks:
first IP address:
11001000 00010111 00010000 00000000      Given an IP address, which
network mask:                            network (or address block)
11111111 11111111 11111000 00000000      does it belong to?
                                       Example 1:
first IP address:                     11001000 00010111 00010110 10100001
11001000 00010111 00011000 00000000
 network mask:
11001000 00010111 00011000 00000000

                                       Example 2:
first IP address:                     11001000 00010111 00011000 10101010
11001000 00010111 00011001 00000000
 network mask:
11001000 00010111 00011111 11111111      Use longest prefix matching!

 Spring 2007                                                          45
               Special IP Addresses
Network address: host id = all 0‟s
Directed broadcast address: host id = all 1‟s
Local broadcast address: all 1‟s
Local host address (this computer): all 0‟s
Loopback address
      – network id = 127, any host id (e.g.

Spring 2007                                              46
         IP Addresses: How to Get One?
Q: How does host get IP address?

“static” assigned: i.e., hard-coded in a file
  – Wintel: control-panel->network->configuration-
  – UNIX: /etc/rc.config
Dynamically assigned: using DHCP (Dynamic Host
 Configuration Protocol)
  – dynamically get address from as server
  – “plug-and-play”

Spring 2007                                          47
         DHCP: Dynamic Host Configuration
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 (only hold address while connected
        an “on”
      Support for mobile users who want to join network (more
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

Spring 2007                                                          48
              DHCP Client-Server Scenario

              A          DHCP  

                                               arriving DHCP
                         E      client needs
                                                                  address in this

Spring 2007                                                                         49
                DHCP Client-Server Scenario
              DHCP server:                                         arriving
                                              DHCP discover
                                               src :, 68
                                               transaction ID: 654

                                                DHCP offer
                                                 src:, 67
                                                 dest:, 68
                                                 transaction ID: 654
                                                 Lifetime: 3600 secs
                          DHCP request
                            src:, 68
                            dest::, 67
                            transaction ID: 655
                  time      Lifetime: 3600 secs

                                               DHCP ACK
                                                 src:, 67
                                                 dest:, 68
                                                 transaction ID: 655
                                                 Lifetime: 3600 secs

Spring 2007                                                                             50
   IP Addresses: How to Get One? …
Q: How does network get network part of IP addr?
A: gets allocated portion of its provider ISP‟s
  address space

 ISP's block      11001000 00010111 00010000 00000000

 Organization 0   11001000 00010111 00010000 00000000
 Organization 1   11001000 00010111 00010010 00000000
 Organization 2   11001000 00010111 00010100 00000000
  ...                       …..                  ….          ….
 Organization 7   11001000 00010111 00011110 00000000

Spring 2007                                                         51
              IP Addressing: the Last Word...
   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

Spring 2007                                       52
      IP Forwarding & IP/ICMP Protocol

                             Transport layer: TCP, UDP

               Routing protocols                IP protocol
               •path selection                  •addressing conventions
               •RIP, OSPF, BGP                  •packet handling conventions
   layer                             table      ICMP protocol
                                                •error reporting
                                                •router “signaling”

                              Data Link layer (Ethernet, WiFi, PPP, …)

                                      Physical Layer (SONET, …)

 Spring 2007                                                                   53
   IP Service Model and Datagram Forwarding
 Connectionless (datagram-based)
      – Each datagram carries source and destination
 Best-effort delivery (unreliable service)
   – packets may be lost
   – packets can be delivered out of order
   – duplicate copies of a packet may be delivered
   – packets can be delayed for a long time
 Forwarding and IP address
   – forwarding based on network id
               Delivers packet to the appropriate network
               Once on destination network, direct delivery using host id
 IP destination-based next-hop forwarding paradigm
   – Each host/router has IP forwarding table
               Entries like <network prefix, next-hop, output interface>
      – Try out “netstat –rn” command

Spring 2007                                                                  54
                        IP Datagram Format
IP protocol version
            number                     32 bits                 total datagram
     header length            head. type of                    length (bytes)
            (bytes)      ver                      length
                                len service                     for
     “type” of data                                 fragment
                          16-bit identifier flgs                fragmentation/
        max number        time to    upper        Internet      reassembly
     remaining hops         live      layer       checksum
   (decremented at
                                32 bit source IP address
       each router)
                            32 bit destination IP address
upper layer protocol
to deliver payload to                                          E.g. timestamp,
                                   Options (if any)
                                                               record route
how much overhead                       data                   taken, specify
   with TCP?                      (variable length,            list of routers
 20 bytes of TCP                  typically a TCP             to visit.
 20 bytes of IP                  or UDP segment)
 = 40 bytes + app
    layer overhead

  Spring 2007                                                              55
               IP Datagram Forwarding Model
                                          forwarding table in A
                                      Dest. Net. next router Nhops
                                       223.1.1                          1
                                       223.1.2          2
IP datagram:                           223.1.3          2
  misc source dest
                          data    A
 fields IP addr IP addr      

  datagram remains           

   unchanged, as it travels         

   source to destination          B
  addr fields of interest here

 Spring 2007                                                                      56
                         IP Forwarding Table
     4 billion possible entries!
     (in reality, far less, but can still have millions of “routes”)

forwarding table entry format
 destination network                          next-hop (IP address)    link interface
(1st IP address , network mask )

11001000 00010111 00010000 00000000,                   0
11111111 11111111 11111000 00000000

11001000 00010111 00011000 00000000,           - (direct)                   1
11111111 11111111 11111111 00000000

11001000 00010111 00011001 00000000,                   2
11111111 11111111 11111000 00000000

otherwise                                               3

 Spring 2007                                                                       57
                Forwarding Table Lookup
              using Longest Prefix Matching
              Prefix Match             Next Hop     Link Interface
         11001000 00010111 00010        0
         11001000 00010111 00011000       -              1
         11001000 00010111 00011        2
                otherwise             3


      DA: 11001000 00010111 00010110 10100001         Which interface?

       DA: 11001000 00010111 00011000 10101010        Which interface?

Spring 2007                                                          58
 IP Forwarding: Destination in Same Net
                                        forwarding table in A
                                        Dest. Net. next router Nhops
fields               223.1.1                          1
                                         223.1.2          2
Starting at A, send IP                   223.1.3          2

  datagram addressed to B:          A
 look up net. address of B in                          
  forwarding table              
 find B is on same net. as A       B
 link layer will send datagram                 E
  directly to B inside link-layer      
    – B and A are directly
Spring 2007                                                                     59
       IP Datagram Forwarding on Same LAN:
         Interaction of IP and data link layers
Starting at A, given IP
  datagram addressed to B:
 look up net. address of B, find       
  B on same net. as A                       B
 link layer send datagram to B       
  inside link-layer frame
          frame source,       datagram source,         
          dest address          dest address

    B’s MAC A’s MAC           A’s IP   B’s IP
                                                  IP payload
      addr    addr            addr     addr


 Spring 2007                                                                            60
               MAC (Physical) Addresses
  used to get frames from one interface to another physically-connected
   interface (same physical network, i.e., p2p or LAN)
  48 bit MAC address (for most LANs)
    – fixed for each adaptor, burned in the adapter ROM
    – MAC address allocation administered by IEEE
          1st bit: 0 unicast, 1 multicast.
          all 1‟s : broadcast
  MAC flat address -> portability
    – can move LAN card from one LAN to another
  MAC addressing operations on a LAN:
    – each adaptor on the LAN “sees” all frames
    – accept a frame if dest. MAC address matches its own MAC address
    – accept all broadcast (MAC= all1‟s) frames
    – accept all frames if set in “promiscuous” mode
    – can configure to accept certain multicast addresses (first bit = 1)

Spring 2007                                                                 61
                  MAC vs. IP Addresses
32-bit IP address:
 network-layer address, logical
   – i.e., not bound to any physical device, can be re-assigned
 IP hierarchical address NOT portable
   – depends on IP network to which an interface is attached
   – when move to another IP network, IP address re-assigned
 used to get IP packets to destination IP network
   – Recall how IP datagram forwarding is performed
 IP network is “virtual,” actually packet delivery done by the underlying physical
   – from source host to destination host, hop-by-hop via IP routers
   – over each link, different link layer protocol used, with its own frame
      headers, and source and destination MAC addresses
         Underlying physical networks do not understand IP protocol and
           datagram format!

Spring 2007                                                                      62
        ARP: Address Resolution Protocol
Question: how to determine  Each IP node (host, router)
MAC address of B             on LAN has ARP table
knowing B’s IP address?     ARP Table: IP/MAC
                             address mappings for some
                             LAN nodes
                            < IP address; MAC address;
                                 – timer: time after
                                   which address
                                   mapping will be
                                   forgotten (typically 20
Spring 2007                                                  63
                  ARP Protocol

   A wants to send datagram    B receives ARP packet, replies to
                                 A with its (B's) MAC address
    to B, and A knows B‟s IP
                                  – frame sent to A‟s MAC
    address.                         address (unicast)
   A looks up B‟s MAC          A caches (saves) IP-to-MAC address
    address in its ARP table     pair in its ARP table until
                                 information becomes old (times out)
   Suppose B‟s MAC address       – soft state: information that
    is not in A‟s ARP table.        times out (goes away) unless
   A broadcasts (why?) ARP         refreshed
    query packet, containing    ARP is “plug-and-play”:
    B's IP address                – nodes create their ARP
                                    tables without intervention
     – all machines on LAN          from net administrator
        receive ARP query

Spring 2007                                                            64
                     ARP Messages

     Hardware Address Type: e.g., Ethernet
     Protocol address Type: e.g., IP
     Operation: ARP request or ARP response

Spring 2007                                   65
      ARP Request & Response Processing
The requester broadcasts ARP request
The target node unicasts (why?) ARP reply to requester
      – With its physical address
      – Adds the requester into its ARP table (why?)
On receiving the response, requester
      – updates its table, sets timer
Other nodes upon receiving the ARP request
      – Refresh the requester entry if already there
      – No action otherwise (why?)
Some questions to think about:
      – Shall requester buffer IP datagram while performing ARP?
      – What shall requester do if never receive any ARP response?
Spring 2007                                                          66
              ARP Operation Illustration

Spring 2007                                67
      IP Forwarding: Destination in Diff. Net
                             data           forwarding table in A
                                            Dest. Net. next router Nhops
Starting at A, dest. E:                     223.1.1                  1
                                            223.1.2     2
 look up network address of E in           223.1.3     2
  forwarding table
 E on different network                A
    – A, E not directly attached                            
 routing table: next hop router to E
  is                          B
 link layer sends datagram to router
                                                                                    E inside link-layer frame
 datagram arrives at          

 continued…..

  Spring 2007                                                                       68
 IP Forwarding: Destination in Diff. Net …
                                           forwarding table in router
   fields             Dest. Net router Nhops interface
                                          223.1.1          -       1
Arriving at 223.1.4, destined for         223.1.2          -       1                               223.1.3          -       1
 look up network address of E in
  router‟s forwarding table               A
 E on same network as router‟s                               
    – router, E directly attached
 link layer sends datagram to                                  
                                                     E inside link-layer frame via
 datagram arrives at!!!

   Spring 2007                                                                         69
                Forwarding to Another LAN:
              Interaction of IP and Data Link Layer
     walkthrough: send datagram from A to B via R
                  assume A knows B IP address



      Two ARP tables in router R, one for each IP network (LAN)
      In routing table at source host, find router
      In ARP table at source, find MAC address E6-E9-00-17-BB-4B, etc
Spring 2007                                                              70
          A                   R
     A creates datagram with source A, destination B
     A uses ARP to get R‟s MAC address for
     A creates link-layer frame with R's MAC address as dest,
      frame contains A-to-B IP datagram
     A‟s data link layer sends frame
     R‟s data link layer receives frame
     R removes IP datagram from Ethernet frame, sees its
      destined to B
     R uses ARP to get B‟s physical layer address
     R creates frame containing A-to-B IP datagram sends to B
Spring 2007                                                      71
                 IP Datagram Format Again
IP protocol version
            number                    32 bits                 total datagram
     header length           head. type of                    length (bytes)
            (bytes)     ver                      length
                               len service                     for
     “type” of data                                fragment
                         16-bit identifier flgs                fragmentation/
        max number       time to    upper        Internet      reassembly
     remaining hops        live      layer       checksum
   (decremented at
                               32 bit source IP address
       each router)
                           32 bit destination IP address
upper layer protocol
to deliver payload to                                         E.g. timestamp,
                                  Options (if any)
                                                              record route
how much overhead                      data                   taken, specify
   with TCP?                     (variable length,            list of routers
 20 bytes of TCP                 typically a TCP             to visit.
 20 bytes of IP                 or UDP segment)
 = 40 bytes + app
    layer overhead

  Spring 2007                                                             72
                       Fields in IP Datagram
   IP protocol version: current version is 4, IPv4, new: IPv6
   Header length: number of 32-bit words in the header
   Type of Service:
        – 3-bit priority,e.g, delay, throughput, reliability bits, …
   Total length: including header (maximum 65535 bytes)
   Identification: all fragments of a packet have same
   Flags: don‟t fragment, more fragments
   Fragment offset: where in the original packet (count in 8 byte
   Time to live: maximum life time of a packet
   Protocol Type: e.g., ICMP, TCP, UDP etc
   IP Option: non-default processing, e.g., IP source routing
    option, etc.
Spring 2007                                                            73
         IP Fragmentation & Reassembly: Why
 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
    – “reassembled” only at
      final destination
    – IP header bits used to
      identify, order related

 Spring 2007                                                    74
       IP Fragmentation & Reassembly: How
 An IP datagram is chopped by a router into smaller pieces if
   – datagram size is greater than network MTU
   – Don‟t fragment option is not set
 Each datagram has unique datagram identification
      – Generated by source hosts
   – All fragments of a packet carry original datagram id
 All fragments except the last have more flag set
      – Fragment offset and Length fields are modified appropriately
 Fragments of IP packet can be further fragmented by other
  routers along the way to destination !
 Reassembly only done at destination host (why?)
   – Use IP datagram id, fragment offset, fragment flags. Length
   – A timer is set when first fragment is received (why?)

Spring 2007                                                            75
      IP Fragmentation and Reassembly: Exp
                       length ID fragflag offset
Example                =4000 =x     =0      =0

 4000 byte          One large datagram becomes
  datagram           several smaller datagrams

 MTU = 1500 bytes         length ID fragflag offset
                           =1500 =x     =1      =0

                           length ID fragflag offset
                           =1500 =x     =1    =1480

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

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

Spring 2007                                                             77
              ICMP Message Transport & Usage
ICMP messages carried in IP datagrams
Treated like any other datagrams
      – But no error message sent if ICMP message causes error
Message sent to the source
      – 8 bytes of the original header included
ICMP Usage (non-error, informational): Examples
      – Testing reachability: ICMP echo request/reply
               ping
      – Tracing route to a destination: Time-to-live field
               traceroute
      – Path MTU discovery
               Don‟t fragment bit
      – IP direct (for hosts only): inform hosts of better routes

Spring 2007                                                         78

              That‟s all for today!

Spring 2007                           79