Sunteți pe pagina 1din 18

Contents

LECTURE 6
• I. Delivery
Delivery, Forwarding and Routing
• II. Forwarding
• III. Unicast Routing Protocols
— Autonomous System (AS)
— Distance Vector Routing - RIP
Chapter 22 Network Layer: Delivery, Forwarding and Routing — Link State Routing - OSPF
(Forouzan, Data Communications and Networking, 4th Edition)
— Path Vector Routing - BGP

1 2

I. DELIVERY Figure 22.1 Direct and indirect delivery

The network layer supervises the handling of the


packets by the underlying physical networks. We
define this handling as the delivery of a packet.

Topics discussed in this section:


Direct Versus Indirect Delivery • Direct delivery: Destination host is connected to the same
physical network as the deliverer
• Indirect delivery: Destination host is not on the same
3 network as the deliverer 4
II. FORWARDING Figure 22.2 Route method versus next-hop method

Forwarding means to place the packet in its route to


its destination. Forwarding requires a host or a router
to have a routing table. When a host has a packet to
send or when a router has received a packet to be
forwarded, it looks at this table to find the route to the
final destination. Direct
connection
to Host B
Topics discussed in this section:
Forwarding Techniques
Forwarding Process
Routing Table • Route method: Keep complete route in the table
• Next-hop method: Only keep address of the next hop
5
in the table 6

Figure 22.3 Host-specific versus network-specific method Figure 22.4 Default method

• Instead of listing all networks


in the entire Internet, host A
• Host-specific method: One entry for each host can just have one entry called
connected to the same physical network the default
• Network-specific method: One entry that defines the —Network address of 0.0.0.0
destination network itself
— All hosts connected to that network use the same entry 7 8
Forwarding Techniques Figure 22.5 Simplified forwarding module in classless address

• For a large network like the Internet, number of


entries in the routing table can be very large
• IPv4 has 32-bit address space, or 4 billions host
—Assuming that 50% of those are utilized, or 2 billions
—If we only use 20 bytes per routing table entry, every
router would need 2*20=40 billions bytes or 40GB RAM
• All three techniques above help reduce hardware • Routing is done on a per-block basis
requirement and improve processing speed • Need one row of information for each block
• Also need address mask or length to completely
identify a block
In classless addressing, we need at least four
9 columns in a routing table. 10

Routing table Example 22.1


Make a routing table for router R1, using the
configuration in Figure 22.6.

Solution
Table 22.1 shows the corresponding table.

11 12
Figure 22.6 Configuration for Example 22.1 Table 22.1 Routing table for router R1

m3
m3

Network cloud
(logical), not a
physical IP address

13 14

Example 22.2 Example 22.3


Show the forwarding process if a packet arrives at R1 in Show the forwarding process if a packet arrives at R1 in
Figure 22.6 with the destination address 180.70.65.140. Figure 22.6 with the destination address 201.4.22.35.
Solution Solution
The router performs the following steps: The router performs the following steps:
1. The first mask (/26) is applied to the destination address. The
1. The first mask (/26) is applied to the destination address.
result is 201.4.22.0, which does not match the corresponding
The result is 180.70.65.128, which does not match the network address.
corresponding network address. 2. The second mask (/25) is applied to the destination address. The
2. The second mask (/25) is applied to the destination result is 201.4.22.0, which does not match the corresponding
address. The result is 180.70.65.128, which matches the network address (row 2).
corresponding network address. The next-hop address 3. The third mask (/24) is applied to the destination address. The
result is 201.4.22.0, which matches the corresponding network
(180.70.65.140) and the interface number m0 are
address. The destination address of the packet and the interface
passed to ARP for further processing. 15 number m3 are passed to ARP. 16
Example 22.4 Address Aggregation
Show the forwarding process if a packet arrives at R1 in • In the next figure, router R1 has a long routing
Figure 22.6 with the destination address 18.24.32.78. table because each packet must be correctly
routed to the appropriate organization
Solution
This time all masks are applied, one by one, to the • Router R2 can have a very small routing table
destination address, but no matching network address is —Any packet with IP address of 140.24.7.0 to
140.24.7.255 is sent out from interface m0
found. When it reaches the end of the table, the module
regardless of the organization number
gives the next-hop address 180.70.65.200 and interface
number m2 to ARP. This is probably an outgoing • In effect, blocks of addresses for four
package that needs to be sent, via the default router, to organizations are aggregated into one larger
someplace else in the Internet. block

17 18

