Presentation is loading. Please wait.

Presentation is loading. Please wait.

資 管 Lee Lesson 5 IP Packets: Delivery and Routing IP Layer operation.

Similar presentations


Presentation on theme: "資 管 Lee Lesson 5 IP Packets: Delivery and Routing IP Layer operation."— Presentation transcript:

1 資 管 Lee Lesson 5 IP Packets: Delivery and Routing IP Layer operation

2 資 管 Lee delivery ◦ Physical forwarding of the packets. ◦ Connectionless and connection-oriented ◦ IP protocol is a connectionless protocol. routing ◦ Finding the route (next hop) for a datagram. ◦ Routing methods, types of routing, the routing table, and the routing module.

3 資 管 Lee Direct delivery ◦ Final destination of the packet is a host connected to the same physical network as the deliverer. ◦ Sender determine by filtering out the destination field of IP packet.  IP destination first be masked with the mask field in the routing table  compare the destination field in the routing table with the result. ◦ Case for direct delivery,:  Case 1: MAC address is known, the sender sent the MAC frame to the destination  Case 2: Otherwise, it use ARP protocol to find the physical address of the destination. Network Router Host Direct delivery Direct delivery To the Rest of the Internet

4 資 管 Lee Indirect delivery (by way of router) ◦ Case of indirect delivery: [indirect delivery]  final destination of the packet is not connected to the same physical network as the deliverer.  the sender sent the MAC frame to the router’s destination if destination MAC address is available.  {The packet may go from router to router until it reaches the one connected to the same physical network as its final destination.} Network Router Host (source) Host (destination) Indirect delivery Direct delivery Network

5 資 管 Lee Routing Methods Next-hop Routing ◦ Routing table hold only the address of the next hop instead of holding the complete route. R1 Host A (source) Host B (destination) Network R2 DestinationRoute Host BR1, R2, Host B DestinationRoute Host BR2, Host B DestinationRoute Host BR1 DestinationRoute Host BR2 DestinationRoute Host B DestinationRoute Host B__

6 資 管 Lee Routing Methods Network-Specific Routing ◦ Instead of having an entry for every host connected to the same physical networks. Treat all hosts connected to the same network as one single entry. R1 Host (source) N1 DestinationNext Route AR1 B C D DestinationRoute N2R1 A B C D N2

7 資 管 Lee Routing Methods Host-Specific Routing ◦ Host address is given in the routing table. R1 Host A R2 DestinationNext Hop Host BR3 N2R1 N3R3 …… N2 N1 N3 Host B Routing table for host A

8 資 管 Lee Routing Methods Default Routing ◦ Default entry (network address 0.0.0.0). For example, router R1 for network N2, others, through router R2. R1 Host A DestinationNext Hop N2R1 …… …… DefaultR2 N2 N1 Routing table for host A Rest of the Internet

9 資 管 Lee Static vs Dynamic Routing Routing table, entries for all the destination, can be either static or dynamic ◦ Static routing contains information entered manually, used in a small internet or in an experimental internet. ◦ Dynamic routing table is updated periodically using one of the dynamic routing protocols such as RIP, OSPF, or BGP

10 資 管 Lee Routing Module and Routing Table Design Basic module for routing and routing table. …… …… Routing module Routing table IP packet From IP Processing module To fragmentation module IP Layer operation Data Link Layer

11 資 管 Lee Examples R3 193.14.5.160/27 193.14.5.192/27 111.0.0.0/8 192.16.7.0/24 194.17.21.0/24 Rest of the INternet R5 R4 193.14.5.165193.14.5.197 111.25.19.20 R1 m2m1 m0 R2 111.20.18.14 111.15.17.32 111.30.31.18 192.16.7.5 192.16.7.52 194.17.21.68 Host A:194.17.21.16 194.17.21.14 Host B:193.14.5.163 T0 T1

12 資 管 Lee Routing table design Seven basic fields: ◦ mask, destination address, next-hop address, flags, reference-count, use, and interface Mask Dest. address Next-hop address Flags Reference count UseInterface 255.0.0.0 … … 124.0.0.0 … 145.6.7.23 … UG … 4……4…… 20 … m2 … … Flags: 5 flags. U(up), G (gateway), H(host-specific), D(added by redirection), M(modified by redirection): G flags mean another network or not. H flags means that the entry is a host-specific address. Reference count: the user number that use this entry. Use: the total packets that use this entry.

