Download THE NETWORK LAYER 5.2 ROUTING ALGORITHMS

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Zigbee wikipedia , lookup

CAN bus wikipedia , lookup

AppleTalk wikipedia , lookup

Asynchronous Transfer Mode wikipedia , lookup

Net bias wikipedia , lookup

Distributed firewall wikipedia , lookup

IEEE 1355 wikipedia , lookup

Deep packet inspection wikipedia , lookup

Network tap wikipedia , lookup

Peering wikipedia , lookup

IEEE 802.1aq wikipedia , lookup

Piggybacking (Internet access) wikipedia , lookup

Multiprotocol Label Switching wikipedia , lookup

Internet protocol suite wikipedia , lookup

Computer network wikipedia , lookup

Airborne Networking wikipedia , lookup

List of wireless community networks by region wikipedia , lookup

Zero-configuration networking wikipedia , lookup

Wake-on-LAN wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

Routing wikipedia , lookup

Routing in delay-tolerant networking wikipedia , lookup

Transcript
5 THE NETWORK LAYER
5.1 NETWORK LAYER DESIGN ISSUES
5.2 ROUTING ALGORITHMS
5.4 INTERNETWORKING
5.5 THE NETWORK LAYER IN THE INTERNET
Stainov - DataCom
MET CS TC535
1
5 THE NETWORK LAYER
5.1 NETWORK LAYER DESIGN ISSUES
Importance: It represents the boundary to the subnet (i.e. to the network
carrier)  it must be especially well defined.
Main goals:



1.
2.
The services should be independent of the subnet
The transport layer should be shielded from the number, type, and topology of the
subnet
The network addresses should be uniform.
Two camps:
Internet community - the subnet should move independent datagrams and
nothing else (no flow control, packet ordering and error control).
Telephone companies - the subnet should provide reliable connection-oriented
service, with QoS (Quality of Service) negotiation, packet ordering, and flow
control.
Stainov - DataCom
MET CS TC535
2
THE NETWORK LAYER
5.1 NETWORK LAYER DESIGN ISSUES - Internal Organization
1.
Virtual circuits (VC) - connection setup (choosing of the route to the
destination), forwarding packets over the exactly that route (the router
maintains a table with the unique virtual circuit # ), and connection
release (termination of the VC).
2.
Datagrams - no routers are working in advance, even if the service is
connection oriented. Each packet is sent independently from the
previous ones and routed over a different route. The routers do not
maintain virtual circuit #s. Each packet is carrying the full destination
address. Establishment of connections is done by the end stations, and
does not require any special work from the routers.
Stainov - DataCom
MET CS TC535
3
THE NETWORK LAYER
Comparison of VC
and Datagram Subnets
Stainov - DataCom
MET CS TC535
4
THE NETWORK LAYER
Comparison of VC and Datagram Subnets
 All variations of connectionless, or connection-oriented, over
VC, or over datagrams, are possible - for example IP
(connectionless) over ATM (VC) subnet.
Stainov - DataCom
MET CS TC535
5
THE NETWORK LAYER
5.2 ROUTING ALGORITHMS
Common Requirements:






Correctness - no deadlocks, livelocks, unreachable states
Simplicity - fast handling of packets, less failures
Robustness - dealing with failures, changes of the topology and of the traffic.
Stability - the algorithm should congregate to equilibrium
Fairness - no starvation, load balancing
Optimality - short packet delay, max. throughput, number of hops
1. Nonadaptive algorithms - do not base the routing decisions on
measurements. The routing is in most cases static (computed in advance),
off-line and downloaded to the routers.
2. Adaptive algorithms - change their routing algorithms (continuous,
periodic, occasionally) to reflect changes in the topology, and some times in
the traffic. The information source can be local, nodes along the route, or
all nodes.
Stainov - DataCom
MET CS TC535
6
THE NETWORK LAYER
5.2 ROUTING ALGORITHMS
 The set of optimal routes from all sources to a given destination forms a
sink tree.
 The goal of the routing algorithms is to discover the sink trees for all
routers.
Stainov - DataCom
MET CS TC535
7
THE NETWORK LAYER
5.2 ROUTING ALGORITHMS - Static
Shortest Path Routing - A frequently used metric is the number of hops. Each
router examines each of the nodes adjacent to it, calculates the new
distance sum, and if it is less than the label on that node, we have the
shortest path, so the node is relabeled.
Stainov - DataCom
MET CS TC535
8
THE NETWORK LAYER
5.2 ROUTING ALGORITHMS - adaptive
Distance Vector Routing (Bellman-Ford, Ford-Fulkenson). It was used in early
versions of ARPANET and in Internet (RIP), DECnet,, AppleTalk and Cisco.
 Each router maintains a table (i.e. a vector) indexed by, and containing one entry
for each router in the subnet. The entry contains the preferred outgoing line for
this destination and an estimate giving the best known distance to that
destination (# of hops, time delay, etc.).
 Once every T msec each router sends to (and receives from) each neighbor a
list of estimated distance to each destination. The router recalculates the
distances.
Stainov - DataCom
MET CS TC535
9
THE NETWORK LAYER
5.2 ROUTING ALGORITHMS - adaptive
Count-to-Infinity Problem - the distance vector routing propagates the good
news, but leisurely to the bad news.
Stainov - DataCom
MET CS TC535
10
THE NETWORK LAYER
5.2 ROUTING ALGORITHMS - adaptive
Link State Routing (Second Generation in ARPANET) - the first generation did not
consider the speed, but only the queue length, and took too long to converge.
1. Discover its neighbors and learn their network addresses.
2. Measure the delay or cost to each of its neighbors (e.g. by ECHO packets)
 measure RTT/2 and calculate only the queue delay (to avoid load oscillation) or
both, the queue delay and the communication load transformed to "link utilization".
3. Construct a packet telling all it has just learned, and send the packet to all routers.
4. Compute the shortest path to every other router.
 The complete topology and all delays are experimentally measured and distributed
to every router.
Stainov - DataCom
MET CS TC535
11
THE NETWORK LAYER
5.4 INTERNETWORKING
 Repeater, Bridge, Muliprotocol Router, Transport Gateways,
Application Gateways
Stainov - DataCom
MET CS TC535
12
THE NETWORK LAYER
5.4 INTERNETWORKING
 How networks differ?
Stainov - DataCom
MET CS TC535
13
THE NETWORK LAYER
5.4 INTERNETWORKING
 Concatenated Virtual Circuits
Stainov - DataCom
MET CS TC535
14
THE NETWORK LAYER
5.4 INTERNETWORKING
 Connectionless Internetworking
Stainov - DataCom
MET CS TC535
15
THE NETWORK LAYER
5.4 INTERNETWORKING
 Tunneling
Stainov - DataCom
MET CS TC535
16
THE NETWORK LAYER
5.4 INTERNETWORKING
 Fragmentation
See Applet
Stainov - DataCom
MET CS TC535
17
THE NETWORK LAYER
5.4 INTERNETWORKING - Firewalls
Stainov - DataCom
MET CS TC535
18
Internetworking
The Internet layer - the IP Protocol
4-Bit
4-Bit
8-Bit
Version
4
Header
length 5
identification
live (TTL)
type of service TOS
Time to
16-Bit
total length in bytes
flags
protocol type
source IP address
destination IP address
options
fragment offset
header checksum
(if any)
The Type-Of-Service (TOS) is for a normal service 0.
The total length in bytes can be maximal 65535 bytes.
The identification uniquely identifies each datagram (incremented by the sender). It is
used with flags and fragment offset for fragmentation and reassembly.
The TTL (Time-To-Live) sets a upper limit on the number of hops (rourters).
The protocol type is UDP, TCP, but also ICMP and IGMP.
The header checksum is calculated over the IP header only.
Stainov - DataCom
MET CS TC535
19
Internetworking
IP addresses
0.0.0.0-127.255.255.255
Class A
0
7 Bits
Netz-ID
128.0.0.0-191.255.255.255
Class B
1 0
192.0.0.0-223.255.255.255
Class C
1 1 0
224.0.0.0-239.255.255.255
Class D
1 1 1 0
24 Bits
Host-ID
14 Bits
Net-ID
16 Bits
Host-ID
21 Bits
Net-ID
28 Bits
Multicast group ID
240.0.0.0-247.255.255.255
Class E
Stainov - DataCom
8 Bits
Host-ID
27 Bits
(Reserved)
1 1 1 1 0
MET CS TC535
20
5.5 INTERNET: Subnets
a. The classic (and externally transparent) IP address:
Net-ID
Subnet-ID
b. Internal structuring of the IP address:
Net-ID
Host-ID
Host-ID
 For example are the first 8 bits (= 1 byte) the host ID. The 3 high order bits
can be used as subnet ID. It means, 28 = 256 host addresses are divided
into 23 = 8 subnets with 25 = 32 host addresses each.
 How many bits are to be used for the subnet ID is specified by the subnet
mask.
Example: The subnet mask 255.255.255.224, of a C class address means,
that the three high order bits in the first byte are used for subnet IDs:
– 111111112 . 111111112 . 111111112 . 111000002
Stainov - DataCom
MET CS TC535
21
Internetworking
IP Subnets Example
Expl.
IP address
subnet mask
Host-ID
1
123.174.26.178
2
193.174.24.180 255.255.255.240
3
193.174.24.155 255.255.255.252
4
123.174.132.5
255.255.255.0
178
123.174.26.0/24
4 193.174.24.176/28
255.255.240.0
11110000 = 240 (Mask)
10110100 = 180 (Host)
10110000 = 176 (Subnet)
Stainov - DataCom
Subnet Address
11111100 = 252 (Mask)
10011011 = 155 (Host)
10011000 = 152 (Subnet)
MET CS TC535
22
Internetworking
IP Subnets - Example
Subnet Addr: 193.174.24.176
Subnet mask:255.255.255.240
Class C net ID: 193.174.24.0
Mask: 255.255.255.0
Internet
PC
Router
193.174.24.5
PC
193.174.22.60
0
193.174.24.3
193.174.24. 180
Subnet:193.174.24.184
Mask: 255.255.255.252
Router
193.174.24.177
Sun
PC
193.174.24.7
193.174.24. 184
Printer
193.174.24.10
PC
193.174.24.8
Stainov - DataCom
193.174.24. 186
Modem
Modem
193.174.24.185
4
MET CS TC535
23
Internetworking
Net-ID
Host-ID
00000...0 00000...0 00000...0
xxxxx...x -
127
xxxxx...x -
destination address during determining its own IP
address in LAN (used by BOOTP)
destination address during determining other host
address in LAN (used by BOOTP)
Loopback-address - communication inside a host
11111...1 11111...1 -
limited broadcast (never forwarded by a router)
xxxxx...x
net-directed broadcast to a net ID
11111...1 -
Net-ID Subnet-ID Host-ID
xxxxx...x xxxxx...x 11111...1
- subnet-directed broadcast to a subnet, net ID
xxxxx...x
- all-subnet-directed broadcast to a net ID
11111...1 11111...1
Stainov - DataCom
MET CS TC535
24
5.5 INTERNET: ARP
The Address Resolution Protocol (Mapping of IP into MAC addresses)
 Every Ethernet board has a 48-bit Ethernet address
Algorithm:
If destination 128.197.102.51 is link-local
then broadcast “who has 128.197.102.51”
get his MAC address
cache the MAC address into the ARP table
Hint: Even Windows maintains an APR table  go to Command Prompt and start:
C:\WINNT\Profiles\rstainov\Desktop>arp -a
Interface: 128.197.101.75 on Interface 2
Internet Address
Physical Address
Type
128.197.101.32
00-90-27-9a-a4-f7
dynamic
Stainov - DataCom
MET CS TC535
25
5.5 INTERNET
IP-Routing Principle:
If destination address local, then deliver datagram,
else forward datagram to default-Router
Basis: Routing table of the IP layer; each entry contains:
 destination address: network or host address (specified by the flag G or H)
 IP address of the next-hop router (Flag G) or address of directly connected
network
 flags for the route (if set): G - routing to a gateway (not to an interface), H the destination is a host address (not a network address), D - created by
redirect, M - modified by redirect, U - route is up.
Specification of the network interfaces to be used for transmission (ARP
is used).
Stainov - DataCom
MET CS TC535
26
Internetworking
Hosts and routers
Hosts (end systems) typically perform no routing
start packets on their way
send packets to nearest (default) router
Q: how do hosts learn identity of nearby router:
A1: IP address of router hard-coded into file (see /etc/networks on many
UNIX systems)
A2: router discovery: RFC 1256
• router periodically broadcasts its existence to attached hosts
• host (on startup) broadcasts query (who is my router) on attached links/LANs
Stainov - DataCom
MET CS TC535
27
Internetworking
IP Routing Example
193.174.26.5
PC
Internet
destination
127.0.0.1
default
193.174.24.27
PC-4
Router1
193.174.26.3
Router2 193.174.26. 180
routing to
flags
127.0.0.1
H
193.174.26.178
G
193.174.26. 171
193.174.26. 189
193.174.26.7
Modem
193.174.26.178
Sun
193.174.26.10
PC
destination
127.0.0.1
default
routing to
127.0.0.1
193.174.26.5
flags
H
G
PC
Modem
193.174.26.190
Stainov - DataCom
MET CS TC535
28
Internetworking
IP Routing Example
193.174.26.5
PC
Internet
destination
127.0.0.1
default
193.174.24.27
PC-4
Router1
193.174.26.3
routing to
flags
127.0.0.1
H
193.174.26.178
G
193.174.26. 171
PC
Router2 193.174.26. 180
193.174.26.7
Sun
193.174.26.10
Stainov - DataCom
Modem
193.174.26.178
destination
routing to
flags
127.0.0.1
127.0.0.1
H
default
193.174.26.5
G
193.174.26.160/27 193.174.26.178
MET CS TC535
11100000 = 224 mask
PC
Modem
10100000 = 160 subnet ID
10110100 = 180 destin.
193.174.26.190
10101011 = 171 destin.
29
Internetworking
IP Routing Example
193.174.26.5
PC
Internet
destination
127.0.0.1
default
193.174.24.27
PC-4
Router1
193.174.26.3
Router2 193.174.26. 180
routing to
flags
127.0.0.1
H
193.174.26.178
G
193.174.26. 171
193.174.26. 189
193.174.26.7
Sun
193.174.26.10
Stainov - DataCom
PC
Modem
193.174.26.178
destination
routing to
flags
127.0.0.1
127.0.0.1
H
default
193.174.26.5
G
193.174.26.160/27 193.174.26.178
193.174.26.190
193.174.26.171 HG
MET CS TC535
PC
Modem
193.174.26.190
30
Internetworking
Using the Windows Calculator to convert between binary and decimal
Stainov - DataCom
MET CS TC535
31
Internetworking
Practical exercise: Even Windows maintains a routing table
 go to Command Prompt and start:
C:\WINNT\Profiles\rstainov\Desktop>route Print
==========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 01 02 35 5e fa ...... 3Com EtherLink PCI
==========================================================================
Active Routes:
Network Destination
Netmask
Gateway
Interface Metric
0.0.0.0
0.0.0.0
128.197.101.1 128.197.101.75
1
127.0.0.0
255.0.0.0
127.0.0.1
127.0.0.1
1
128.197.101.0
255.255.255.0
128.197.101.75 128.197.101.75
1
128.197.101.75 255.255.255.255
127.0.0.1
127.0.0.1
1
128.197.255.255 255.255.255.255
128.197.101.75 128.197.101.75
1
224.0.0.0
224.0.0.0
128.197.101.75 128.197.101.75
1
255.255.255.255 255.255.255.255
128.197.101.75 128.197.101.75
1
===========================================================================
Stainov - DataCom
MET CS TC535
32
Internetworking
Hierarchical Routing
problem: as size of network grows, routing table, complexity grows
 millions of nodes (hosts, routers) in Internet
solution: hierarchically aggregate nodes into "regions" (domains)
 node have full knowledge of routes, topological structure within region
 one (or more) nodes in region responsible for routing to the outside
Stainov - DataCom
MET CS TC535
33
Internetworking
Hierarchical Routing
three domains: A, B, C
A.a, A.b A.c run interdomain
routing protocol (BGP)
A.c, B.a, B.b, C.a run
intradomain routing protocol
among themselves (OSPF)
intradomain routing: within domain
interdomain routing: between domains
Stainov - DataCom
MET CS TC535
34
Internetworking
Interior Gateway Routing Protocol (Open Shortest Path First)
OSPF for intradomain routing within an autonomous system (AS)
1. Uses link state algorithm to determine routes
• each outgoing link (interface) assigned dimensionless cost
• load balancing: with several equal-cost-paths to destination, will distribute load
across both paths
2. Adding some security
3. Support for routers connected to a tunnel, over LAN, WAN, and point-to-point
lines
Stainov - DataCom
MET CS TC535
35
Internetworking - OSPF
4. Support for hierarchy:
• autonomous system (connected by homogeneous routers) divided into "areas"
• one area designated "backbone"
area border routers in backbone route between areas
other routers in backbone also
• AS boundary router talks to outside world
area routers: red
boundary router: blue
intra-area routing:
source area -> backbone -> destination area
Stainov - DataCom
MET CS TC535
36
5.5 INTERNET: OSPF
5. Abstracts the collection of actual networks, routers, and lines into a
directed graph in which each arc is assigned a cost (distance), and then
computes the shortest path (avoids Count-to-Infinity Problem).
Stainov - DataCom
MET CS TC535
37
Internetworking
Interdomain Internet Routing: BGP (Border Gateway Protocol RFC 1267,
1268)
• routing between nodes in different autonomous systems
(i.e., routing between networks, exterior router protocol)
• uses a distance verctor approach
Policy-Based Routing
• rather than costs to destinations, BGP routers exchange full path information
(networks crossed) to destination
• router can decide on policy basis which route to take
e.g. "traffic from my AS should not cross AS's a,b,c,d"
BGP implementation
• Implemented as a daemon (user-level process)
• communicates with other BGP routers using TCP
Stainov - DataCom
MET CS TC535
38
Internetworking
Practical exercise: Even Windows allows to trace a routing path
 go to Command Prompt and start:
C:\WINNT\Profiles\rstainov\Desktop>tracert www.mit.edu
Tracing route to DANDELION-PATCH.MIT.EDU [18.181.0.31]
over a maximum of 30 hops:
1
2
3
4
5
6
7
<10
<10
<10
<10
<10
<10
<10
ms
ms
ms
ms
ms
ms
ms
10
<10
<10
<10
<10
<10
<10
ms
ms
ms
ms
ms
ms
ms
<10
<10
<10
<10
<10
<10
<10
ms
ms
ms
ms
ms
ms
ms
COMM808-0201NET-GW.BU.EDU [128.197.101.1]
buic025-bbonenet-gw.bu.edu [128.197.5.57]
crc-ext-gw.bu.edu [128.197.254.60]
192.5.89.13
192.5.89.10
NW12-RTR-FDDI.MIT.EDU [18.168.0.16]
DANDELION-PATCH.MIT.EDU [18.181.0.31]
Trace complete.
Stainov - DataCom
MET CS TC535
39
Internetworking
ICMP
4-Bit
4-Bit
8-Bit
version
header length
identification
live (TTL)
type of service TOS
Time to
type
16-Bit
flags
protocol type
source IP address
destination IP address
code
other
Stainov - DataCom
MET CS TC535
total length in bytes
fragment offset
header checksum
checksum
control information
40
Internetworking
ICMP
Type
Description of the ICMP message
0
Information message: Ping-reply.
3
Error message: destination unreachable.
The field code specifies the reason: 0 = network unreachable, 1= host unreachable, 2= protocol
unreachable, 3 = port unreachable, 4 = fragmentation needed but don’t-fragment bit is set, 5 = sourcerouting failed, 6 = destination network unknown, 7 = destination host unknown, 8 = source host isolated, 9
= destination network administratively prohibited, 10 = destination host administratively prohibited, 11 =
network unreachable for TOS (Type of Service), 12 = host unreachable for TOS, 13 = communication
administratively prohibited by filtering, etc.
4
Error message: source quench
5
Error message: redirect (telling the sender to change its routing table).
The field code specifies: 0 = redirect for network-ID, 1 = redirect for host-ID, 2 = redirect for TOS
and network ID, 3 = redirect for TOS and host ID
8
Information message: Echo-request (Ping- request).
Stainov - DataCom
MET CS TC535
41
Internetworking - ICMP
ICMP
Type
Description of the ICMP message
9
Information message: Router advertisement as replay of type 10 router solicitation
or for periodically broadcasting of routing tables.
10
Information message: Router solicitation after booting (one or more routers respond with a router advertisement message).
11
Error message: time exceeded (TTL 0).
The field code specifies: 0= TTL equals 0 during transit, 1= equals 0 during reassembly.
12
Error message: parameter problem.
The field code specifies: 0= IP header bad, 1= required option missing.
13
Information message: time stamp request (UTC time in milliseconds).
14
Information message: time stamp replay (UTC time in milliseconds).
Stainov - DataCom
MET CS TC535
42