Figure 22.7 Address aggregation Longest Mask Matching


• What if organization 4 cannot be connected to
router R1?
—Can we still use address aggregation and still assign
the same block (140.24.7.192/26) to organization 4?
• We can, but only with longest mask matching
—Routing table must be sorted from the longest mask
to the shortest mask
—Route entry with longer mask must be tested first

19 20
Figure 22.8 Longest mask matching Hierarchical Routing
• To take advantage of address aggregation, we can
assign a block of IP addresses hierarchically
• The Internet is divided into international and national
ISPs
• National ISPs are divided into regional ISPs
• Regional ISPs are divided into local ISPs
• Local ISP can assign addresses in its block to various
sizes of customer organizations
• Allow one aggregated entry for all ISPs under the same
national ISP
— The rest of Internet does not have to be aware of how
addresses are divided by this national ISP
• Only one entry in every router in the world for this ISP
• Reduce the size of routing table
21 22

Example 22.5 Figure 22.9 Hierarchical routing with ISPs


As an example of hierarchical routing, let us consider small
ISP
Figure 22.9. A regional ISP is granted 16,384 addresses local
starting from 120.14.64.0. The regional ISP has decided small
ISP

to divide this block into four subblocks, each with 4096 ISP
Household (4) Reserved
addresses. Three of these subblocks are assigned to three
Regional
local ISPs; the second subblock is reserved for future use. ISP
Large (1024)
Note that the mask for each block is /20 because the organization
local
ISP
original block with mask /18 is divided into 4 blocks.
Small (256) local
The first local ISP has divided its assigned subblock into organization ISP
8 smaller blocks and assigned each to a small ISP (/23).
Each small ISP provides services to 128 households, each
using four addresses (with mask of /30). 23 24
Example 22.5 (continued) Quiz #7 (1pt, 11:39-11:54 AM)
The second local ISP has divided its block into 4 blocks • 22-18) Show the routing table for the regional
and has assigned the addresses to four large ISP in Figure 22.9
organizations. small
ISP
The third local ISP has divided its block into 16 blocks local
ISP
and assigned each block to a small organization. Each small
small organization has 256 addresses, and the mask is ISP
Household (4) Reserved
/24. Regional
ISP
There is a sense of hierarchy in this configuration. All Large (1024) local
organization
routers in the Internet send a packet with destination ISP

address 120.14.64.0 to 120.14.127.255 to the regional Small (256) local


ISP. organization ISP
25 26

Figure 22.10 Common fields in a routing table


Routing Table
• Static routing table
—Information is entered manually by administrator
—Can be used in small network or experimental • Next hop address = Next-hop router
network
• Interface = Name of the interface
• Dynamic routing table • Flags
—Updated periodically by one of the dynamic routing — U(up): 0 means router is down
protocols — G(gateway): 1 for indirect delivery, 0 = same network
—Any changes in the Internet will trigger update to all — H(host-specific): 1 for host-specific address entry, 0 for network
the tables in all routers automatically address of destination
• Router is down or new link becomes available — D(added by redirection): ICMP redirection message
— M(modified by redirection)
—The only choice in large network like the Internet
• Reference count = number of users of this route
27 • Use = number of packets transmitted through this router
28
Example 22.6 (continued)
Example 22.6
One utility that can be used to find the contents of a
routing table for a host or router is netstat in UNIX or
LINUX. The next slide shows the list of the contents of a
default server. We have used two options, r and n. The
option r indicates that we are interested in the routing
table, and the option n indicates that we are looking for The destination column here defines the network address.
numeric addresses. Note that this is a routing table for a The term gateway used by UNIX is synonymous with
host, not a router. Although we discussed the routing table router. This column actually defines the address of the next
for a router throughout the chapter, a host also needs a hop. The value 0.0.0.0 shows that the delivery is direct. The
routing table. last entry has a flag of G, which means that the destination
can be reached through a router (default router). The Iface
defines the interface (eth0 = Ethernet Interface number 0).
29 30

Example 22.6 (continued)


Figure 22.11 Configuration of the server for Example 22.6

More information about the IP address and physical


address of the server can be found by using the ifconfig
command on the given interface (eth0).

31 32
Netstat -rnes
III. UNICAST ROUTING PROTOCOLS

A routing table can be either static or dynamic. A static table is


one with manual entries. A dynamic table is one that is updated
automatically when there is a change somewhere in the
Internet. A routing protocol is a combination of rules and
procedures that lets routers in the Internet inform each other of
of
changes.

