SCCS 420 Ch 22-1 (Delivery forwarding routing)

18
1 LECTURE 6 Delivery, Forwarding and Routing Chapter 22 Network Layer: Delivery, Forwarding and Routing (Forouzan, Data Communications and Networking, 4 th Edition) 2 Contents I. Delivery II. Forwarding III. Unicast Routing Protocols Autonomous System (AS) Distance Vector Routing - RIP Link State Routing - OSPF Path Vector Routing - BGP 3 I. DELIVERY I. DELIVERY The network layer supervises the handling of the The network layer supervises the handling of the packets by the underlying physical networks. We packets by the underlying physical networks. We define this handling as the delivery of a packet. define this handling as the delivery of a packet. Direct Versus Indirect Delivery Topics discussed in this section: Topics discussed in this section: 4 Figure 22.1 Direct and 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 network as the deliverer

Transcript of SCCS 420 Ch 22-1 (Delivery forwarding routing)

Page 1: SCCS 420 Ch 22-1 (Delivery forwarding routing)

1

LECTURE 6 Delivery, Forwarding and Routing

Chapter 22 Network Layer: Delivery, Forwarding and Routing(Forouzan, Data Communications and Networking, 4th Edition)

2

Contents

• I. Delivery

• II. Forwarding

• III. Unicast Routing Protocols— Autonomous System (AS)

— Distance Vector Routing - RIP

— Link State Routing - OSPF

— Path Vector Routing - BGP

3

I. DELIVERYI. DELIVERY

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

Direct Versus Indirect DeliveryTopics discussed in this section:Topics discussed in this section:

4

Figure 22.1 Direct and 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 network as the deliverer

Page 2: SCCS 420 Ch 22-1 (Delivery forwarding routing)

5

II. FORWARDINGII. FORWARDING

Forwarding means to Forwarding means to place the packetplace the packet in its routein its route to to its destination. Forwarding requires a host or a router its destination. Forwarding requires a host or a router to have a to have a routing tablerouting table. When a host has a packet to . When a host has a packet to send or when a router has received a packet to be send or when a router has received a packet to be forwarded, it looks at this table to find the route to the forwarded, it looks at this table to find the route to the final destination. final destination.

Forwarding TechniquesForwarding ProcessRouting Table

Topics discussed in this section:Topics discussed in this section:

6

Figure 22.2 Route method versus next-hop method

• Route method: Keep complete route in the table• Next-hop method: Only keep address of the next hop

in the table

Direct connection to Host B

7

Figure 22.3 Host-specific versus network-specific method

• Host-specific method: One entry for each host connected to the same physical network

• Network-specific method: One entry that defines the destination network itself— All hosts connected to that network use the same entry 8

Figure 22.4 Default method

• Instead of listing all networksin the entire Internet, host A can just have one entry called the default—Network address of 0.0.0.0

Page 3: SCCS 420 Ch 22-1 (Delivery forwarding routing)

9

Forwarding Techniques• 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 requirement and improve processing speed

10

Figure 22.5 Simplified forwarding module in classless address

• Routing is done on a per-block basis• Need one row of information for each block• Also need address mask or length to completely

identify a blockIn classless addressing, we need at least four

columns in a routing table.

11

Routing table

12

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

Example 22.1

SolutionTable 22.1 shows the corresponding table.

Page 4: SCCS 420 Ch 22-1 (Delivery forwarding routing)

13

Figure 22.6 Configuration for Example 22.1

m3

Network cloud (logical), not a physical IP address

14

m3

Table 22.1 Routing table for router R1

15

Show the forwarding process if a packet arrives at R1 in Figure 22.6 with the destination address 180.70.65.140.

Example 22.2

SolutionThe router performs the following steps:1. The first mask (/26) is applied to the destination address.

The result is 180.70.65.128, which does not match thecorresponding network address.

2. The second mask (/25) is applied to the destinationaddress. The result is 180.70.65.128, which matches thecorresponding network address. The next-hop address(180.70.65.140) and the interface number m0 are passed to ARP for further processing.

16

Show the forwarding process if a packet arrives at R1 in Figure 22.6 with the destination address 201.4.22.35.

Example 22.3

SolutionThe router performs the following steps:1. The first mask (/26) is applied to the destination address. The

result is 201.4.22.0, which does not match the corresponding network address.

2. The second mask (/25) is applied to the destination address. The result is 201.4.22.0, which does not match the corresponding network address (row 2).

3. The third mask (/24) is applied to the destination address. Theresult is 201.4.22.0, which matches the corresponding network address. The destination address of the packet and the interfacenumber m3 are passed to ARP.

Page 5: SCCS 420 Ch 22-1 (Delivery forwarding routing)

17

Show the forwarding process if a packet arrives at R1 in Figure 22.6 with the destination address 18.24.32.78.

Example 22.4

SolutionThis time all masks are applied, one by one, to the destination address, but no matching network address is found. When it reaches the end of the table, the module gives the next-hop address 180.70.65.200 and interface number m2 to ARP. This is probably an outgoing package that needs to be sent, via the default router, to someplace else in the Internet.

