42
Internet Protocol Prof. Hemang Kothari GATE Academy Computer Engineering Department Computer Engineering Department - MEFGI 1 05/21/2022

Example and Solution on Internet Protocol , Sub-netting, Super-netting

Embed Size (px)

Citation preview

Page 1: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 1

Internet Protocol

Prof. Hemang KothariGATE Academy

Computer Engineering Department

Page 2: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 2

IP – Introduction

NetworkLayer

Link Layer

IP

ARPNetworkAccess

Media

ICMP IGMP

TransportLayer

TCP UDP

Page 3: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 3

IP• IP is the highest layer protocol which is implemented at both

routers and hosts • IP provide provides an unreliable connectionless best effort

service (also called: “datagram service”).– Unreliable: IP does not make an attempt to recover lost packets– Connectionless: Each packet (“datagram”) is handled independently. IP is

not aware that packets between hosts may be sent in a logical sequence– Best effort: IP does not make guarantees on the service (no throughput

guarantee, no delay guarantee,…)

Page 4: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 4

IP Header

Page 5: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 5

Fundamentals• Question: In which order are the bytes of an IP datagram

transmitted?• Answer:

Transmission is row by rowFor each row:1. First transmit bits 0-72. Then transmit bits 8-153. Then transmit bits 16-234. Then transmit bits 24-31

• This is called network byte order or big endian byte ordering.

Page 6: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 6

Maximum Transmission Unit• Maximum size of IP datagram is 65535, but the data link layer protocol

generally imposes a limit that is much smaller

• Example: • Ethernet frames have a maximum payload of 1500 bytes• IP datagrams encapsulated in Ethernet frame cannot be longer than 1500

bytes

• The limit on the maximum IP datagram size, imposed by the data link protocol is called maximum transmission unit (MTU)

Page 7: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 7

Complex

• Consider sending a 2400-byte datagram into a link that has an MTU of 700 bytes. Suppose the original Datagram is stamped with the identification number 422.

• How many fragments are generated? What are the values in the various fields in the IP datagram(s) generated related to fragmentation?

Page 8: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 8

Solution • The maximum size of data field in each fragment = 680 (because there

are 20 bytes IP header). Thus the number of required fragments

= (2400 – 20) / 680 = 4 (aprox.)

• Each fragment will have Identification number 422. Each fragment except the last one will be of size 700 bytes (including IP header). The last datagram will be of size 360 bytes (including IP header).

• The offsets of the 4 fragments will be 0, 85, 170, 255. Each of the first 3 fragments will have flag=1; the last fragment will have flag=0.

Page 9: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 9

Classes of IP

Page 10: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 10

Special IP

Page 11: Example and Solution on Internet Protocol , Sub-netting, Super-netting

Subnets

A campus network consisting of LANs for various departments.

Page 12: Example and Solution on Internet Protocol , Sub-netting, Super-netting

Subnets (2)

A class B network subnetted into 64 subnets.

(Please note: For all subnetting questions, assume the ‘all-zeroes’ and ‘all-ones’ subnets are usable. Or, in the Cisco vernacular, assume we have “ip subnet-zero” enabled.)

Page 13: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 13

Review

• Convert the following decimal numbers to binary.– 100, 254, 113, 66

• Convert the following binary numbers to decimal.– 10101010:– 00011100:– 11101110:– 01100111:

Page 14: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 14

Answers• 100: 01100100• 254: 11111110• 113: 01110001• 66: 01000010----------------------------------------------------------------------------• 10101010: 170• 00011100: 28• 11101110: 238• 01100111: 103

Page 15: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 15

Questions

You have the following address: 192.16.5.133/29• How many total bits are being used to identify the

network, and how many total bits identify the host? ----------------------------------------------------------------------------• What is the full subnet mask for address

172.16.5.10/28?

Page 16: Example and Solution on Internet Protocol , Sub-netting, Super-netting

Review – Subnetting

• A network on the Internet has a subnet mask of 255.255.240.0. What is the maximum number of hosts it can handle?

• A network on the Internet has a subnet mask of 255.255.224.0. What is the maximum number of hosts it can handle?

Page 17: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 17

Subnetting • You currently use the default mask for your IP network

192.168.1.0. You need to subnet your network so that you have 30 additional networks, and 4 hosts per network. Is this possible, and what subnet mask should you use?

