Download presentation
Presentation is loading. Please wait.
1
Copyright © Lopamudra Roychoudhuri
Network Protocols Chapter 6 (TCP/IP Suite Book): IP Forwarding Copyright © Lopamudra Roychoudhuri
2
Packet Delivery IP at Network layer supervises delivery
IP is a Connectionless protocol IP treats each packet independently Packets from the same message may or may not travel the same path to their destination Decision about each packet is made individually by each intermediate router 2
3
Same network/subnet/supernet address
Direct delivery Same network/subnet/supernet address Indirect Delivery
4
IP Packet – Direct Delivery
IF destination IP address is on the same network/subnet/supernet, then IP uses direct delivery to send the data packet directly to the destination without going through a router. Sender extracts destination network address and compares with the networks to which it is connected Sender uses destination IP address to find physical address using Address Resolution Protocol (ARP) (ARP converts the IP address to the physical address.) 2
5
Direct Delivery cont. The Direct Delivery method looks up the layer 2 address (i.e. Ethernet address) of the destination in an ARP Table, or by ARP Request, and places this address in the frame header. Packet will be delivered directly to destination by the layer 2 network. 2
6
IP Packet – Indirect Delivery
IF destination address is on different network/subnet/supernet, then IP uses indirect delivery by sending the data packet directly to a router that is on the local subnet Packet goes from router to router until it reaches final destination Sender uses destination IP address and a routing table to find the IP address of the next router Sender uses ARP to find the physical address of the next router 2
7
Indirect Delivery The Indirect Delivery method looks up the layer 2 address (i.e. Ethernet address) of the local router (the Default Gateway) in the ARP Table and places this address in the frame header. IP address of the local router was provided to this IP host by network manager during host configuration. Packet will be delivered directly to the router by the layer 2 network. Router will then decide how to forward the packet to the destination subnet. 2
8
Routing Tables Both Hosts and Routers need some type of Routing Table that tells them what to do for Indirect Delivery. Routing Tables store Destination Addresses (can be network, subnet or host addresses) Routing Information for each address 2
9
Figure 5.20 Network addresses
10
Direct or Indirect? Example: Answer:
My IP address is , Mask = I’m sending data to address Should I use Direct or Indirect delivery? Answer: AND = AND = Both addresses are on subnet Use Direct Delivery!! 2
11
Direct or Indirect? Example: Answer:
My IP address is , Mask = I’m sending data to address Should I use Direct or Indirect delivery? Answer: AND = AND = Addresses are on different subnets. Use Indirect Delivery!! This packet must be sent through the default router. 2
12
Forwarding Techniques
Forwarding – placing the packet in its route to its destination Source Routing Routing Table stores entire path to destination Next-Hop Routing Table stores only address of the next router – not the entire path Network-Specific One routing table entry for each network or subnet address Host-Specific One routing table entry for each host address Default A default route entry specifies where to send all packets that are not included in other table entries 2
13
Figure 6.3 Source Routing vs. Next-hop method
14
Figure 6.4 Network-specific method
Host-specific routing table for host SNext HopR1 R1 R1DestinationA B C
15
Figure 6.5 Host-specific routing
The administrator wants to have more control: All packets arriving B should go thru R3
16
Figure 6.6 Default routing
Default: designated by network address
17
Routing Implementations
Many IP Hosts just use Default Routing All Indirect deliveries just go to one router Most IP routers use Mainly Network-Specific rather than Host-Specific routing (to save routing table space) However, Host-Specific table entries are permitted for special cases. Mainly Next-Hop rather than Source Routing (to simplify routing table and updates) A default route so that they don’t need to have a routing table entry for every possible network in the Internet 2
18
Static vs. Dynamic Tables
Static Routing Table Routing Table is manually entered and updated by Network Administrator Dynamic Routing Table Routing Table is dynamically updated by means of the exchange of Router Table Update messages between adjacent routers. Example: RIP, OSPF, IGRP, EIGRP, and BGP 2
19
Configuration for routing, Example 1
R1 receives a packet with dest address How will the packet be forwarded? Next R1 receives a packet with dest address How will the packet be forwarded? R1 Routing table entries
20
Simplified Forwarding in Classful Address with Subnetting
Subnetting happens inside an organization
21
Example Configuration – Example 6.4
22
Example 6.4: points to note
The site address is /16 (a class B address). Every packet with destination address in the range to is delivered to the interface m4 and distributed to the final destination subnet by the router. Second, we have used the address x.y.z.t/n for the interface m4 because we do not know to which network this router is connected. Third, the table has a default entry for packets that are to be sent out of the site. The router is configured to apply the subnet mask /18 to any destination address.
23
Simplified forwarding module in classless address
We need mask in the table to determine the netid of a classless address
24
Example 6.7 Make a routing table for router R1 using the configuration (Fig. 6.13).
25
Routing table for router R1 in Figure 6.13
26
Solution The router performs the following steps:
Example 6.8 Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address Solution The router performs the following steps: 1. The first mask (/26) is applied to the destination address. The result is , which does not match the corresponding network address. 2. The second mask (/25) is applied to the destination address. The result is , which matches the corresponding network address. The next-hop address (the destination address of the packet in this case) and the interface number m0 are passed to ARP for further processing.
27
Example 6.9 Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address 1. The first mask (/26) is applied to the destination address. The result is , which does not match the corresponding network address (row 1). 2. The second mask (/25) is applied to the destination address. The result is , which does not match the corresponding network address (row 2). 3. The third mask (/24) is applied to the destination address. The result is , which matches the corresponding network address. The destination address of the package and the interface number m3 are passed to ARP.
28
Routing module and routing table
# of users using this route # of packets Common Fields in routing table H Router Up H = Host-specific G = Gateway,meaning destination in another network
29
U Flag U The route is up. Destination in the same network
If U flag is set. It is a network address.
30
G Flag G The route is to a gateway (router) means the route uses a gateway. The G flag is important because it differentiates between an indirect route and a direct route. If this flag is not set, the destination is directly connected. If this flag is set, the destination is indirectly connected.
31
H Flag Indicates this is a route to a specific host.
If the H flag is set, specifies that the destination address is a complete host address. If this flag is not set, the route is to a network, and the destination is a network address: a net ID, or a combination of a net ID and a subnet ID. This flag signifies that the destination address in the entry is a host address or a network address
32
Summary Description Flags
Using a route, destination in the same network, it is a network address. U G Flag is not set, the destination is directly connected. G flag is set, the destination is indirectly connected. G If this flag is not set, the route is to a network, and the destination is a network address. If this flag is set, the route is to a host, and the destination is a host address. H Using a route, destination in another network, it is a network address. UG Using a route, the destination is a host, it is on a different network. UGH Using a route, the destination is a host, it is on the same network. UH
33
Typical Router Table Fields
Mask: Each router table entry has its own mask (differentiates host-specific from network-specific entries) Destination: This is matched against the address in the packet Next Hop Address: Next hop router if Destination matches Physical Port (Interface): Router port to send packet out if Destination matches Distance: Distance to destination (used to compare different routes) Flags: Flags that specify information about status of this routing table entry 2
34
Note: this is a routing table for a host, not a router.
Example One utility that can be used to find the contents of a routing table for a host or router is netstat in UNIX, Windows, or LINUX. The following shows the listing of the contents of the default server. The options: r - we are interested in the routing table n - we are looking for numeric addresses. Note: 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.
35
Example (continued) $ netstat -rn Kernel IP routing table
Destination Gateway Mask Flags Iface U eth0 U lo UG eth0
36
Example (continued) More information about the IP address and physical address of the server can be found using the ifconfig command on the given interface (eth0). $ ifconfig eth0 eth0 Link encap:Ethernet HWaddr 00:B0:D0:DF:09:5D inet addr: Bcast: Mask: .... From the above information, we can deduce the configuration of the server as shown in next Figure.
37
Configuration of the server for Example
38
Another example: Routing table for R1 on the next slide
39
Routing table for R1 in the previous slide
Mask Dest. Next Hop Flags R.C. U. I. --- U m0 m2 m1 UGH UG
40
Example 1 Router R1 receives 500 packets for destination ; the algorithm applies the masks row by row to the destination address until a match (with the value in the second column) is found:
41
Solution Direct delivery 192.16.7.14 & 255.0.0.0 192.0.0.0 no match
Host-specific & no match Network-specific & match
42
Example 2 Router R1 receives 100 packets for destination ; the algorithm applies the masks row by row to the destination address until a match is found: Solution Direct delivery & no match & match
43
Example 3 Router R1 receives 20 packets for destination ; the algorithm applies the masks row by row to the destination address until a match is found:
44
Solution Direct delivery 200.34.12.34 & 255.0.0.0 200.0.0.0 no match
Host-specific & no match
45
Solution Network-specific
& no match Default & match
46
Address aggregation In classless addressing, number of routing table entries will increase. This is called address aggregation because the blocks of addresses for four organizations are aggregated into one larger block.
47
Figure 6.16 Longest mask matching
Longest Mask Matching: In R2 routing table, 1 should be matched before 2. Why? 1 IPaddr of m2 of R3 2 IPaddr of m3 of R1 IPaddr of m2 of R3 To other nws To the rest of the Internet (R2, IPaddr of m0 ) Suppose a packet arrives for organization 4 with destination address at R2 To other nws (R2, IPaddr of m1)
48
Example 6.12 As an example of hierarchical routing, let us consider next Figure. A regional ISP is granted addresses starting from The regional ISP has decided to divide this block into four subblocks, each with 4096 addresses. Three of these subblocks are assigned to three local 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.
49
Hierarchical routing with ISPs
50
Example (Continued) The first local ISP has divided its assigned subblock into 8 smaller blocks and assigned each to a small ISP. Each small ISP provides services to 128 households (H001 to H128), each using four addresses. Note that the mask for each small ISP is now /23 because the block is further divided into 8 blocks. Each household has a mask of /30, because a household has only 4 addresses (232−30 is 4). The second local ISP has divided its block into 4 blocks and has assigned the addresses to 4 large organizations (LOrg01 to LOrg04). Note that each large organization has 1024 addresses and the mask is /22.
51
Example 6.12 (Continued) The third local ISP has divided its block into 16 blocks and assigned each block to a small organization (SOrg01 to SOrg15). Each small organization has 256 addresses and the mask is /24. There is a sense of hierarchy in this configuration. All routers in the Internet send a packet with destination address to to the regional ISP. The regional ISP sends every packet with destination address to to Local ISP1. Local ISP1 sends every packet with destination address to to H001.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.