Topics discussed in this section:


Optimization
Intra- and Interdomain Routing
Distance Vector Routing and RIP
Link State Routing and OSPF
Path Vector Routing and BGP
33 34

Dynamic Routing Table Figure 22.12 Autonomous systems

• Get updated as soon as there is a change in the


Internet
—e.g., Router is down or a better link is available
• Information from other routers is combined to
create a new routing table
• Can consist of multiple levels of optimization
—Routing Information Protocol (RIP) treats all links as
equal (link cost = hop count)
—Open Shortest Path First (OSPF) allows different link
cost based on the type of service required
• e.g., minimum delay and maximum throughput • Autonomous system (AS) is a group of networks (links)
• Several routing tables based on each type of service and routers under the authority of a single administration
35 36
Figure 22.13 Popular routing protocols Figure 22.14 Distance vector routing tables

• Each node maintains a vector (table) of


minimum distances to every node
• Table guides packets to the desired node by
showing the next stop in the route (next-hop
routing)

• Intradomain routing = routing inside an AS


—Each AS chooses routing protocol independently
• Interdomain routing = routing between AS’s
—Only one routing protocol is allowed, which is path vector
37 38

Distance Vector Routing Figure 22.15 Initialization of tables in distance vector routing

• Initialization
—Each node knows the distance between itself and its
immediate neighbors, those directly connected to it
• Sharing
—Node shares its table with other nodes to allow
communication with non-neighboring nodes
• Node C shares its table with Node A, enable Node A to reach
Node E
—Entire table is shared
• The information receiver decides if it want to use which part
of the table and discard which part of the table
• Third column (next hop) is replaced with sender’s name
In distance vector routing, each node shares its routing table with its
39 immediate neighbors periodically and when there is a change.40
Figure 22.16 Updating in distance vector routing One exception to the rule

1. Receiver (A) adds the 4. If old cost is equal or 6. If next node entry is the 6 C
cost between itself (A) lower, it is kept same, the new row must
and sender (C) to each 5. If old cost is higher, be used
value in the second the entry from the new
column table is used
2. ∞ + 2 = ∞
3. Name of the sender (C)
is added to third column 41 42

When to share? Figure 22.17 Two-node instability

• Periodic update every 30 seconds


• Triggered update after
—Changes in its own table
—Failure is detected in the neighboring links

• Link between A and X fails


• Everything is fine if A updates B first
• System becomes unstable if B sends its routing table to
A before receiving A’s routing table
• Cost of reaching X increase gradually until it reach ∞
43 — Packets will bounce between A and B (two-node loop problem)44
Addressing two-node instability Figure 22.18 Three-node instability

• Define infinity to a smaller number, such as 100 • Cannot be solved by split horizon
• Split Horizon
—Only parts of the table is sent to neighbors
—If node B thinks that optimum route to X is via A, then
it does not need to advertise this information to A
• A should already know this information
• Split Horizon and Poison Reverse
—Normally, distance vector protocol uses a timer to
delete a route from its table if there is no news about
this route • Loop continues
—Some update is still needed
—A advertises the route to X to C, with increased cost
—Node B can still advertise value for X, but with a
warning “Do not use this value; what I know about this —Loop stops when cost reaches infinity
route comes from you” 45 46

Routing Information Protocol


(RIP) Figure 22.19 Example of a domain using RIP

• Intra-domain routing protocol used inside an AS


• Implement distance vector with some
considerations
—Entry is based on network (first column defines a
network address)
—Distance is defined as number of links (networks) to
reach the destination
—Infinity is defined as 16
—Next node column defines the addresses of router to
which the packet is to be forwarded • Seven entries in each table, one for each network
• Network = Link
47 48
Link State Routing Figure 22.20 Concept of link state routing

• Each node in the domain has the entire topology


of the domain
—List of nodes and links
—How they are connected?
—Type, cost (metric) and condition (up or down)
• Use Dijkstra’s algorithm to build a routing table
• Same information is used everywhere, but each
node can interpret the topology differently
—Using itself as the root of the tree

49 50

Figure 22.21 Link state knowledge


