Lecture 10

advertisement
CS 164: Computer Networks
Slide Set 10 -- Internetworking
(Continued)
Routing
In this set ....
• How are link-state algorithms
implemented in practice ?
• OSPF
• Mobile IP
--------------------------------• Section 4.3 - Global Internet -Subnetting, Classless Inter-domain
routing and BGP
Implementing link state routing
• Each node maintains two lists
–
The tentative list and the confirmed list.
• Each list contains entries of the type
{Destination, Cost, Next Hop}.
• The two lists are continuously updated as new
nodes are added to the shortest path tree
(as in the Dijkstra’s algorithm).
The Algorithm
• Step 1: Initialize confirmed list with myself --> cost = 0;
• Step 2: For the node just added to the confirmed list in the
previous step, call it node Next, select its LSP.
• Step 3: For each neighbor of Next (Neighbor), calculate cost
to reach this neighbor
–
Cost = Cost from me to Next + Cost of Next to Neighbor.
• (a) If Neighbor is currently on neither the Tentative or the
Confirmed list, add {Neighbor, Cost NextHop} to Tentative list. Note
-- here NextHop is the one that is used to reach Next.
• (b) If Neighbor is on the Tentative list and the cost seen is < the
cost currently listed for Neighbor, replace the entry with {Neighbor,
Cost, NextHop}. Else, do nothing.
• Step 4: If Tentative list is empty, stop. Else, pick entry
from the Tentative list with lowest cost and move it to
Confirmed list. Return to Step 2.
Our Example
We look at D.
B
5
A
3
10
C
Step
Confirmed
Tentative
5
(D,0,-)
(C,2,C)
(B,5, C)
(A,12,C)
6
(D,0,-)
(C,2,C)
(B,5, C)
(A, 10, C)
7
(D,0,-)
(C,2,C)
(B,5,C)
(A,10,C)
11
2
D
Step
Confirmed
Tentative
1
(D, 0, -)
2
(D,0,-)
(C, 2, C)
(B, 11, B)
3
(D,0,-)
(C,2,C)
(B,11,B)
4
(D,0,-)
(C,2,C)
(B,5,C)
(A,12,C)
Computational Complexity
• There are n nodes.
• 1st iteration, search through n nodes to
determine “w”, the one with the minimum cost.
• 2nd iteration, search through (n-1) nodes and
so on.
• Total = n(n+1)/2 ≈ O(n2)
• One could use sorting methods (heapsort etc.) could reduce complexity to O(nlogn).
Comparing Distance Vector and
Link State
• Message complexity in link state is O(nE) since each
node sends an update -- possibly needed for each link.
• With distance vector it depends on the rate of change
of link costs etc.
• Convergence time in link state = O(nlogn); In distance
vector depends on relative path costs -- count to
infinity problem.
• However, link state suffers from oscillations.
• Link state is stable since computation done at each node
-- distance vector could lead to problems if there are
malfunctioning routers.
Open Shortest Path First (OSPF)
• Open standard -- non-proprietary
• Essentially the link-state approach --however features
are added.
• Authentication of routing messages -- prevent
misconfigurations-- only sys admin can configure.
• Add a hierarchy -- OSPF runs within a domain or
administrative region. The region is sub-divided into
areas.
• Router does not need to know how to get to every
network within the domain -- enough to know how to get
to right area.
• Load balancing - if two paths have same cost, subdivide
traffic among paths.
OSPF Header
0
8
Version
16
Type
31
Message length
SourceAddr
AreaId
Checksum
Authentication type
• Nuggets:
• Checksum -- same
as IP (does not
include authentication
part).
Authentication
Authentication can be none, password based or
crypto checksum (hash).
Types -- HELLO packet, Request, Send, ACK
receipt of link state messages.
Header is common for all OSPF messages.
Link State Advertisements
LS Age
Options
Link-state ID
Advertising router
Type=1
LS sequence number
LS checksum
Length
0 Flags
0
Number of links
Link ID
Link data
Link type
Num_TOS
Metric
Optional TOS information
More links
Other info on LSA,
look up the book.
• Router uses this to advertise
directly connected nets and
costs of links to other routers.
• Link state age -- similar to
TTL (not included in
checksum).
• Unique IP address for router - if it has more than one, pick
lowest.
• TOS -- different routes for
different IP packets -- not
widely used.
Metrics
• How does one assign link costs ?
– Costs distinguish between different physical links.
– dynamically, one may consider the load -- difficult.
• Versions of ARPANET tried to address this.
• One way -- count the number of queued packets -does not take bandwidth or latency into
consideration.
• Another way -- latency on the link.
– Each incoming packet time-stamped. There is an
associated transmission time and propagation latency -static for the link.
• Delay = (Depart time - Arrival time) + transmission time +
prop. latency.
Instability
• Due to improper choice of metrics,
instability and oscillations could
occur.
• Many of links remain idle while
others are heavily loaded.
Oscillations in link state
2)
1)
1
A
0
2+e
1+e
D
A
D
B
B
1+e
e
C
0
3)
A
D
1
C
2+e
B
C
1+e
1
Avoiding oscillations
Smoothing variations of the metric in time.
• Choose weights that do not change often
-- averages.
• Impose hard limit on how much metric
could change from one measurement to
next.
• Do not change paths with high
frequencies even if link weights do
change often.
Mobility
• So far, with IP, implicit assumption that there is no
mobility.
• Addresses -- network part, host part -- so routers
determine how to get to correct network.
• If nodes move network may change
• How do we cope with this ?
• Should there be a change in IP addresses with mobility ?
If so how ?
• Should we use DHCP to assign new addresses ? May be
adequate in some cases.
• Within the same network no problems -- no need to
change IP addresses -- link layer delivery.
Mobile IP
• Problem occurs when user switches between
networks.
• Applications may keep running and so the
remote end needs to know how to deliver
packets to the mobile host.
• Mobile IP
– Need for transparency for the user
– No need to change software of majority of
routers on the Internet.
– Background compatible
The Home Agent
• However, it doesn’t come for free!
• Some routers need new functionalities.
• Home Agent: Permanent IP address
somewhere that the mobile calls home.
– A router located on the home network of the
mobile.
– When a node needs to reach the mobile, sends the
messages to the home address.
The Foreign Agent
• The Foreign Agent: Router located in new
network to which the mobile attaches itself
when it is away from the home network.
• Mobile registers with foreign agent and
provides the address of its home agent.
• Foreign agent contacts the home agent and
provides a “care-of-address” --> IP address
of the foreign agent.
Note ....
• The home and foreign agents have
to announce their presence -- they
are specialized routers.
• The attaching mobile may solicit an
advertisement by sending a request.
Proxy ARP
• When the mobile is away, the home agent has to pick
up packets meant for the mobile.
• With Proxy ARP, the home agent (HA) inserts IP
address of mobile node instead of its own!
– It provides its own hardware address though !
• To invalidate old ARP entries in possible caches, as
soon as mobile is known to have registered with a FA
(foreign agent), HA issues an ARP.
–
Note that this is not in response to an ARP query and
hence is called “the gratuitous ARP”.
Tunnelling
• Once home agent gets the IP datagram, it
tunnels the packet to the mobile.
• To recollect, by tunneling, it encapsulates the
IP packet within another IP packet destined for
the foreign agent.
• The FA strips the IP wrapper, recognizes that
the packet was meant for a registered mobile
nad uses its own ARP entry to send the frame
to the hardware address of the mobile.
Other details
• Mobile has to dynamically acquire an IP
address in the foreign network.
• Packets in the other direction are
simple, use the source’s IP address (a
fixed location).
• If the source was a mobile, similar
procedures could be used.
Route optimization
• Previous approach sub-optimal.
Fixed --> home --> foreign -> mobile. This is called the
triangle routing problem.
• HA will let the sending node
know the care-of-address of
mobile node.
• Sending node creates tunnel to
mobile.
HA
S
FA
Implementation and Other issues
• HA sends a “binding update” to the source in addition to
forwarding initial packet.
• Source creates an entry in a “binding cache” which includes
mappings of mobile node addresses to care-of addresses.
• Entries could become stale -- mobile chooses a new FA -old FA would issue a binding warning.
• Issue : Can lead to security problems.
• Mobile IP not widely deployed -- still being researched -Mobile networking in general an upcoming research area.
Routing so far...
• Somewhat scalable.
• Routers need not know of all the hosts
that are connected to the Internet.
• Enough to know of networks.
• However, in reality, millions of nodes -distance vector takes for ever to
converge, link state too expensive -both don’t scale that much!
Revisiting the Internet
NSFNET backbone
Stanford
ISU
BARRNET
regional
Berkeley
Westnet
regional
PARC
■■■
UNM
NCAR
MidNet
regional
UNL
KU
UA
• Called the customer provider view -- we have enduser sites, regional service provider networks etc.
•Each unit is independent as far as administration goes
-- what routing to use, how to assign metrics etc. Each
unit is called an Autonomous System or AS.
Intra-AS routing
• The routing schemes that we have
seen so far are used for routing
within ASes.
• There are gateway routers that
deliver packets to outside the AS.
– Internal nodes know which ASes they
can reach, but not the intricacies.
Scalability and Addressing
• IP address space is limited -- too many networks.
• In addition, the more the networks, the more would
be the entries in each routing table.
• We need to take care so that address space is not
used up.
• Note -- 221 Class C addresses but only 214 Class B.
– A Class C network can have at most 255 hosts,
what if we had 257 ? Should we allocate one of
the fewer Class B addresses?
Address Efficiency
• In our example, we had 256 hosts. For this, Class
C is insufficient.
• Class B can accommodate 65535 hosts
(approximately 64 K).
• If we assign a Class B address to this 256 node
network, we are wasting the address space -- the
address efficiency would be 256/65535 = 0.39 %.
• If we construct a separate Class C network with 2
hosts, we don’t do much better -- efficiency
becomes 2/255 = 0.78 %.
Sub-Netting
• The solution is to assign a single IP network
number to a set of “several” physical networks.
• Each physical network is called a subnetwork or
subnet for short.
• The requirement is that the subnets have to be
close to each other --> they need to look like
a single network when considered together.
• Each router can have an entry to this
“aggregation” of networks.
• Example -- a campus network can be divided
into sub-networks.
The Subnet Mask and
Subnet Number
• The mechanism by which a single network
number can be shared among multiple
networks involves configuring all the
nodes on each subnet with a “subnet
mask”.
• This enables us to introduce what we call
a subnet number -- all hosts on the
same subnet will have the same subnet
number.
Representation
Netw ork number
Host number
Class B address
111111111111111111111111
00000000
Subnet mask (255.255.255.0)
Netw ork number
Subnet ID
Host ID
• In this example,
we subdivide the
network part into
two sub-parts.
•The first is the
network number
and the second a
Subnet ID.
Subnetted address
Note: With this, the Class B can be divided into
several sub-networks.
An Example
• We have the Class B network
subdivided into three subnets.
• Each subnet has a sub-net
mask.
Subnet mask: 255.255.255.128
Subnet number: 128.96.34.0
128.96.34.15
– The mask determines how
many bits belong to the
subnet ID.
• Notice that each subnet can
have any number of bits in its
subnet mask.
• Bitwise ANDing of Host IP
address and Subnet Mask
gives the Subnet No.
128.96.34.1
R1
H1
Subnet mask: 255.255.255.128 28
Subnet number: 128.96.34.128 28
128.96.34.130
128.96.34.139
128.96.34.129
H3
R2
128.96.33.1
128.96.33.14
Subnet mask: 255.255.255.0
Subnet number: 128.96.33.0
H2
Next....
• Given subnets how does one now
make the forwarding tables ?
– More about Subnets
• Classless Inter Domain Routing.
• BGP
Download