-----------------------------------------------------------------------------------• You still are using the default mask for your IP network

192.168.1.0. You need to subnet your network so that you have 5 additional networks, and 60 hosts per network. Is this possible, and what subnet mask should you use?

Page 18: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 18

Subnetting

• You have sub-netted your class C network 192.168.1.0 with a subnet mask of 255.255.255.240. Please list the following: – Number of networks,– Number of hosts per network,– The full range of the first three networks, and the usable

address range from those first three networks.

Page 19: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 19

Answer• Number of networks = 16• Number of hosts = 14• Full Range for first three networks:

– 192.168.1.0-15– 192.168.1.16-31– 192.168.1.32-47

• Usable Range for first three networks: – 192.168.1.1-14– 192.168.1.17-30– 192.168.1.33-46

Page 20: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 20

One more problem

• You have sub-netted your class C network 200.138.1.0 with a subnet mask of 255.255.255.252. Please list the following: – Number of networks, – Number of hosts per network– The full range of the first three networks, and the usable address

range from those first three networks. – Additionally, identify the broadcast addresses for each network.

Page 21: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 21

Answer• Number of networks = 64• Number of hosts = 2• Full Range for first three networks:

– 200.138.1.0-3– 200.138.1.4-7– 200.138.1.8-11

• Usable Range for first three networks: – 200.138.1.1-2– 200.138.1.5-6– 200.138.1.9-10

• Broadcast Addresses for first three – 200.138.1.3– 200.138.1.7– 200.138.1.11

Page 22: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 22

Complex Problem• A large number of consecutive IP address are available

starting at 198.16.0.0. • Suppose that four organizations, A, B, C, and D, request 4000,

2000, 4000, and 8000 addresses, respectively, and in that order.

• For each of these, give: – the first IP address assigned– the last IP address assigned– the mask in the w.x.y.z/s notation.

Page 23: Example and Solution on Internet Protocol , Sub-netting, Super-netting

Solution• All the requests are rounded up to a power of two. • The starting address, ending address, and mask are as follows:

• A: 198.16.0.0 – 198.16.15.255 written as 198.16.0.0/20• B: 198.16.16.0 – 198.16.23.255 written as 198.16.16.0/21• C: 198.16.32.0 – 198.16.47.255 written as 198.16.32.0/20• D: 198.16.64.0 – 198.16.96.255 written as 198.16.64.0/19

Page 24: Example and Solution on Internet Protocol , Sub-netting, Super-netting

Explanation198.16.16.0 – 198.16.23.255 written as 198.16.16.0/21Total no. of host we require 2000 that means 2000 / 256 = 8 block

198.16.00010 _3 bit host part_ . 8 bit host part (Total 11 Bit) (256)

Over here I can not use 1

because of A

solution

00010001. (256)

00010010. (256)

00010011. (256)

00010100. (256)

00010101. (256)

00010110. (256)

00010111. (256)

16 + 4 +2 +1 = 23

Page 25: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 25

Find Subnet Id

• IP address: 130.45.34.56 , Mask: 255.255.240.0 What is the subnet address?

• IP = 19.30.80.5 M = 255.255.192.0 What is the subnet address?

Page 26: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 26

Super-netting

• Rules:• The number of blocks must be a power of 2• The blocks must be contiguous in the address

space (no gaps between the blocks).• The third byte of the first address in the

superblock must be evenly divisible by the number of blocks.

Page 27: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 27

Supernetting

• A company needs 1000 addresses. Which of the following set of class C blocks can be used to form a supernet for this company?

198.47.32.0 198.47.33.0 198.47.34.0 198.47.32.0 198.47.42.0 198.47.52.0 198.47.62.0198.47.31.0 198.47.32.0 198.47.33.0 198.47.52.0198.47.32.0 198.47.33.0 198.47.34.0 198.47.35.0

Page 28: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 28

Solution

• 198.47.32.0 198.47.33.0 198.47.34.0• 198.47.32.0 198.47.42.0 198.47.52.0 198.47.62.0• 198.47.31.0 198.47.32.0 198.47.33.0 198.47.52.0• 198.47.32.0 198.47.33.0 198.47.34.0 198.47.35.0

Page 29: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 29

Examples

