january 22, 2002ce80n -- lecture #61 ce80n introduction to networks & the internet dr. chane l....
TRANSCRIPT
January 22, 2002 CE80N -- Lecture #6 1
CE80NCE80NIntroduction to NetworksIntroduction to Networks
&&The InternetThe Internet
Dr. Chane L. Fullmer
UCSC
Winter 2002
January 22, 2002 CE80N -- Lecture #6 2
ReadingReading
Chapter 15 – – IP: Software To Create A Virtual Network
January 22, 2002 CE80N -- Lecture #6 3
Communication ProtocolCommunication Protocol
A common language computers use to exchange messages.– Specifying exact format and
meaning of each message– Sending and receiving
January 22, 2002 CE80N -- Lecture #6 4
What’s a protocol?What’s a protocol?
human protocols: “what’s the time?” “I have a question” Introductions
… specific msgs sent
… specific actions taken when msgs received, or other events
network protocols: machines rather than
humans all communication activity
in Internet governed by protocols
January 22, 2002 CE80N -- Lecture #6 5
What’s a protocol?What’s a protocol?
Q: Other human protocol?
Hi
Hi
Got thetime?
2:00
TCP connection req.
TCP connectionreply.Get http://gaia.cs.umass.edu/index.htm
<file>time
Human Protocol Computer Protocol
January 22, 2002 CE80N -- Lecture #6 6
Protocol “Layers”Protocol “Layers”
Networks are complex! many “pieces”:
– hosts– routers– links of various
media– applications– protocols– hardware,
software
Question: Is there any hope of organizing structure of
network?
Or at least our discussion of networks?
January 22, 2002 CE80N -- Lecture #6 7
Organization of air travelOrganization of air travel
a series of steps
Arrival at airport
baggage (check)
gates (load)
runway takeoff
airplane routing
Departure from airport
baggage (claim)
gates (unload)
runway landing
airplane routing
airplane routing
January 22, 2002 CE80N -- Lecture #6 8
Organization of air travelOrganization of air travel: a different view: a different view
Layers: each layer implements a service– via its own internal-layer actions– relying on services provided by layer below
Airport arrival
baggage (check)
gates (load)
runway takeoff
airplane routing
Airport departure
baggage (claim)
gates (unload)
runway landing
airplane routing
airplane routing
January 22, 2002 CE80N -- Lecture #6 9
Layered air travel: servicesLayered air travel: services
Airport-to-Airport delivery of person+bags
baggage-claim-to-baggage-claim delivery
people transfer: loading gate to arrival gate
runway-to-runway delivery of plane
airplane routing from source to destination
January 22, 2002 10
DistributedDistributed implementation of layer functionality implementation of layer functionality
Arrival
baggage (check)
gates (load)
runway takeoff
airplane routingDep
art
ing
air
port
Departure
baggage (claim)
gates (unload)
runway landing
airplane routing arr
ivin
g
air
port
airplane routing
intermediate air traffic sites
airplane routing airplane routing
January 22, 2002 11
DistributedDistributed implementation of layer functionality implementation of layer functionality
gates (load)
runway takeoff
airplane routingDep
art
inggates (unload)
runway landing
airplane routing arr
ivin
g
intermediate air traffic sites
January 22, 2002 CE80N -- Lecture #6 12
Layering ModelLayering Model
Purpose is to divide and conquer complex software and hardware needed to implement services
Partition services and functions needed in system into layers Each layer of service is provided by peer protocol entities Extensibility (new protocols and services easily added) Communication can be point-to-point or multipoint
Layer-N Protocol Entity
Layer-N Protocol Entity
Layer-(N - 1)Protocol Entity
Layer-(N - 1) Protocol Entity
(virtual communication)
Layer N packets
interface
NODE A NODE B
protocol
January 22, 2002 CE80N -- Lecture #6 13
Why layering?Why layering?
Dealing with complex systems: explicit structure allows identification,
relationship of complex system’s pieces– layered reference model for discussion
modularization eases maintenance, updating of system– change of implementation of layer’s service
transparent to rest of system– e.g., change in gate procedure doesn’t affect
rest of system Is layering considered harmful?
January 22, 2002 CE80N -- Lecture #6 14
Internet protocol stackInternet protocol stack application: supporting network
applications– ftp, smtp, http
transport: host-host data transfer– tcp, udp
network: routing of datagrams from source to destination– ip, routing protocols
link: data transfer between neighboring network elements– ppp, ethernet
physical: bits “on the wire”
application
transport
network
link
physical
January 22, 2002 CE80N -- Lecture #6 15
Layering: logical communication Layering: logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
Each layer: distributed “entities”
implement layer functions at each node
entities perform actions, exchange messages with peers
January 22, 2002 CE80N -- Lecture #6 16
Layering: Layering: logical logical communication communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
data
data
E.g.: transport take data from
application add addressing,
reliability check info to form “datagram”
send datagram to peer
wait for peer to ack receipt
analogy: post office
data
transport
transport
ack
January 22, 2002 CE80N -- Lecture #6 17
Layering: physical communication Layering: physical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
data
data
January 22, 2002 CE80N -- Lecture #6 18
Protocol layering and dataProtocol layering and data
Each layer takes data from above adds header information to create new data unit passes new data unit to layer below
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
January 22, 2002 CE80N -- Lecture #6 19
PHYSICAL
Open Systems Interconnect (OSI) StackOpen Systems Interconnect (OSI) Stack
LINK
End-user services (mail, file transfer)
Formatting, encryption, compression of data
Setup and management of end-to-end dialogue
End-to-end delivery of messages to processes
End-to-end transmission of packets in net
Transmission of packets over a link
Transmission of bit over physical media
Web access
TCP
IP
PPP, CSMA/CD
SONET
NETWORK
TRANSPORT
SESSION
PRESENTATION
APPLICATION
Proposed by the International Standards Organization
Specifies the functions at each layer, not the protocols that implement them
January 22, 2002 CE80N -- Lecture #6 20
Open Systems InterconnectOpen Systems Interconnect
Source: Link 2 Semiconductorhttp://www.link2semiconductor.com/articles/dob010911_p.htm
January 22, 2002 CE80N -- Lecture #6 21
Description of OSI layersDescription of OSI layers– Application layer: The application layer provides services
to a calling computer program. An application layer might take care of all the downloads involved in transferring a web page (that is, the text, graphics, and other files) to a browser (the client program or application).
– Presentation layer: Takes care of any data format translations that might be needed to take the particular bits representing, for example, a number in the client computer and convert them to a "universal" number representation recognized by the communications system.
– Session layer: This layer is responsible for controlling exchange of information, for example by having the client and server take turns transmitting data.
January 22, 2002 CE80N -- Lecture #6 22
OSI Layers (continued)OSI Layers (continued)
— Transport layer: The transport layer is responsible for getting messages from one computer to another. Network layer: The network layer is responsible for getting data across a communications network from one host computer to another. Data Link layer: The data link layer (often abbreviated to "link" layer or DLL) gets data from one network node (e.g. a computer or router) to another. Physical layer: The physical layer is the set of specifications that describe the actual medium of transmission. For example, a physical layer specification might include the type of connectors and wire to be used in a cable linking two machines, as well as the function of each wire and voltage levels that specify a "1" or "0", allowed rate of transmission, and so on.
January 22, 2002 CE80N -- Lecture #6 23
Basic Functionality: Basic Functionality: Internet Protocol (IP)Internet Protocol (IP)
IP defines computer communication details.– Specifying how packets are formed– Specifying how routers forward each packet
• IP Forwarding
Computers connecting to the Internet must follow the IP rules.
January 22, 2002 CE80N -- Lecture #6 24
IP Software On Every MachineIP Software On Every Machine
Computer hardware does not understand IP.– Connecting a computer to the Internet
does not mean it can use the InternetComputers need IP software before
using the Internet.– Windows– Unix– Mac OS
January 22, 2002 CE80N -- Lecture #6 25
Internet Packets Are Called Internet Packets Are Called DatagramsDatagrams
IP Datagrams are packets that follow the IP specifications.– Traveling across the
Internet independent of sender
January 22, 2002 CE80N -- Lecture #6 26
The Illusion Of A Giant The Illusion Of A Giant NetworkNetwork
Any computer can send IP datagrams to any other computer providing they have IP software installed (Universal Service)
The Internet operates like a virtual network.
The Virtual NetworkThe Virtual Network
Figure 15.1 The view of the Internet that IP software provides. Users and application programs treat the Internet like a single large network that allow arbitrary numbers of computers to communicate.
January 22, 2002 CE80N -- Lecture #6 28
The Reality Of Internal The Reality Of Internal StructureStructure
The Internet contains a complex physical structure users never see– Interconnecting networks with routers
Internet Internal StructureInternet Internal Structure
Figure 15.2 A small example of the physical structure that remains hidden inside the Internet. Each computer attaches to a single network; routers interconnect the networks.
January 22, 2002 CE80N -- Lecture #6 30
Datagrams Travel In PacketsDatagrams Travel In Packets
IP datagram defines a standard for all Internet packets. Routers:– Encloses the data before sending out the
packet• “Data Encapsulation”
January 22, 2002 CE80N -- Lecture #6 31
IP datagram formatIP 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 flgsfragment
offsetupper layer
32 bit destination IP address
Options (if any) E.g. timestamp,record routetaken, specifylist of routers to visit.
January 22, 2002 CE80N -- Lecture #6 32
Every Computer Is Assigned A Every Computer Is Assigned A Unique AddressUnique Address
Each computer attached to the Internet must be assigned a unique address.– One computer must know the address
of another before it can communicate
January 22, 2002 CE80N -- Lecture #6 33
Internet AddressesInternet Addresses
The unique number assigned to a computer is its Internet (IP) address.
Each computer (including routers) need to have an IP address.
January 22, 2002 CE80N -- Lecture #6 34
An Odd IP Address SyntaxAn Odd IP Address Syntax
Computer stores IP address in four binary units called bytes.
“one twenty-eight dot one fourteen dot one dot zero”
January 22, 2002 CE80N -- Lecture #6 35
IP Addresses Are Not RandomIP Addresses Are Not Random
IP addresses are not random.Computers on the same network
have the same prefix.
January 22, 2002 CE80N -- Lecture #6 36
IP Addressing: introductionIP Addressing: introduction 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 interface, not host, router
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
223.1.1.1 = 11011111 00000001 00000001 00000001
223 1 11
January 22, 2002 CE80N -- Lecture #6 37
IP AddressingIP Addressing IP address:
– network part (high order bits)
– host part (low order bits)
What’s a network ? (from IP address perspective)– device interfaces with
same network part of IP address
– can physically reach each other without intervening router
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
network consisting of 3 IP networks(for IP addresses starting with 223, first 24 bits are network address)
LAN
January 22, 2002 CE80N -- Lecture #6 38
IP AddressingIP Addressing
How to find the networks?
Detach each interface from router, host
create “islands of isolated networks
223.1.1.1
223.1.1.3
223.1.1.4
223.1.2.2223.1.2.1
223.1.2.6
223.1.3.2223.1.3.1
223.1.3.27
223.1.1.2
223.1.7.0
223.1.7.1223.1.8.0223.1.8.1
223.1.9.1
223.1.9.2
Interconnected system consisting
of six networks
January 22, 2002 CE80N -- Lecture #6 39
IP AddressesIP Addresses
0network host
10 network host
110 network host
1110 multicast address
A
B
C
D
class1.0.0.0 to127.255.255.255
128.0.0.0 to191.255.255.255
192.0.0.0 to223.255.255.255
224.0.0.0 to239.255.255.255
32 bits
given notion of “network”, let’s re-examine IP addresses:
“class-full” addressing:
January 22, 2002 CE80N -- Lecture #6 40
IP addressing: CIDRIP 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 InterDomain Routing– network portion of address of arbitrary length– address format: a.b.c.d/x, where x is # bits in network
portion of address
11001000 00010111 00010000 00000000
networkpart
hostpart
200.23.16.0/23
January 22, 2002 CE80N -- Lecture #6 41
IP addresses: how to get one?IP addresses: how to get one?
Q: How does host get IP address? hard-coded by system admin in a file
– Wintel: control-panel->network->config->tcp/ip->properties (reboot)
– UNIX: /etc/rc.config
DHCP: Dynamic Host Configuration Protocol: – dynamically get address: “plug-and-play”– 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
January 22, 2002 CE80N -- Lecture #6 42
IP addresses: how to get one?IP addresses: how to get one?
Network (network portion):get allocated portion of 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
January 22, 2002 CE80N -- Lecture #6 43
IP addressing: the last word...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
January 22, 2002 CE80N -- Lecture #6 44
Hierarchical addressing: route aggregationHierarchical addressing: route aggregation
“Send me anythingwith addresses beginning 200.23.16.0/20”
200.23.16.0/23
200.23.18.0/23
200.23.30.0/23
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us“Send me anythingwith addresses beginning 199.31.0.0/16”
200.23.20.0/23Organization 2
...
...
•Hierarchical addressing allows efficient advertisement of routing information:
January 22, 2002 CE80N -- Lecture #6 45
Hierarchical addressing: more specific Hierarchical addressing: more specific routesroutes
•ISPs-R-Us has a more specific route to Organization 1
“Send me anythingwith addresses beginning 200.23.16.0/20”
200.23.16.0/23
200.23.18.0/23
200.23.30.0/23
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us“Send me anythingwith addresses beginning 199.31.0.0/16or 200.23.18.0/23”
200.23.20.0/23Organization 2
...
...
January 22, 2002 CE80N -- Lecture #6 46
A Trip Through The InternetA Trip Through The Internet
A router must choose between two paths that both lead to the destination.– Choosing the shortest path
January 22, 2002 CE80N -- Lecture #6 47
Getting a datagram from source to dest.Getting a datagram from source to dest.
IP datagram:
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
miscfields
sourceIP addr
destIP addr data
datagram remains unchanged, as it travels source to destination
addr fields of interest here
Dest. Net. next router Nhops
223.1.1 1223.1.2 223.1.1.4 2223.1.3 223.1.1.4 2
routing table in A
January 22, 2002 CE80N -- Lecture #6 48
Getting a datagram from source to dest.Getting a datagram from source to dest.
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 is on same net. as A link layer will send datagram
directly to B inside link-layer frame– B and A are directly
connected
Dest. Net. next router Nhops
223.1.1 1223.1.2 223.1.1.4 2223.1.3 223.1.1.4 2
miscfields223.1.1.1223.1.1.3data
January 22, 2002 CE80N -- Lecture #6 49
Getting a datagram from source to dest.Getting a datagram from source to dest.
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
Starting at A, dest. E: look up network address of E 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
January 22, 2002 CE80N -- Lecture #6 50
Getting a datagram from source to dest.Getting a datagram from source to dest.
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
Arriving at 223.1.4, destined for 223.1.2.2
look up network address of E 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 network 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
Dest. next
January 22, 2002 CE80N -- Lecture #6 51
RoutingRouting
Graph abstraction for routing algorithms:
graph nodes are routers
graph edges are physical links– link cost: delay, $ cost,
or congestion level
Goal: determine “good” path
(sequence of routers) thru network from source to
dest.
Routing protocol
A
ED
CB
F
2
2
13
1
1
2
53
5
“good” path:– typically means
minimum cost path– other def’s possible
January 22, 2002 CE80N -- Lecture #6 52
Animation of Routing AlgorithmsAnimation of Routing Algorithms
Dijkstra’s algorithm:http://ciips.ee.uwa.edu.au/~morris/Year2/PLDS210/
dijkstra.html
http://www-b2.is.tokushima-u.ac.jp/~ikeda/suuri/dijkstra/DijkstraApp.shtml?demo3
Distance Vector algorithm:http://www-mm.informatik.uni-mannheim.de/
veranstaltungen/animation/routing/ripdvmrp/
January 22, 2002 CE80N -- Lecture #6 53
Routing Algorithm classificationRouting Algorithm classification
Global or decentralized information?
Global: all routers have complete
topology, link cost info “link state” algorithmsDecentralized: router knows physically-
connected neighbors, link costs to neighbors
iterative process of computation, exchange of info with neighbors
“distance vector” algorithms
Static or dynamic?Static: routes change slowly
over time
Dynamic: routes change more
quickly– periodic update– in response to link
cost changes
January 22, 2002 CE80N -- Lecture #6 54
A Link-State Routing AlgorithmA Link-State Routing Algorithm
Dijkstra’s algorithm net topology, link costs
known to all nodes– accomplished via “link
state broadcast” – all nodes have same info
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 dest.’s
Notation: c(i,j): link cost from node
i to j. cost infinite if not direct neighbors
D(v): current value of cost of path from source to dest. V
p(v): predecessor node along path from source to v, that is next v
N: set of nodes whose least cost path definitively known
January 22, 2002 CE80N -- Lecture #6 55
Dijkstra’s AlgorithmDijkstra’s Algorithm1 Initialization: 2 N = {A} 3 for all nodes v 4 if v adjacent to A 5 then D(v) = c(A,v) 6 else D(v) = infty 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N: 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
January 22, 2002 CE80N -- Lecture #6 56
Dijkstra’s algorithm: exampleDijkstra’s algorithm: exampleStep
012345
start NA
ADADE
ADEBADEBC
ADEBCF
D(B),p(B)2,A2,A2,A
D(C),p(C)5,A4,D3,E3,E
D(D),p(D)1,A
D(E),p(E)infinity
2,D
D(F),p(F)infinityinfinity
4,E4,E4,E
A
ED
CB
F
2
2
13
1
1
2
53
5
January 22, 2002 CE80N -- Lecture #6 57
Dijkstra’s algorithm, discussionDijkstra’s algorithm, discussionAlgorithm complexity: n nodes each iteration: need to check all nodes, w, not in N n*(n+1)/2 comparisons: O(n**2) more efficient implementations possible: O(nlogn)
Oscillations possible: e.g., link cost = amount of carried traffic
A
D
C
B1 1+e
e0
e
1 1
0 0
A
D
C
B2+e 0
001+e1
A
D
C
B0 2+e
1+e10 0
A
D
C
B2+e 0
e01+e1
initially… recompute
routing… recompute … recompute
January 22, 2002 CE80N -- Lecture #6 58
Distance Vector Routing AlgorithmDistance Vector Routing Algorithm
iterative: continues until no
nodes exchange info. self-terminating: no
“signal” to stop
asynchronous: nodes need not
exchange info/iterate in lock step!
distributed: each node
communicates only with directly-attached neighbors
Distance Table data structure each node has its own row for each possible
destination column for each directly-
attached neighbor to node example: in node X, for dest. Y
via neighbor Z:
D (Y,Z)X
distance from X toY, via Z as next hop
c(X,Z) + min {D (Y,w)}Z
w
=
=
January 22, 2002 CE80N -- Lecture #6 59
Distance Table: exampleDistance Table: example
A
E D
CB7
8
1
2
1
2
D ()
A
B
C
D
A
1
7
6
4
B
14
8
9
11
D
5
5
4
2
Ecost to destination via
dest
inat
ion
D (C,D)E
c(E,D) + min {D (C,w)}D
w== 2+2 = 4
D (A,D)E
c(E,D) + min {D (A,w)}D
w== 2+3 = 5
D (A,B)E
c(E,B) + min {D (A,w)}B
w== 8+6 = 14
loop!
loop!
January 22, 2002 CE80N -- Lecture #6 60
Distance table gives routing tableDistance table gives routing table
D ()
A
B
C
D
A
1
7
6
4
B
14
8
9
11
D
5
5
4
2
Ecost to destination via
dest
inat
ion
A
B
C
D
A,1
D,5
D,4
D,4
Outgoing link to use, cost
dest
inat
ion
Distance table Routing table
January 22, 2002 CE80N -- Lecture #6 61
Distance Vector Routing: overviewDistance Vector Routing: overview
Iterative, asynchronous: Each local iteration caused
by: – local link cost change
– message from neighbor: its least cost path change from neighbor
Distributed: each node notifies neighbors
only when its least cost path to any destination changes– neighbors then notify their
neighbors if necessary
wait for (change in local link cost of msg from neighbor)
recompute distance table
if least cost path to any dest
has changed, notify neighbors
Each node:
January 22, 2002 CE80N -- Lecture #6 62
Distance Vector Algorithm:Distance Vector Algorithm:
1 Initialization: 2 for all adjacent nodes v: 3 D (*,v) = infty /* the * operator means "for all rows" */ 4 D (v,v) = c(X,v) 5 for all destinations, y 6 send min D (y,w) to each neighbor /* w over all X's neighbors */
XX
Xw
At all nodes, X:
CE80N -- Lecture #6 63
Distance Vector Algorithm (cont.):Distance Vector Algorithm (cont.):8 loop 9 wait (until I see a link cost change to neighbor V 10 or until I receive update from neighbor V) 11 12 if (c(X,V) changes by d) 13 /* change cost to all dest's via neighbor v by d */ 14 /* note: d could be positive or negative */ 15 for all destinations y: DX(y,V) = DX(y,V) + d 16 17 else if (update received from V wrt destination Y) 18 /* shortest path from V to some Y has changed */ 19 /* V has sent a new value for its minw DV(Y,w) */ 20 /* call this received new value is "newval" */ 21 for the single destination y: DX(Y,V) = c(X,V) + newval 22 23 if we have a new minw DX(Y,w)for any destination Y 24 send new value of minw DX (Y,w) to all neighbors 25 26 forever
January 22, 2002 CE80N -- Lecture #6 64
Comparison of LS and DV algorithmsComparison of LS and DV algorithms
Message complexity LS: with n nodes, E links,
O(nE) msgs sent each DV: exchange between
neighbors only– convergence time varies
Speed of Convergence LS: O(n2) algorithm requires
O(nE) msgs– may have oscillations
DV: convergence time varies– may be routing loops– count-to-infinity problem
Robustness: what happens if router malfunctions?
LS: – node can advertise
incorrect link cost
– each node computes only its own table
DV:– DV node can advertise
incorrect path cost
– each node’s table used by others
• error propagate thru network
January 22, 2002 CE80N -- Lecture #6 65
ICMP: Internet Control Message ProtocolICMP: 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
January 22, 2002 CE80N -- Lecture #6 66
SummarySummary
Protocols and protocol stack– Internet stack, OSI stack
IP addressing IP forwarding Routing
– Link State– Distance Vector
January 22, 2002 CE80N -- Lecture #6 67
GlossaryGlossary Protocol
– The rules two or more computers must follow to exchange messages
Internet Protocol – (IP) Specification for the format of packets
computers use when communicating across the Internet
IP Datagram – A packet of data sent across the Internet