Building Routing Table
• Creation of Link State Packet (LSP)
— States of the links by each node, or network topology information
— (1) Node identity and (2) list of links for topology creation
— (3) Sequence number to distinguish new LSPs
— (4) Age to prevent old LSPs from being used
— Generated on two occasions
• When there is a change in the topology of the domain
• On a periodic basis, mostly to ensure that old information is removed
(every 1-2 hours)
• Flooding of LSPs
— Copy of LSP is sent out of each interface
• Each node has partial knowledge of the topology — Old LSP is discarded
—State of its links: Type, condition, and cost — New LSP is used to update routing table (with Dijkstra’s algorithm)
— New LSP is also sent out of the remaining interfaces (except the
• Whole topology can be compiled from the partial one from which it arrives)
knowledge of each node 51 52
Figure 22.22 Dijkstra algorithm Figure 22.23 Example of formation of shortest path tree

• Dijkstra’s • After each step,


permanent (filled circles)
algorithm is used and tentative (open
to create a circles) nodes are shown
shortest path tree with cumulative costs
(from network
topology)
—Shortest path tree
= tree in which
the path between
root and every
other node is the
shortest
53 54

Open Shortest Path First


Table 22.2 Routing table for node A
(OSPF)
• Intradomain routing protocol based on link state
routing
• Cost of each link (metric) can be based on a type
of service
—Minimum delay or Maximum throughput
• Autonomous system is divided into areas
—All networks inside an area must be connected
• Same routing table as those obtained from —Each area has a numeric identification number
distance vector protocol (Figure 22.14)

55 56
Figure 22.24 Areas in an autonomous system Figure 22.25 Types of links

• Link is a connection between two routers


• Virtual link is manually created by administrator in
response to a broken physical link
• Area border router links between areas —May use a longer path that goes through several routers
— Summarize information about area and send it to other areas
• Area 0 = Backbone
— All other areas must be connected to the backbone
— Router inside backbone is called backbone router 57 58

Figure 22.26 Point-to-point link Figure 22.27 Transient link

• Point-to-point link connects directly between two • Transient link = network with several routers attached to it
routers — Data can enter and leave through any routers
—Each router only has one neighbor at the other side of — All LANs represent transient link
• Some WANs with more than one router also are transient link
the link
— Each router has many neighbors
—Does not need network address
• Figure b shows neighborhood relationship
—Metrics are shown at two ends, one for each direction — Fully connected network need 20 advertisement messages
• Figure c shows another representation, with designated
59 router representing the network 60
Figure 22.28 Stub link Figure 22.29 Example of an AS and its graphical representation in OSPF

• Stub link = network that is connected to only one


router
—Special case of transient network

61 62

OSPF Graphical Representation Path Vector Routing


• N1 and N3 represent transient network • Address limitation in intradomain routing
• N2, N4, and N5 represent stub network —Distance vector routing is not stable in network with
several hops
• No identity is needed for point-to-point link
—Link state routing require large amount of resource to
• Square node = Router, Oval node = Network be transferred (flooding) and to calculate routing table
—But OSPF sees both types as nodes • Path Vector Routing = Interdomain routing
protocol based on distance vector routing
—One node in each AS that acts on behalf of the entire
AS, called speaker node
—Speaker node creates routing table and advertises it to
speaker nodes in the neighboring AS
• Only advertise the path, and not the metric
63 64
Figure 22.30 Initial routing tables in path vector routing Figure 22.31 Stabilized tables for three autonomous systems

• Only advertise the path,


and not the metric
• Table is shared with
neighboring nodes

• Routing table contains a complete path


— Router can discard any entry that contains its AS, to avoid a loop
— It can also discard any entry if AS in the path is against its policy
• All paths start with its own AS
• Optimum path is the one that involve the smaller number
65 of autonomous systems 66

Border Gateway Protocol (BGP) BGP Path Attributes


• Interdomain routing protocol based on Path Vector • Well-known attribute must be recognized by all
• Support multiple types of autonomous system router
— Well-known mandatory attribute must appear in the
—Stub AS: Only has one connection to another AS route description
• Data cannot pass through stub AS • ORIGIN = Source of the routing information
—Multihomed AS: Connect to more than one AS, but still • AS_PATH = List of ASs toward the destination
does not allow data to pass through • NEXT-HOP = Next hop router to which data should be sent
—Transit AS: Multihomed AS that allows traffic to pass — Well-known discretionary attribute is not required to be
through included in every update message
• Example is Internet backbone • Optional attribute can be ignored by router
— Optional transitive attribute must be passed to next
router
— Optional nontransitive attribute must be discarded if the
67 receiving router has not implemented it 68
Figure 22.32 Internal and external BGP sessions

• External BGP session (E-BGP) is used to exchange


information between ASs
• Internal BGP session (I-BGP) is used to exchange routing
information between two routers inside an AS
69

S-ar putea să vă placă și