Internet Protocol
Prof. Hemang Kothari
GATE Academy
Computer Engineering Department

2/20/2014

Computer Engineering Depar...
IP – Introduction
TCP

UDP

ICMP

IP

ARP

Network
Access

IGMP

Transport
Layer

Network
Layer

Link Layer

Media

2/20/2...
IP
• IP is the highest layer protocol which is implemented at both
routers and hosts
• IP provide provides an unreliable c...
IP Header

2/20/2014

Computer Engineering Department - MEFGI

4
Fundamentals
• Question: In which order are the bytes of an IP datagram
transmitted?
• Answer:
Transmission is row by row
...
Maximum Transmission Unit
• Maximum size of IP datagram is 65535, but the data link layer
protocol generally imposes a lim...
Complex
• Consider sending a 2400-byte datagram into a link that
has an MTU of 700 bytes. Suppose the original
Datagram is...
Solution
• The maximum size of data field in each fragment = 680 (because there
are 20 bytes IP header). Thus the number o...
Classes of IP

2/20/2014

Computer Engineering Department - MEFGI

9
Special IP

2/20/2014

Computer Engineering Department - MEFGI

10
Subnets

A campus network consisting of LANs for various departments.
Subnets (2)

A class B network subnetted into 64 subnets.
(Please note: For all subnetting questions, assume the ‘all-zero...
Review
• Convert the following decimal numbers to binary.
– 100, 254, 113, 66

• Convert the following binary numbers to d...
Answers
• 100: 01100100
• 254: 11111110
• 113: 01110001
• 66: 01000010
---------------------------------------------------...
Questions
You have the following address: 192.16.5.133/29
• How many total bits are being used to identify the
network, an...
Review – Subnetting
• A network on the
255.255.240.0. What is
handle?
• A network on the
255.255.224.0. What is
handle?

I...
Subnetting
• You currently use the default mask for your IP network
192.168.1.0. You need to subnet your network so that y...
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
f...
Answer
• Number of networks = 16
• Number of hosts = 14
• Full Range for first three networks:
– 192.168.1.0-15
– 192.168....
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...
Answer
• Number of networks = 64
• Number of hosts = 2
• Full Range for first three networks:
– 200.138.1.0-3
– 200.138.1....
Complex Problem
• A large number of consecutive IP address are available
starting at 198.16.0.0.
• Suppose that four organ...
Solution
• All the requests are rounded up to a power of two.
• The starting address, ending address, and mask are as foll...
Explanation
198.16.16.0 – 198.16.23.255 written as 198.16.16.0/21
Total no. of host we require 2000 that means 2000 / 256 ...
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....
Super-netting
• Rules:
• The number of blocks must be a power of 2
• The blocks must be contiguous in the address
space (n...
Supernetting
• A company needs 1000 addresses. Which of the
following set of class C blocks can be used to form a
supernet...
Solution
•
•
•
•

198.47.32.0
198.47.32.0
198.47.31.0
198.47.32.0

2/20/2014

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

2/20/2014

Computer Engine...
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 ...
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 pack...
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 ...
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 ...
Solution
• The supernet has 21 1s. The default mask has 24 1s.
Since the difference is 3, there are 8 blocks in this
super...
Classless Inter domain
• A router has just received the following new IP
addresses :
– 57.6.96.0/21,
– 57.6.104.0/21,
– 57...
Solution
•
•
•
•
•

Address/mask
57.6.96.0/22
57.6.104.0/21
57.6.112.0/21
57.6.120.0/21

00111001 00000110 01100000 000000...
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...
Solution
• It is sufficient to add one new table entry: 29.18.0.0/22
for the new block.
• If an incoming packet matches bo...
Complex
• A router has the following (CIDR) entries in its routing table:
–
–
–
–
–

Address/mask
135.46.56.0/22
135.46.60...
Solution
(a) 135.46.63.10
• 135.46.63.10 - 10000111 00101110 00111111 00001010
• 255.255.252.0 11111111 11111111 11111100 ...
Solution
(c) 135.46.52.2
• 135.46.52.2 10000111 00101110 00110100 00000010
• 255.255.252.0 11111111 11111111 11111100 0000...
Homework
Use Dijkstra’s shortest-path algorithm to compute the shortest path
from x to all network nodes.

2/20/2014

Comp...
Upcoming SlideShare
Loading in …5
×

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

6,898 views

Published on

Published in: Education
2 Comments
2 Likes
Statistics
Notes
No Downloads
Views
Total views
6,898
On SlideShare
0
From Embeds
0
Number of Embeds
41
Actions
Shares
0
Downloads
185
Comments
2
Likes
2
Embeds 0
No embeds

No notes for slide

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

  1. 1. Internet Protocol Prof. Hemang Kothari GATE Academy Computer Engineering Department 2/20/2014 Computer Engineering Department - MEFGI 1
  2. 2. IP – Introduction TCP UDP ICMP IP ARP Network Access IGMP Transport Layer Network Layer Link Layer Media 2/20/2014 Computer Engineering Department - MEFGI 2
  3. 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,…) 2/20/2014 Computer Engineering Department - MEFGI 3
  4. 4. IP Header 2/20/2014 Computer Engineering Department - MEFGI 4
  5. 5. Fundamentals • Question: In which order are the bytes of an IP datagram transmitted? • Answer: Transmission is row by row For each row: 1. First transmit bits 0-7 2. Then transmit bits 8-15 3. Then transmit bits 16-23 4. Then transmit bits 24-31 • This is called network byte order or big endian byte ordering. 2/20/2014 Computer Engineering Department - MEFGI 5
  6. 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) 2/20/2014 Computer Engineering Department - MEFGI 6
  7. 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? 2/20/2014 Computer Engineering Department - MEFGI 7
  8. 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. 2/20/2014 Computer Engineering Department - MEFGI 8
  9. 9. Classes of IP 2/20/2014 Computer Engineering Department - MEFGI 9
  10. 10. Special IP 2/20/2014 Computer Engineering Department - MEFGI 10
  11. 11. Subnets A campus network consisting of LANs for various departments.
  12. 12. 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.)
  13. 13. Review • Convert the following decimal numbers to binary. – 100, 254, 113, 66 • Convert the following binary numbers to decimal. – 10101010: – 00011100: – 11101110: – 01100111: 2/20/2014 Computer Engineering Department - MEFGI 13
  14. 14. Answers • 100: 01100100 • 254: 11111110 • 113: 01110001 • 66: 01000010 ---------------------------------------------------------------------------• 10101010: 170 • 00011100: 28 • 11101110: 238 • 01100111: 103 2/20/2014 Computer Engineering Department - MEFGI 14
  15. 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? 2/20/2014 Computer Engineering Department - MEFGI 15
  16. 16. Review – Subnetting • A network on the 255.255.240.0. What is handle? • A network on the 255.255.224.0. What is handle? Internet has a subnet mask of the maximum number of hosts it can Internet has a subnet mask of the maximum number of hosts it can
  17. 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? 2/20/2014 Computer Engineering Department - MEFGI 17
  18. 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. 2/20/2014 Computer Engineering Department - MEFGI 18
  19. 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 2/20/2014 Computer Engineering Department - MEFGI 19
  20. 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. 2/20/2014 Computer Engineering Department - MEFGI 20
  21. 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 2/20/2014 Computer Engineering Department - MEFGI 21
  22. 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. 2/20/2014 Computer Engineering Department - MEFGI 22
  23. 23. 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
  24. 24. Explanation 198.16.16.0 – 198.16.23.255 written as 198.16.16.0/21 Total 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) 00010001. (256) 00010010. (256) 00010011. (256) 00010100. (256) 00010101. (256) 00010110. (256) 00010111. (256) 16 + 4 +2 +1 = 23
  25. 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? 2/20/2014 Computer Engineering Department - MEFGI 25
  26. 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. 2/20/2014 Computer Engineering Department - MEFGI 26
  27. 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.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 2/20/2014 Computer Engineering Department - MEFGI 27
  28. 28. Solution • • • • 198.47.32.0 198.47.32.0 198.47.31.0 198.47.32.0 2/20/2014 198.47.33.0 198.47.42.0 198.47.32.0 198.47.33.0 198.47.34.0 198.47.52.0 198.47.62.0 198.47.33.0 198.47.52.0 198.47.34.0 198.47.35.0 Computer Engineering Department - MEFGI 28
  29. 29. Examples • We need to make a supernetwork out of 16 class C blocks. What is the supernet mask? 2/20/2014 Computer Engineering Department - MEFGI 29
  30. 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 00000000 or 255.255.240.0 2/20/2014 Computer Engineering Department - MEFGI 30
  31. 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.44 205.16.42.56 205.17.33.76 • Which packet belongs to the supernet? 2/20/2014 Computer Engineering Department - MEFGI 31
  32. 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 2/20/2014 Computer Engineering Department - MEFGI 32
  33. 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? 2/20/2014 Computer Engineering Department - MEFGI 33
  34. 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. 2/20/2014 Computer Engineering Department - MEFGI 34
  35. 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? 2/20/2014 Computer Engineering Department - MEFGI 35
  36. 36. Solution • • • • • Address/mask 57.6.96.0/22 57.6.104.0/21 57.6.112.0/21 57.6.120.0/21 00111001 00000110 01100000 00000000 00111001 00000110 01101000 00000000 00111001 00000110 01110000 00000000 00111001 00000110 01111000 00000000 Next hop x.x.x.x x.x.x.x x.x.x.x 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/mask Next hop • 57.6.96.0/19 x.x.x.x 2/20/2014 Computer Engineering Department - MEFGI 36
  37. 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? 2/20/2014 Computer Engineering Department - MEFGI 37
  38. 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. 2/20/2014 Computer Engineering Department - MEFGI 38
  39. 39. Complex • A router has the following (CIDR) entries in its routing table: – – – – – Address/mask 135.46.56.0/22 135.46.60.0/22 192.53.40.0/23 default Next hop Interface 0 Interface 1 Router 1 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 2/20/2014 Computer Engineering Department - MEFGI 39
  40. 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 2/20/2014 Computer Engineering Department - MEFGI 40
  41. 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. 2/20/2014 Computer Engineering Department - MEFGI 41
  42. 42. Homework Use Dijkstra’s shortest-path algorithm to compute the shortest path from x to all network nodes. 2/20/2014 Computer Engineering Department - MEFGI 42

×