13 資 管 Lee Routing Module operation Receive: an IP packet 1. For each entry in the routing table 1. Apply the mask to packet destination address 2. If (the result matches the value in the destination field) 1. If (the G flags is absent) /* direct delivery */ use packet destination address as next hop address else value in next hop fields as next hop address 2. Send packet to fragmentation module with next hop address and interface ID. 3. Return 2. If no match is found for all entries in the routing table, send an ICMP error message 3. return

14 資 管 Lee Mask Dest. address Next-hop address Flag s RCUseInterface 255.0.0.0111.0.0.0-U00m0 255.255.255.224193.14.5.160-U00m2 255.255.255.224193.14.5.192-U00m1 ………………… 255.255.255.255194.17.21.16111.20.18.14UGH00m0 255.255.255.0192.16.7.0111.15.17.32UG00m0 255.255.255.0194.17.21.0111.20.18.14UG00m0 0.0.0.0 111.30.31.18UG00m0 Routing table for router R1 Example: Router R1 receives 500 packets for destination 192.16.7.14; the algorithm applies: 1. Direct delivery a. 192.16.7.14& 255.0.0.0  192.0.0.0 no match b. 192.16.7.14& 255.255.255.224  192.16.7.0 no match c. 192.16.7.14& 255.255.255.224  192.16.7.0 no match 2. Host-specific a.192.16.7.14& 255.255.255.255  192.16.7.14no match 3. Network-specific a. 192.16.7.14& 255.255.255.0  192.16.7.0 match { the router sends the packet through interface m0 along with the next-hop IP address (111,15.17.32) to the fragmentation module for further processing. It increments the use field by 500 and RC by 1. }

15 資 管 Lee Example 2: Router R1 receives 100 packets for destination 193.14.5.176; the algorithm applies: 1. Direct delivery 2. Host-specific 3. Network-specific Example 3: Router R1 receives 20 packets for destination 200.34.12.34: the algorithm applies: 1. Direct delivery 2. Host-specific 3. Network-specific

16 資 管 Lee Practice Quiz(3) S1: Show the routing table for router R3 S2: Router R3 receives 100 packets for destination 193.14.5.176; the algorithm applies?

17 資 管 Lee IP layer operation

18 資 管 Lee An simplified, bare-bones design of IP Eight components: ◦ 5 modules:  header-adding module, a processing module, a routing module, a fragmentation module, and reassembly module. ◦ 3 tables:  routing table, MTU table, and a reassembly table.

19 資 管 Lee Routing Module and Routing Table Design …… Routing module Routing table IP packet Reassembly module Processing module …… Reassemble table … MTU table IP packet Header-adding module IP packet Fragmentation module IP packet Data address From upper layer protocol From data link layer To data link layer To upper layer protocol IP layer operation

20 資 管 Lee Header-Adding Module Header-Adding Module operation Receive: data, destination address { 形成 IP 封包 } 1. Encapsulate the data in an IP datagram 2. Calculate the checksum and insert it in the checksum field. 3. Send the data to the corresponding input queue. 4. Return. Processing Module operation 1. Remove one datagram from one of the input queues. 2. If (destination address is 127.X.Y.Z or matches one of the local addresses) 1) Send the datagram to the reassembly module, 2) Return 3. If (machine is a router) Decrement TTL. 4. If (TTL less than or equal to zero) 1) discard the data gram, 2) Send an ICMP error message, 3) Return 5. Send the datagram to the routing module. 6. Return.

21 資 管 Lee 資 管 Fragmentation Module operation Receive: an IP packet from routing module 1. Extract the size of the datagram. 2. If (size>MTU of the corresponding network) 1) If (D bit is set), discard the datagram, send an ICMP message, return. 2) Else, Calculate the maximum size, Divide the datagram into fragments, add header to each fragments, send the datagram, return. 3. Else, 1) Send the datagram. 4.Return. Interface Number MTU ……………… ……………… MTU table

22 資 管 Lee 資 管 Reassembly Module operation Receive: an IP datagram from the processing module 1. If (offset value is zero and the M bit is 0) 1) Send the datagram to the appropriate queue, return. 2. Search the reassembly table for the corresponding entry. 3. If (not found) 1) create a new entry. 4.Insert the fragment at the appropriate place in the link list. 1) If (all fragments have arrived), Reassemble the fragements, delivery the datagram to the corresponding upper layer protocol, return. 2) Else, check the time-out, if (time-out expired), discard all fragments, send an ICMP error message 5. Return. StateSource Addr.Data IDTime outFragments Reassemble table


Download ppt "資 管 Lee Lesson 5 IP Packets: Delivery and Routing IP Layer operation."

Similar presentations


Ads by Google