View
75
Download
3
Category
Tags:
Preview:
DESCRIPTION
Routing & Switching. Umar Kalim Dept. of Communication Systems Engineering umar.kalim@niit.edu.pk http://www.niit.edu.pk/~umarkalim 20/03/2007. Ref: CSci5211 Univ. of Minnesota. Agenda. Virtual Circuit Switching Model Datagram Switching Model Router Tables - Overview - PowerPoint PPT Presentation
Citation preview
Spring 2007 1
Routing & Switching
Umar KalimDept. of Communication Systems
Engineering
umar.kalim@niit.edu.pkhttp://www.niit.edu.pk/~umarkalim
20/03/2007
Ref: CSci5211 Univ. of Minnesota
Spring 2007 2
AgendaVirtual Circuit Switching ModelDatagram Switching ModelRouter Tables - OverviewLongest Prefix Match
– ARPICMP
Spring 2007 3
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 4
Virtual Circuit SwitchingExplicit connection setup (and tear-down)
phaseSubsequence packets follow same circuitSometimes called connection-oriented
modelstill packet switching, not circuit
switching!Analogy:
phone call
Each switch maintains a VC table
2
0
1
2
3
0
1
2
3
0
13
0
1
2
3
Host A Host B
Switch 3
Switch 2Switch 1
75
4
11
Spring 2007 5
Datagram Switching
No connection setup phaseEach packet forwarded independently Sometimes called connectionless model
Analogy: postal system
Each switch maintains a forwarding (routing) table
0
132
0
1 3
2
013
2
Switch 3 Host B
Switch 2
Host A
Switch 1
Host C
Host D
Host EHost F
Host G
Host H
Spring 2007 6
Forwarding Tables: VC vs. Datagram
Virtual Circuit Forwarding Table
a.k.a. VC (Translation) Table
(switch 1, port 2)
Datagram Forwarding Table
(switch 1)
Address PortA 2C 3F 1G 1… …
VC In VC Out Port Out
5 11 16 8 1
… … …
Spring 2007 7
More on Virtual Circuits
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
“source-to-dest path behaves much like telephone circuit” (but actually over packet network)
Spring 2007 9
Virtual Circuit Setup/TeardownCall 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 10
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”)
VCI translation table (aka “forwarding table”), built at call set-up phase
1
2
13
1
2 2
1
four “calls” going thru the router, each entry corresponding one call
green call
purple call
blue call
orange call
Spring 2007 11
Virtual Circuit: Example
0
13
2
0
1 3
2
0
13
2
511
4
7
Router 3
Host B
Router 2
Host A
Router 1
Router 4
“call” from host A to host B along path: host A router 1 router 2 router 3 host B
•each router along path maintains an entry for the call in its VCI translation table• the entries piece together a “logical connection” for the call
Spring 2007 12
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
identifierIf a switch or a link in a connection fails
– new connection needs to be established.Provides opportunity to reserve
resources.
Spring 2007 13
ATM Networks
Study for Reference
Spring 2007 14
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!
application
transportnetworkdata linkphysical
application
transportnetworkdata linkphysical
1. Send data 2. Receive data
Spring 2007 15
Datagram ModelThere 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 16
Network Layer Service Models:
Internet model being extended: MPLS, Diffserv
Spring 2007 17
Datagram or VC: Why?Internet data exchange among
computers
– “elastic” service, no strict timing req.
“smart” end systems (computers)
– can adapt, perform control, error recovery
– simple inside network, complexity at “edge”
many link types
– different characteristics– uniform service difficult
ATM evolved from telephony human conversation:
– strict timing, reliability requirements
– need for guaranteed service
“dumb” end systems– telephones– complexity inside
networkMPLS evolve from ATM
– traffic engineering, fast path restoration (a priori “backup” paths)
Spring 2007 25
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->tcp/ip->properties– UNIX: /etc/rc.config
Dynamically assigned: using DHCP (Dynamic Host Configuration Protocol)– dynamically get address from as server– “plug-and-play”
Spring 2007 26
DHCP: Dynamic Host Configuration Protocol
Goal: allow host to dynamically obtain its IP address from network server when it joins networkCan renew its lease on address in useAllows reuse of addresses (only hold address while
connected an “on”Support for mobile users who want to join network
(more shortly)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 27
DHCP Client-Server Scenario
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2223.1.3.1
223.1.3.27
A
B
E
DHCP server
arriving DHCP client needsaddress in thisnetwork
Spring 2007 28
DHCP Client-Server ScenarioDHCP server: 223.1.2.5 arriving
client
time
DHCP discover
src : 0.0.0.0, 68 dest.: 255.255.255.255,67yiaddr: 0.0.0.0transaction ID: 654
DHCP offer
src: 223.1.2.5, 67 dest: 255.255.255.255, 68yiaddrr: 223.1.2.4transaction ID: 654Lifetime: 3600 secs
DHCP request
src: 0.0.0.0, 68 dest:: 255.255.255.255, 67yiaddrr: 223.1.2.4transaction ID: 655Lifetime: 3600 secs
DHCP ACK
src: 223.1.2.5, 67 dest: 255.255.255.255, 68yiaddrr: 223.1.2.4transaction ID: 655Lifetime: 3600 secs
Spring 2007 29
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 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
Spring 2007 30
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 31
IP Forwarding & IP/ICMP Protocol
Networklayer routing
table
Routing protocols•path selection•RIP, OSPF, BGP
IP protocol•addressing conventions•packet handling conventions
ICMP protocol•error reporting•router “signaling”
Transport layer: TCP, UDP
Data Link layer (Ethernet, WiFi, PPP, …)
Physical Layer (SONET, …)
Spring 2007 32
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 33
IP Datagram Format
ver length
32 bits
data (variable length,typically a TCP
or UDP segment)
16-bit identifier
Internet checksum
time tolive
32 bit source IP address
IP protocol versionnumber
header length (bytes)
max numberremaining hops
(decremented at each router)
forfragmentation/reassembly
total datagramlength (bytes)
upper layer protocolto deliver payload to
head.len
type ofservice
“type” of data flgs fragment offset
upper layer
32 bit destination IP address
Options (if any) E.g. timestamp,record routetaken, specifylist of routers to visit.
how much overhead with TCP?
20 bytes of TCP 20 bytes of IP = 40 bytes + app
layer overhead
Spring 2007 34
IP Datagram Forwarding Model
IP datagram: miscfields
sourceIP addr
destIP addr data
datagram remains unchanged, as it travels source to destination
addr fields of interest here
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2223.1.3.1
223.1.3.27
A
BE
Dest. Net. next router Nhops
223.1.1 1223.1.2 223.1.1.4 2223.1.3 223.1.1.4 2
forwarding table in A
Spring 2007 35
IP Forwarding Table4 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, 200.23.16.1 0 11111111 11111111 11111000 00000000
11001000 00010111 00011000 00000000, - (direct) 1 11111111 11111111 11111111 00000000
11001000 00010111 00011001 00000000, 200.23.25.6 2 11111111 11111111 11111000 00000000
otherwise 128.30.0.1 3
Spring 2007 36
Forwarding Table Lookupusing Longest Prefix
Matching Prefix Match Next Hop Link Interface
11001000 00010111 00010 200.23.16.1 0 11001000 00010111 00011000 - 1 11001000 00010111 00011 200.23.25.6 2 otherwise 128.30.0.1 3
DA: 11001000 00010111 00011000 10101010
Examples
DA: 11001000 00010111 00010110 10100001 Which interface?
Which interface?
Spring 2007 37
IP Forwarding: Destination in Same Net
Starting at A, send IP datagram addressed to B:
look up net. address of B in forwarding table
find B is on same net. as A link layer will send datagram
directly to B inside link-layer frame– B and A are directly connected
miscfields223.1.1.1223.1.1.3data
Dest. Net. next router Nhops
223.1.1 1223.1.2 223.1.1.4 2223.1.3 223.1.1.4 2
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2223.1.3.1
223.1.3.27
A
BE
forwarding table in A
Spring 2007 38
IP Datagram Forwarding on Same LAN:
Interaction of IP and data link layers
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2223.1.3.1
223.1.3.27
A
BE
Starting at A, given IP datagram addressed to B:
look up net. address of B, find B on same net. as A
link layer send datagram to B inside link-layer frame
B’s MACaddr
A’s MACaddr
A’s IPaddr
B’s IPaddr
IP payload
datagramframe
frame source,dest address
datagram source,dest address
Spring 2007 39
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 40
MAC vs. IP Addresses32-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 networks– 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 41
ARP: Address Resolution Protocol
Each IP node (host, router) on LAN has ARP table
ARP Table: IP/MAC address mappings for some LAN nodes
< IP address; MAC address; timer>
– timer: time after which address mapping will be forgotten (typically 20 min)
try out “arp –a” command
Question: how to determineMAC address of Bknowing B’s IP address?
Spring 2007 42
ARP Protocol
A wants to send datagram to B, and A knows B’s IP address.
A looks up B’s MAC address in its ARP table
Suppose B’s MAC address is not in A’s ARP table.
A broadcasts (why?) ARP query packet, containing B's IP address – all machines on LAN
receive ARP query
B receives ARP packet, replies to A with its (B's) MAC address– frame sent to A’s MAC
address (unicast) A caches (saves) IP-to-MAC
address pair in its ARP table until information becomes old (times out) – soft state: information
that times out (goes away) unless refreshed
ARP is “plug-and-play”:– nodes create their ARP
tables without intervention from net administrator
Spring 2007 43
ARP Messages
Hardware Address Type: e.g., EthernetProtocol address Type: e.g., IPOperation: ARP request or ARP response
Spring 2007 44
ARP Request & Response Processing
The requester broadcasts ARP requestThe 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 45
ARP Operation Illustration
Spring 2007 46
IP Forwarding: Destination in Diff. Net
Starting at A, dest. E: look up network address of E
in forwarding table E on different network
– A, E not directly attached routing table: next hop router
to E is 223.1.1.4 link layer sends datagram to
router 223.1.1.4 inside link-layer frame
datagram arrives at 223.1.1.4 continued…..
miscfields223.1.1.1223.1.2.3 data
Dest. Net. next router Nhops
223.1.1 1223.1.2 223.1.1.4 2223.1.3 223.1.1.4 2
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2223.1.3.1
223.1.3.27
A
BE
forwarding table in A
Spring 2007 47
IP Forwarding: Destination in Diff. Net …
Arriving at 223.1.4, destined for 223.1.2.2
look up network address of E in router’s forwarding table
E on same network as router’s interface 223.1.2.9 – router, E directly attached
link layer sends datagram to 223.1.2.2 inside link-layer frame via interface 223.1.2.9
datagram arrives at 223.1.2.2!!! (hooray!)
miscfields223.1.1.1223.1.2.3 data
Dest. Net router Nhops interface
223.1.1 - 1 223.1.1.4 223.1.2 - 1 223.1.2.9
223.1.3 - 1 223.1.3.27
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2223.1.3.1
223.1.3.27
A
BE
forwarding table in router
Spring 2007 48
Forwarding to Another LAN:Interaction of IP and Data Link
Layerwalkthrough: 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 111.111.111.110 In ARP table at source, find MAC address E6-E9-00-17-BB-4B,
etc
A
RB
Spring 2007 49
A creates datagram with source A, destination B A uses ARP to get R’s MAC address for
111.111.111.110 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
A RB
Spring 2007 55
ICMP: Internet Control Message Protocol
used by hosts, routers, gateways to communication network-level information– error reporting:
unreachable host, network, port, protocol
– echo request/reply (used by ping)
network-layer “above” IP:– ICMP msgs carried
in IP datagrams ICMP message: type,
code plus first 8 bytes of IP datagram causing error
Type Code description0 0 echo reply (ping)3 0 dest. network unreachable3 1 dest host unreachable3 2 dest protocol unreachable3 3 dest port unreachable3 6 dest network unknown3 7 dest host unknown4 0 source quench (congestion control - not used)8 0 echo request (ping)9 0 route advertisement10 0 router discovery11 0 TTL expired12 0 bad IP header
Spring 2007 56
ICMP Message Transport & Usage
ICMP messages carried in IP datagramsTreated 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 57
Questions?
That’s all for today!
Recommended