18

Address Aggregation• In the next figure, router R1 has a long routing

table because each packet must be correctly routed to the appropriate organization

• Router R2 can have a very small routing table—Any packet with IP address of 140.24.7.0 to

140.24.7.255 is sent out from interface m0regardless of the organization number

• In effect, blocks of addresses for four organizations are aggregated into one larger block

19

Figure 22.7 Address aggregation

20

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

Page 6: SCCS 420 Ch 22-1 (Delivery forwarding routing)

21

Figure 22.8 Longest mask matching

22

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

23

As an example of hierarchical routing, let us consider Figure 22.9. A regional ISP is granted 16,384 addressesstarting from 120.14.64.0. The regional ISP has decided to divide this block into four subblocks, each with 4096 addresses. Three of these subblocks are assigned to threelocal ISPs; the second subblock is reserved for future use. Note that the mask for each block is /20 because the original block with mask /18 is divided into 4 blocks.

Example 22.5

The first local ISP has divided its assigned subblock into 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). 24

Figure 22.9 Hierarchical routing with ISPs

Regional ISP

local ISP

local ISP

local ISP

Reserved

small ISP

small ISP

Large (1024) organization

Small (256) organization

Household (4)

Page 7: SCCS 420 Ch 22-1 (Delivery forwarding routing)

25

The second local ISP has divided its block into 4 blocksand has assigned the addresses to four large organizations.

Example 22.5 (continued)

There is a sense of hierarchy in this configuration. All routers in the Internet send a packet with destination address 120.14.64.0 to 120.14.127.255 to the regional ISP.

The third local ISP has divided its block into 16 blocks and assigned each block to a small organization. Each small organization has 256 addresses, and the mask is /24.

26

Quiz #7 (1pt, 11:39-11:54 AM)• 22-18) Show the routing table for the regional

ISP in Figure 22.9

Regional ISP

local ISP

local ISP

local ISP

Reserved

small ISP

small ISP

Large (1024) organization

Small (256) organization

Household (4)

27

Routing Table• Static routing table

—Information is entered manually by administrator—Can be used in small network or experimental

network

• Dynamic routing table—Updated periodically by one of the dynamic routing

protocols—Any changes in the Internet will trigger update to all

the tables in all routers automatically• Router is down or new link becomes available

—The only choice in large network like the Internet

28

Figure 22.10 Common fields in a routing table

• Next hop address = Next-hop router• Interface = Name of the interface• Flags

— U(up): 0 means router is down— G(gateway): 1 for indirect delivery, 0 = same network— H(host-specific): 1 for host-specific address entry, 0 for network

address of destination— D(added by redirection): ICMP redirection message— M(modified by redirection)

• Reference count = number of users of this route• Use = number of packets transmitted through this router

Page 8: SCCS 420 Ch 22-1 (Delivery forwarding routing)

29

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 numeric addresses. Note that this is a routing table for a host, not a router. Although we discussed the routing table for a router throughout the chapter, a host also needs a routing table.

Example 22.6

30

Example 22.6 (continued)

The destination column here defines the network address. The term gateway used by UNIX is synonymous with router. This column actually defines the address of the nexthop. The value 0.0.0.0 shows that the delivery is direct. The last entry has a flag of G, which means that the destination can be reached through a router (default router). The Ifacedefines the interface (eth0 = Ethernet Interface number 0).

31

Example 22.6 (continued)

More information about the IP address and physical address of the server can be found by using the ifconfigcommand on the given interface (eth0).

32

Figure 22.11 Configuration of the server for Example 22.6

Page 9: SCCS 420 Ch 22-1 (Delivery forwarding routing)

33

Netstat -rnes

34

III. UNICAST ROUTING PROTOCOLS

A routing table can be either static or dynamic. A static table A routing table can be either static or dynamic. A static table is is one with manual entries. A dynamic table is one that is updated one with manual entries. A dynamic table is one that is updated automaticallyautomatically when there is a change somewhere in the when there is a change somewhere in the Internet. A routing protocol is a combination of rules and Internet. A routing protocol is a combination of rules and procedures that lets routers in the Internet inform each other oprocedures that lets routers in the Internet inform each other of f changes. changes.

OptimizationIntra- and Interdomain RoutingDistance Vector Routing and RIPLink State Routing and OSPFPath Vector Routing and BGP

Topics discussed in this section:Topics discussed in this section:

35

Dynamic Routing Table• 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• Several routing tables based on each type of service

36

Figure 22.12 Autonomous systems

• Autonomous system (AS) is a group of networks (links) and routers under the authority of a single administration

Page 10: SCCS 420 Ch 22-1 (Delivery forwarding routing)

37

Figure 22.13 Popular routing protocols

• 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 38

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)

39

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

40

Figure 22.15 Initialization of tables in distance vector routing

In distance vector routing, each node shares its routing table with its immediate neighbors periodically and when there is a change.

Page 11: SCCS 420 Ch 22-1 (Delivery forwarding routing)

41