• We need to make a supernetwork out of 16 class C blocks. What is the supernet mask?

Page 30: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 30

Solution

• We need 16 blocks. For 16 blocks we need to change four 1s to 0s in the default mask. So the mask is

11111111 11111111 11110000 00000000or

255.255.240.0

Page 31: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 31

Problem

• A supernet has a first address of 205.16.32.0 and a supernet mask of 255.255.248.0. A router receives three packets with the following destination addresses:

205.16.37.44205.16.42.56205.17.33.76

• Which packet belongs to the supernet?

Page 32: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 32

Solution

• 205.16.37.44 AND 255.255.248.0 205.16.32.0• 205.16.42.56 AND 255.255.248.0 205.16.40.0• 205.17.33.76 AND 255.255.248.0 205.17.32.0

Page 33: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 33

Problem

• A supernet has a first address of 205.16.32.0 and a supernet mask of 255.255.248.0. How many blocks are in this supernet and what is the range of addresses?

Page 34: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 34

Solution

• The supernet has 21 1s. The default mask has 24 1s. Since the difference is 3, there are 8 blocks in this supernet.

• The blocks are 205.16.32.0 to 205.16.39.0. The first address is 205.16.32.0. The last address is 205.16.39.255.

Page 35: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 35

Classless Inter domain

• A router has just received the following new IP addresses : – 57.6.96.0/21,– 57.6.104.0/21,– 57.6.112.0/21,– 57.6.120.0/21.

• if all of them use the same outgoing line, can they be aggregated? Is do, to what ? If not, why not?

Page 36: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 36

Solution• Address/mask Next hop• 57.6.96.0/22 00111001 00000110 01100000 00000000 x.x.x.x• 57.6.104.0/21 00111001 00000110 01101000 00000000 x.x.x.x• 57.6.112.0/21 00111001 00000110 01110000 00000000 x.x.x.x• 57.6.120.0/21 00111001 00000110 01111000 00000000 x.x.x.x

• The highlighted bits are the same, i.e. the first 19 bits are the same for all the addresses. Also as all of them have the same next hop, it is possible to aggregate them into the following entry:

• • Address/maskNext hop• 57.6.96.0/19 x.x.x.x

Page 37: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 37

Complex

• The set of IP addresses from 29.18.0.0 to 19.18.128.255 has been aggregated to 29.18.0.0/17. However, there is a gap of 1024 unassigned addresses from 29.18.60.0 to 29.18.63.255 that are now suddenly assigned to a host using a different outgoing line. Is it now necessary to split up the aggregate address into its constituent blocks, add the new block to the table, and then see if any reaggregation is possible? If not, what can be done instead?

Page 38: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 38

Solution

• It is sufficient to add one new table entry: 29.18.0.0/22 for the new block.

• If an incoming packet matches both 29.18.0.0/17 and 29.18.0.0./22, the longest one wins.

• This rule makes it possible to assign a large block to one outgoing line but make an exception for one or more small blocks within its range.

Page 39: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 39

Complex• A router has the following (CIDR) entries in its routing table:

– Address/mask Next hop– 135.46.56.0/22 Interface 0– 135.46.60.0/22 Interface 1– 192.53.40.0/23 Router 1– default Router 2

• For each of the following IP addresses, what does the router do if a packet with that address arrives?

(a) 135.46.63.10 (b) 135.46.57.14 (c) 135.46.52.2 (d) 192.53.40.7(e) 192.53.56.7

Page 40: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 40

Solution

(a) 135.46.63.10• 135.46.63.10 - 10000111 00101110 00111111 00001010• 255.255.252.0 11111111 11111111 11111100 00000000

AND• 135.46.60.0 10000111 00101110 00111100 00000000

Page 41: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 41

Solution

(c) 135.46.52.2• 135.46.52.2 10000111 00101110 00110100 00000010• 255.255.252.0 11111111 11111111 11111100 00000000

AND• 135.46.52.0 10000111 00101110 00110100 00000000

• It doesn’t matches any entry, so it’s forwarded to the one defined in default entry, namely, Router 2.

Page 42: Example and Solution on Internet Protocol , Sub-netting, Super-netting

04/11/2023 Computer Engineering Department - MEFGI 42

HomeworkUse Dijkstra’s shortest-path algorithm to compute the shortest path from x to all network nodes.