Download ECE544Lec4-5DR07

Document related concepts

Internet protocol suite wikipedia , lookup

Piggybacking (Internet access) wikipedia , lookup

AppleTalk wikipedia , lookup

Point-to-Point Protocol over Ethernet wikipedia , lookup

Network tap wikipedia , lookup

Backpressure routing wikipedia , lookup

Computer network wikipedia , lookup

Asynchronous Transfer Mode wikipedia , lookup

Wake-on-LAN wikipedia , lookup

List of wireless community networks by region wikipedia , lookup

Zero-configuration networking wikipedia , lookup

Airborne Networking wikipedia , lookup

Multiprotocol Label Switching wikipedia , lookup

IEEE 1355 wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

CAN bus wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

Kademlia wikipedia , lookup

Dijkstra's algorithm wikipedia , lookup

IEEE 802.1aq wikipedia , lookup

Routing wikipedia , lookup

Routing in delay-tolerant networking wikipedia , lookup

Transcript
ECE544: Communication
Networks-II, Spring 2007
D. Raychaudhuri
Lecture 4,5
Includes teaching materials from L. Peterson
Today’s Lecture
• IP basics
• Routing principles
– distance vector (RIP)
– link state (OSPF)
IP Basics
Best Effort Service Model
Global Addressing Scheme
ARP & DHCP
IP Internet
• Concatenation of Networks
H2
H1
Network 1 (Ethernet)
H7
R3
H3
Network 4
(point-to-point)
Network 2 (Ethernet)
R1
R2
H4
Network 3 (FDDI)
• Protocol Stack
H5
H6
H1
H8
TCP
R1
ETH
R2
IP
IP
ETH
R3
IP
FDDI
FDDI
IP
PPP
H8
PPP
TCP
IP
ETH
ETH
Service Model
• Connectionless (datagram-based)
• Best-effort delivery (unreliable service)
–
–
–
–
packets are lost
packets are delivered out of order
duplicate copies of a packet are delivered
packets can be delayed for a long time
• Datagram format
0
4
Version
8
HLen
16
TOS
31
Length
Ident
TTL
19
Flags
Protocol
Offset
Checksum
SourceAddr
DestinationAddr
Options (variable)
Data
Pad
(variable)
Fragmentation and
Reassembly
• Each network has some MTU
• Strategy
–
–
–
–
–
–
–
fragment when necessary (MTU < Datagram)
try to avoid fragmentation at source host
re-fragmentation is possible
fragments are self-contained datagrams
use CS-PDU (not cells) for ATM
delay reassembly until destination host
do not recover from lost fragments
Example
Start of header
Ident= x
0
Offset= 0
Rest of header
1400 data bytes
Start of header
Ident= x
H1
R1
R2
R3
H8
1
Offset= 0
Rest of header
512 data bytes
Start of header
ETH IP (1400)
FDDI IP (1400)
PPP IP (512)
ETH IP (512)
PPP IP (512)
ETH IP (512)
Rest of header
PPP IP (376)
ETH IP (376)
512 data bytes
Ident= x
1 Offset= 512
Start of header
Ident= x
0 Offset= 1024
Rest of header
376 data bytes
Global Addresses
• Properties
– globally unique
– hierarchical: network + host
• Dot Notation
– 10.3.2.4
– 128.96.33.81
– 192.12.69.77
A:
B:
C:
0
7
24
Network
Host
1 0
1 1 0
14
16
Network
Host
21
8
Network
Host
Datagram Forwarding
• Strategy
– every datagram contains destination’s address
– if directly connected to destination network, then
forward to host
– if not directly connected to destination network, then
forward to some router
– forwarding table maps network number into next hop
– each host has a default router
– each router maintains a forwarding table
• Example (R2)
Network Number Next Hop
1
R3
2
R1
3
interface 1
4
interface 0
Address Translation
• Map IP addresses into physical
addresses
– destination host
– next hop router
• Techniques
– encode physical address in host part of IP address
– table-based
• ARP
–
–
–
–
table of IP to physical address bindings
broadcast request if IP address not in table
target machine responds with its physical address
table entries are discarded if not refreshed
ARP Details
• Request Format
–
–
–
–
–
HardwareType: type of physical network (e.g., Ethernet)
ProtocolType: type of higher layer protocol (e.g., IP)
HLEN & PLEN: length of physical and protocol addresses
Operation: request or response
Source/Target-Physical/Protocol addresses
• Notes
–
–
–
–
table entries timeout in about 10 minutes
update table with source when you are the target
update table if already have an entry
do not refresh table entries upon reference
ARP Packet Format
0
8
16
Hardware type = 1
HLen = 48
PLen = 32
31
ProtocolT ype = 0x0800
Operation
SourceHardwareAddr (bytes 0 – 3)
SourceHardwareAddr (bytes 4 – 5) SourceProtocolAddr (bytes 0 – 1)
SourceProtocolAddr (bytes 2 – 3) TargetHardwareAddr (bytes 0 – 1)
TargetHardwareAddr (bytes 2 – 5)
TargetProtocolAddr (bytes 0 – 3)
ATM ARP
• ATM ARP for mapping IP<->ATM addr
– medium is not a broadcast type unlike Ethernet
– requires servers which maintain ARP tables
– concept of multiple “logical IP subnets” (LIS)
10.0.0.2
H1
R
12.0.0.3
10.0.0.1
12.0.0.5
H2
LIS 10
LIS 12
ATM netw ork
Dynamic Host Control
Protocol (DHCP)
• DHCP server per network for IP address
assignment
• Static list of IP<->physical addr or
dynamic binding from common pool
• Host boot-up via well-known address
255.255.255.255
• DHCP “relay agent” can be used to
avoid one server per network
Dynamic Host Control
Protocol (DHCP)
• DHCP packet format (runs over UDP)
Operation
HType
HLen
Hops
Xid
Flag
Secs
ciaddr
yiaddr
siaddr
giaddr
chaddr (16B)
....
Internet Control Message
Protocol (ICMP)
• Echo (ping)
• Redirect (from router to source host)
• Destination unreachable (protocol, port,
or host)
• TTL exceeded (so datagrams don’t cycle
forever)
• Checksum failed
• Reassembly failed
• Cannot fragment
Routing Basics
Routing Problem
• Network as a Graph
A
6
1
3
4
C
2
1
B
9
E
F
1
D
Problem: Find lowest cost path between
two nodes
• Factors
– static: topology
– dynamic: load
Two main approaches
• DV: Distance-vector protocols
• LS: Link state protocols
• Variations of above methods applied to:
– Intra-domain routing (small/med networks)
• RIP, OSPF
– Inter-domain routing (large/global
networks)
• BGP-4
Distance Vector Protocols
• Employed in the early Arpanet
• Distributed next hop computation
– adaptive
• Unit of information exchange
– vector of distances to destinations
• Distributed Bellman-Ford Algorithm
Distance Vector
• Each node maintains a set of triples
– (Destination, Cost, NextHop)
• Exchange updates directly connected
neighbors
– periodically (on the order of several seconds)
– whenever table changes (called triggered update)
• Each update is a list of pairs:
– (Destination, Cost)
• Update local table if receive a “better” route
– smaller cost
– came from next-hop
• Refresh existing routes; delete if they time
out
Distributed Bellman-Ford
Start Conditions:
Each router starts with a vector of (zero) distances
to all directly attached networks
Send step:
Each router advertises its current vector to all
neighboring routers.
Receive step:
Upon receiving vectors from each of its neighbors,
router computes its own distance to each neighbor.
Then, for every network X, router finds that neighbor
who is closer to X than to any other neighbor.
Router updates its cost to X. After doing this
for all X, router goes to send step.
Example - initial distances
1
B
C
Info at
node
7
8
A
1
E
2
2
D
Distance to node
A
B
C
D
E
0
7
~
~
1
C
7
~
0
1
1
0
~
2
8
~
D
~
~
2
0
2
E
1
8
~
2
0
A
B
E receives D’s routes
1
B
C
Info at
node
7
8
A
1
E
2
2
D
Distance to node
A
B
C
D
E
0
7
~
~
1
C
7
~
0
1
1
0
~
2
8
~
D
~
~
2
0
2
E
1
8
~
2
0
A
B
E updates cost to C
1
B
C
Info at
node
7
8
A
1
E
2
2
D
Distance to node
A
B
C
D
E
0
7
~
~
1
C
7
~
0
1
1
0
~
2
8
~
D
~
~
2
0
2
E
1
8
4
2
0
A
B
A receives B’s routes
1
B
C
Info at
node
7
8
A
1
E
2
2
D
Distance to node
A
B
C
D
E
0
7
~
~
1
C
7
~
0
1
1
0
~
2
8
~
D
~
~
2
0
2
E
1
8
4
2
0
A
B
A updates cost to C
1
B
C
Info at
node
7
8
A
1
E
2
2
D
Distance to node
A
B
C
D
E
0
7
8
~
1
C
7
~
0
1
1
0
~
2
8
~
D
~
~
2
0
2
E
1
8
4
2
0
A
B
A receives E’s routes
1
B
C
Info at
node
7
8
A
1
E
2
2
D
Distance to node
A
B
C
D
E
0
7
8
~
1
C
7
~
0
1
1
0
~
2
8
~
D
~
~
2
0
2
E
1
8
4
2
0
A
B
A updates cost to C and D
1
B
C
Info at
node
7
8
A
1
E
2
2
D
Distance to node
A
B
C
D
E
0
7
5
3
1
C
7
~
0
1
1
0
~
2
8
~
D
~
~
2
0
2
E
1
8
4
2
0
A
B
Final distances
1
B
C
Info at
node
7
8
A
1
E
2
2
D
Distance to node
A
B
C
D
E
0
6
5
3
1
C
6
5
0
1
1
0
3
2
5
4
D
3
3
2
0
2
E
1
5
4
2
0
A
B
Final distances after link
failure
1
B
C
Info at
node
7
8
A
1
E
2
2
D
Distance to node
A
B
C
D
E
A
B
0
7
8
10
1
7
0
1
3
8
C
8
1
0
2
9
D
10 3
2
0
11
E
1
9
11
0
8
View from a node
1
B
E’s routing table
Next hop
C
7
8
A
1
E
2
2
D
dest
A
B
D
A
B
1
14
5
C
7
6
8
9
5
4
D
4
11
2
The bouncing effect
dest cost
B
C
1
2
dest cost
1
A
B
1
25
C
dest cost
A
B
2
1
A
C
1
1
C sends routes to B
dest cost
dest cost
B
C
1
2
A
B
1
25
C
dest cost
A
B
2
1
A
C
~
1
B updates distance to A
dest cost
dest cost
B
C
1
2
A
B
1
25
C
dest cost
A
B
2
1
A
C
3
1
B sends routes to C
dest cost
dest cost
B
C
1
2
A
B
1
25
C
dest cost
A
B
4
1
A
C
3
1
C sends routes to B
dest cost
dest cost
B
C
1
2
A
B
1
25
C
dest cost
A
B
4
1
A
C
5
1
How are these loops caused?
• Observation 1:
– B’s metric increases
• Observation 2:
– C picks B as next hop to A
– But, the implicit path from C to A includes
itself!
Avoiding the Bouncing
Effect
• Select loop-free paths
• One way of doing this:
– each route advertisement carries entire
path
– if a router sees itself in path, it rejects the
route
• BGP does it this way
– Space proportional to diameter
Cheng, Riley et al
Computing Implicit Paths
• To reduce the space requirements
– propagate for each destination not only the
cost but also its predecessor
– can recursively compute the path
– space requirements independent of
diameterv
u
v
x
y
z
w
u
u
w
w
z
z
y
y
z
Distance Vector in Practice
• RIP and RIP2
– uses split-horizon/poison reverse
• BGP/IDRP
– propagates entire path
– path also used for effecting policies
Link State Routing
• Each node assumed to know state of
links to its neighbors
• Step 1: Each node broadcasts its state
to all other nodes
• Step 2: Each node locally computes
shortest paths to all other nodes from
global state
Link State Routing: Building
blocks
• Reliable broadcast mechanism
– flooding
– sequence number issues
• Shortest path tree (SPT) algorithm
– Dijkstra’s SPT algorithm
Link state packets (LSPs)
• Periodically, each node creates a Link
state packet containing:
– Node ID
– List of neighbors and link cost
– Sequence number
– Time to live (TTL)
• Node outputs LSP on all its links
Reliable flooding
• When node i receives LSP from node j:
– If LSP is the most recent LSP from j that i
has seen so far, i saves it in database and
forwards a copy on all links except link LSP
was received on.
– Otherwise, discard LSP.
Sequence number space
issues
• Problem: sequence number may wrap
around
• Solution: treat space as circular, continue
after wrap around:
– A is less than B if
• A<B and B-A < N/2, or
• A>B and A-B > N/2
B
A
0 N
Wrap around
Problem: Router Failure
• A failed router and comes up but does
not remember the last sequence number
it used before it crashed
• New LSPs may be ignored if they have
lower sequence number
One solution: LSP Aging
• Nodes periodically decrement age (TTL)
of stored LSPs
• LSPs expire when TTL reaches 0
– LSP is re-flooded once TTL = 0
• Rebooted router waits until all LSPs
have expired
• Trade-off between frequency of LSPs
and router wait after reboot
OSPF Sequencing and Aging
•
•
•
•
32-bit sequence number field, does not wrap
LSP’s compared on basis of sequence number
LSP’s purged after about an hour
Synchronized expiration of LSPs
– expired LSP reflooded with age zero
• On startup, router need not wait
– can start with lowest sequence number
– will be informed if its own LSP is in network
SPT algorithm (Dijkstra)
• SPT = {a}
• for all nodes v
– if v adjacent to a then D(v) = cost (a, v)
– else D(v) = infinity
• Loop
– find w not in SPT, where D(w) is min
– add w in SPT
– for all v adjacent to w and not in SPT
• D(v) = min (D(v), D(w) + C(w, v))
• until all nodes are in SPT
Link State Algorithm
Flooding:
1) Periodically distribute link-state
advertisement (LSA) to neighbors
- LSA contains delays to each
neighbor
2) Install received LSA in LS database
3) Re-distribute LSA to all neighbors
Path Computation
1) Use Dijkstra’s shortest path algorithm
to compute distances to all destinations
2) Install <destination, nexthop> pair in
forwarding table
Example
5
B
2
A
2
1
D
B
step
0
SPT
A
3
1
C
3
1
C
E
D
5
F
2
E
F
D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)
2, A
5, A
1, A
~
~
Example
5
B
2
A
2
1
D
B
step
0
1
SPT
A
AD
3
1
C
3
1
C
E
D
5
F
2
E
F
D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)
2, A
5, A
1, A
~
~
2, A
4, D
2, D
~
Example
5
B
2
A
2
1
D
B
step
0
1
2
SPT
A
AD
ADE
3
1
C
3
1
C
E
D
5
F
2
E
F
D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)
2, A
5, A
1, A
~
~
2, A
4, D
2, D
~
2, A
3, E
4, E
Example
5
B
2
A
2
1
D
B
step
0
1
2
3
SPT
A
AD
ADE
ADEB
3
1
C
3
1
C
E
D
5
F
2
E
F
D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)
2, A
5, A
1, A
~
~
2, A
4, D
2, D
~
2, A
3, E
4, E
3, E
4, E
Example
5
B
2
A
2
1
D
B
step
0
1
2
3
4
SPT
A
AD
ADE
ADEB
ADEBC
3
1
C
3
1
C
E
D
5
F
2
E
F
D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)
2, A
5, A
1, A
~
~
2, A
4, D
2, D
~
2, A
3, E
4, E
3, E
4, E
4, E
Example
5
B
2
A
2
1
D
B
step
0
1
2
3
4
5
SPT
A
AD
ADE
ADEB
ADEBC
ADEBCF
3
1
C
3
1
C
E
D
5
F
2
E
F
D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)
2, A
5, A
1, A
~
~
2, A
4, D
2, D
~
2, A
3, E
4, E
3, E
4, E
4, E
Link State Characteristics
• With consistent LSDBs, all nodes compute
consistent loop-free paths
• Limited by Dijkstra computation overhead,
space requirements
B
• Can still have transient loops
1
Packet from C->A
may loop around BDC
A
1
3
5
C
2
D
Link State in Practice
• OSPF (Open Shortest Path First
Protocol)
– most commonly used routing protocol in
the Internet
– support for authentication, addl hierarchy,
load balancing
OSPF Packets
LS Age
Options
Type=1
Link state ID
Advertising router
LS sequence number
LS checksum
0
Flags
Length
0
Number of links
Link ID
Link data
Link type
Num_TOS
Metric
Optional TOS information
More links
Today’s Homework
• Peterson & Davie, Chap 4
-4.12
-4.13
-4.16
-4.21
Download and browse RIP and OSPF RFC’s
Due on Fri (2/23)
61