Figure 22.16 Updating in distance vector routing

1. Receiver (A) adds the cost between itself (A) and sender (C) to each value in the second column

2. ∞ + 2 = ∞3. Name of the sender (C)

is added to third column

4. If old cost is equal or lower, it is kept

5. If old cost is higher, the entry from the new table is used

42

One exception to the rule

6. If next node entry is the same, the new row must be used

C

C6

43

When to share?• Periodic update every 30 seconds• Triggered update after

—Changes in its own table—Failure is detected in the neighboring links

44

Figure 22.17 Two-node instability

• 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 ∞∞∞∞

— Packets will bounce between A and B (two-node loop problem)

Page 12: SCCS 420 Ch 22-1 (Delivery forwarding routing)

45

Addressing two-node instability• Define infinity to a smaller number, such as 100• 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

—Some update is still needed—Node B can still advertise value for X, but with a

warning “Do not use this value; what I know about this route comes from you” 46

Figure 22.18 Three-node instability

• Cannot be solved by split horizon

• Loop continues—A advertises the route to X to C, with increased cost—Loop stops when cost reaches infinity

47

Routing Information Protocol (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

48

Figure 22.19 Example of a domain using RIP

• Seven entries in each table, one for each network• Network = Link

Page 13: SCCS 420 Ch 22-1 (Delivery forwarding routing)

49

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

50

Figure 22.20 Concept of link state routing

51

Figure 22.21 Link state knowledge

• Each node has partial knowledge of the topology—State of its links: Type, condition, and cost

• Whole topology can be compiled from the partial knowledge of each node 52

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— Old LSP is discarded— New LSP is used to update routing table (with Dijkstra’s algorithm)— New LSP is also sent out of the remaining interfaces (except the

one from which it arrives)

Page 14: SCCS 420 Ch 22-1 (Delivery forwarding routing)

53

Figure 22.22 Dijkstra algorithm

• Dijkstra’salgorithm is used to create a shortest path tree(from network topology)—Shortest path tree

= tree in which the path between root and every other node is the shortest

54

Figure 22.23 Example of formation of shortest path tree

• After each step, permanent (filled circles) and tentative (open circles) nodes are shown with cumulative costs

55

Table 22.2 Routing table for node A

• Same routing table as those obtained from distance vector protocol (Figure 22.14)

56

Open Shortest Path First (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—Each area has a numeric identification number

Page 15: SCCS 420 Ch 22-1 (Delivery forwarding routing)

57

Figure 22.24 Areas in an autonomous system

• Area border router links between areas— 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 58

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—May use a longer path that goes through several routers

59

Figure 22.26 Point-to-point link

• Point-to-point link connects directly between two routers—Each router only has one neighbor at the other side of

the link—Does not need network address—Metrics are shown at two ends, one for each direction

60

Figure 22.27 Transient link

• Transient link = network with several routers attached to it— Data can enter and leave through any routers— All LANs represent transient link

• Some WANs with more than one router also are transient link

— Each router has many neighbors

• Figure b shows neighborhood relationship— Fully connected network need 20 advertisement messages

• Figure c shows another representation, with designated router representing the network

Page 16: SCCS 420 Ch 22-1 (Delivery forwarding routing)

61

Figure 22.28 Stub link

• Stub link = network that is connected to only one router—Special case of transient network

62

Figure 22.29 Example of an AS and its graphical representation in OSPF

63

OSPF Graphical Representation• N1 and N3 represent transient network• N2, N4, and N5 represent stub network• No identity is needed for point-to-point link• Square node = Router, Oval node = Network

—But OSPF sees both types as nodes

64

Path Vector Routing• Address limitation in intradomain routing

—Distance vector routing is not stable in network with several hops

—Link state routing require large amount of resource to be transferred (flooding) and to calculate routing table

• 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

Page 17: SCCS 420 Ch 22-1 (Delivery forwarding routing)

65

Figure 22.30 Initial routing tables in path vector routing

• Only advertise the path, and not the metric

• Table is shared with neighboring nodes

66

Figure 22.31 Stabilized tables for three autonomous systems

• 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

of autonomous systems

67

Border Gateway Protocol (BGP)• Interdomain routing protocol based on Path Vector• Support multiple types of autonomous system

—Stub AS: Only has one connection to another AS• Data cannot pass through stub AS

—Multihomed AS: Connect to more than one AS, but still does not allow data to pass through

—Transit AS: Multihomed AS that allows traffic to pass through

• Example is Internet backbone

68

BGP Path Attributes• Well-known attribute must be recognized by all

router—Well-known mandatory attribute must appear in the

route description• ORIGIN = Source of the routing information• AS_PATH = List of ASs toward the destination• NEXT-HOP = Next hop router to which data should be sent

—Well-known discretionary attribute is not required to be included in every update message

• Optional attribute can be ignored by router—Optional transitive attribute must be passed to next

router—Optional nontransitive attribute must be discarded if the

receiving router has not implemented it

Page 18: SCCS 420 Ch 22-1 (Delivery forwarding routing)

69

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