Presentation is loading. Please wait.

Presentation is loading. Please wait.

Network Layer/IP Protocols 1. Outline IP Datagram (IPv4) NAT Connection less and connection oriented service 2.

Similar presentations


Presentation on theme: "Network Layer/IP Protocols 1. Outline IP Datagram (IPv4) NAT Connection less and connection oriented service 2."— Presentation transcript:

1 Network Layer/IP Protocols 1

2 Outline IP Datagram (IPv4) NAT Connection less and connection oriented service 2

3 3 IPv4 packet header

4 IPv4 Datagram Header Format 4 version of the IP protocol (4 BIts) IP header length (4 Bits) Low Delay, High Throughput, Reliability (8 Bits) length of header + payload (16 Bits) Unique packet id (16 Bits) “do not fragment” (FLAG) “more fragments” (FLAG) Specified in terms of “no of 8 bytes” (13 Bits)

5 5 Helps to limit the no. of hops or time spent in the network (8 Bits) Protocol name (TCP, UDP etc.) to whom pass the payload (8 Bits) 16 bit checksum, covers header only Source IP address Destination IP addressOptional information, such as source route Due to OPTIONS, the datagram header can be of variable length. So, one can not determine apriori where the data will start. Thus, unpredictable time to process the IP datagram. Hence, OPTIONS dropped in IPv6 IPv4 Datagram Header Format

6 In a case where a router receives a protocol data unit (PDU) larger than the next hop's MTU(Maximum Transmission Unit). MTU: Maximum amount of data that a Link-Layer frame can carry.routerprotocol data unit Each IP datagram is supposed to be encapsulated within the link-layer frame for transportation from one router to other. MTU sets the limit on length of an IP datagram. Also, along the given path: Different routers/links  Different link layer protocols  Different MTU (A PROBLEM) SOLUTION: It has either of two options if the transport is IPv4:IPv4 1.Drop the PDU and send an Internet Control Message Protocol(ICMP) message which indicates the condition Packet too Big.Internet Control Message Protocol 2.Fragment the IP packet and send it over the link with a smaller MTU. The Identification field, and Fragment offset field along with Don't Fragment & More Fragment flags in the IP protocol header are used for fragmentation and reassembly of IP datagram. 6 IP Fragmentation

7 1st fragment – 1480 bytes in the data field of the IP datagram. – identification = 777 – offset = 0 (meaning the data should be inserted beginning at byte 0) – flag = 1 (meaning there is more) 2nd fragment – 1480 byte information field – identification = 777 – offset = 185 (meaning the data should be inserted beginning at byte 8*185=1,480) – flag = 1 (meaning there is more) 3rd fragment – 1020 byte (=3980-1480-1480) information field – identification = 777 – offset = 370 (meaning the data should be inserted beginning at byte 8*370=2,960) – flag = 0 (meaning this is the last fragment) REASSEMBLY IS DONE AT THE END SYSTEM, NOT ROUTERS. 7

8 IP Addressing 8

9 An IP address is a 32-bit address An IP address is a 32-bit address The IP addresses are unique. The IP addresses are unique. The address space of IPv4 is 2 32 or 4,294,967,296. The address space of IPv4 is 2 32 or 4,294,967,296.

10 Dotted-decimal notation

11 0111 0101 1001 0101 0001 1101 1110 1010 Hexadecimal Notation 75 95 1D EA 0x75951DEA

12 Example 1 Change the following IP address from binary notation to dotted-decimal notation. 10000001 00001011 00001011 11101111 Solution 129.11.11.239

13 Example 2 Change the following IP address from dotted-decimal notation to binary notation. 111.56.45.78 Solution 01101111 00111000 00101101 01001110

14 Example 3 Find the error, if any, in the following IP address: 111.56.045.78 Solution There are no leading zeroes in dotted-decimal notation (045).

15 Example 3 (continued) Find the error, if any, in the following IP address: 75.45.301.14 Solution In dotted-decimal notation, each number is less than or equal to 255; 301 is outside this range.

16 CLASSFUL ADDRESSING

17 Finding the class in binary notation 2 31 2 30 2 29 2 28

18 Example 6 Find the class of the address: 00000001 00001011 00001011 11101111 Solution The first bit is 0. This is a class A address.

19 Example 6 (Continued) Find the class of the address: 11000001 10000011 00011011 11111111 Solution The first 2 bits are 1; the third bit is 0. This is a class C address.

20 Finding the class in decimal notation

21 Example 7 Find the class of the address: 227.12.14.87 Solution The first byte is 227 (between 224 and 239); the class is D.

22 Example 7 (Continued) Find the class of the address: 193.14.56.22 Solution The first byte is 193 (between 192 and 223); the class is C.

23 Example 8 In Example 4 we showed that class A has 2 31 (2,147,483,648) addresses. How can we prove this same fact using dotted-decimal notation? Solution The addresses in class A range from 0.0.0.0 to 127.255.255.255. We notice that we are dealing with base 256 numbers here.

24 Netid and hostid

25

26 Blocks in class A

27 Millions of class A addresses are wasted.

28 Blocks in class B

29 Many class B addresses are wasted.

30 Blocks in class C

31 The number of addresses in a class C block is smaller than the needs of most organizations.

32 Class D addresses are used for multicasting; there is only one block in this class.

33 Class E addresses are reserved for special purposes; most of the block is wasted.

34 Private IP address – 10.0.0.0/8 – 172.16.0.0/12 – 192.168.0.0/16

35 Special IP addresses Loopback IP address – 127.0.0.1 (127.0.0.0 to 127.255.255.255) Link-local address – 169.254.0.0 /16 Default route – 0.0.0.0 - 0.255.255.255 (0.0.0.0 /8)

36 Network Address The network address is the first address. The network address defines the network to the rest of the Internet. Given the network address, we can find the class of the address, the block, and the range of the addresses in the block

37 Example 9 Given the network address 17.0.0.0, find the class, and the range of the addresses. Solution The class is A because the first byte is between 0 and 127. The addresses range from 17.0.0.0 to 17.255.255.255.

38 Example 10 Given the network address 132.21.0.0, find the class, and the range of the addresses. Solution The class is B netid of 132.21.0.0 Addresses range from 132.21.0.0 to 132.21.255.255

39 Example 11 Given the network address 220.34.76.0, find the class, and the range of the addresses. Solution The class is C netid of 220.34.76.0 The addresses range from 220.34.76.0 to 220.34.76.255

40 Mask A mask is a 32-bit binary number that gives the first address in the block (the network address) when bitwise ANDed with an address in the block.

41 Example 12 Given the address 23.56.7.91 and the default class A mask, find the beginning address (network address). Solution The default mask is 255.0.0.0, which means that only the first byte is preserved and the other 3 bytes are set to 0s. The network address is 23.0.0.0.

42 Example 13 Given the address 132.6.17.85 and the default class B mask, find the beginning address (network address). Solution The default mask is 255.255.0.0, which means that the first 2 bytes are preserved and the other 2 bytes are set to 0s. The network address is 132.6.0.0.

43 Example 14 Given the address 201.180.56.5 and the class C default mask, find the beginning address (network address). Solution The default mask is 255.255.255.0, which means that the first 3 bytes are preserved and the last byte is set to 0. The network address is 201.180.56.0.

44 Sub-netting To reduce wastage of IP addresses in a block, sub-netting is used. Using host bits as network bit of a class-full IP address. 44

45 Sub-netting Q1. Find the network address 192.168.241.99/27 192.168.241.107/26 192.168.241.117/29 192.168.241.127/27

46 Question You are given a class B IP address 172.16.0.0. There is a need of 7 different networks. Find out the first and last IP address of each and subnet mask for each network. 46

47 Given IP address is of Class B, Default mask is /16 or 255.255.0.0 As required number of subnets are 7, to represent this we require 3 bits (2 3 =8) So number of bits required to borrow from host bits are 3. Total bits for network are now : 16(default for class B)+3 (borrowed from host bits)=19 47

48 8.8.3.0 (number of net bits in each octet) 11111111.11111111.11100000.00000000 255.255.224.0 (subnet mask) 172.16.0.0 (1 st address), 172.16.0.1 (1 st host) 172.16.00011111.11111110 (last host) 172.16.00011111.11111111 (last address), 48

49 When we find next address to broadcast that will be: 172.16.00011111.11111111 +1 -------------------------------------------------- 172.16.00100000.00000000 Next subnet’s 1 st address is 172.16.32.0 Last address of this subnet is 172.16.63.255 49

50 Subnet1 st AddressLast Address1 st hostLast hostNumber of host 1st172.16.0.0172.16.31.255172.16.0.1172.16.31.2542 13 -2 2 nd 172.16.32.0172.16.63.255172.16.32.1172.16.63.2542 13 -2 3 rd 172.16.64.0172.16.95.255172.16.64.1172.16.95.2542 13 -2 4 th 172.16.96.0172.16.127.255172.16.96.1172.16.127.2542 13 -2 5 th 172.16.128.0172.16.159.255172.16.128.1172.16.159.2542 13 -2 6 th 172.16.160.0172.16.191.255172.16.160.1172.16.191.2542 13 -2 7 th 172.16.192.0172.16.255.255172.16.192.1172.16.255.2542 13 -2 50

51 Example 1 What is the subnetwork address if the destination address is 200.45.34.56 and the subnet mask is 255.255.240.0?

52 Solution 11001000 00101101 00100010 00111000 11111111 11111111 11110000 00000000 000000000000 11001000 00101101 00100000 00000000 The subnetwork address is 200.45.32.0.

53 Example 2 What is the subnetwork address if the destination address is 19.30.84.5 and the mask is 255.255.192.0? Solution See Next Figure 5.6

54 Figure 5-6 Example 2

55 Figure 5-7 Comparison of a default mask and a subnet mask

56 The number of subnets must be a power of 2.

57 Example 3 A company is granted the site address 201.70.64.0 (class C). The company needs six subnets. Design the subnets. Solution The number of 1s in the default mask is 24 (class C).

58 Solution (Continued) The company needs six subnets. This number 6 is not a power of 2. The next number that is a power of 2 is 8 (2 3 ). We need 3 more 1s in the subnet mask. The total number of 1s in the subnet mask is 27 (24  3). The total number of 0s is 5 (32  27). The subnet mask is

59 Solution (Continued) 11111111 11111111 11111111 11100000 or 255.255.255.224 The number of subnets is 8. The number of addresses in each subnet is 2 5 (5 is the number of 0s) or 32. See Figure 5.8

60 Figure 5-8 Example 3

61 Example 4 A company is granted the site address 181.56.0.0 (class B). The company needs 1000 subnets. Design the subnets. Solution The number of 1s in the default mask is 16 (class B).

62 Solution (Continued) The company needs 1000 subnets. This number is not a power of 2. The next number that is a power of 2 is 1024 (2 10 ). We need 10 more 1s in the subnet mask. The total number of 1s in the subnet mask is 26 (16  10). The total number of 0s is 6 (32  26).

63 Solution (Continued) The mask is 11111111 11111111 11111111 11000000 or 255.255.255.192. The number of subnets is 1024. The number of addresses in each subnet is 2 6 (6 is the number of 0s) or 64. See Figure 5.9

64 Figure 5-9 Example 4

65 Variable-length subnetting 65

66 For a class C address 192.168.3.0 find out subnet mask for each of the block. 1.Block A: 62 hosts 2.Block B: 30 hosts Exercise 1

67 Ans 1 1.For the 62 hosts, required bits are 6 (2 6 ) 2.So 6 bits are required for host 3.Remaining bits (32-6=26) are representing network bits 4.192.168.3.00000000 5.For this block mask /26 67 Block1 st IP add1 st Host IP add Last IP add Last host IP add A3.03.13.633.62 B3.643.653.953.94

68 Figure 5-10 Variable-length subnetting For a class C address 192.168.3.0 find out subnet mask for each of the block.

69 69

70 Example 11 A small organization is given a block with the beginning address and the prefix length 205.16.37.24/29 (in slash notation). What is the range of the block? Solution The beginning address is 205.16.37.24. To find the last address we keep the first 29 bits and change the last 3 bits to 1s. Beginning:11001111 00010000 00100101 00011000 Ending : 11001111 00010000 00100101 00011111 There are only 8 addresses in this block.

71 Example 12 We can find the range of addresses in Example 11 by another method. We can argue that the length of the suffix is 32  29 or 3. So there are 2 3  8 addresses in this block. If the first address is 205.16.37.24, the last address is 205.16.37.31 (24  7  31).

72 A block in classes A, B, and C can easily be represented in slash notation as A.B.C.D/ n where n is either 8 (class A), 16 (class B), or 24 (class C).

73 Example 13 What is the network address if one of the addresses is 167.199.170.82/27? Solution The prefix length is 27, which means that we must keep the first 27 bits as it is and change the remaining bits (5) to 0s. The 5 bits affect only the last byte. The last byte is 01010010. Changing the last 5 bits to 0s, we get 01000000 or 64. The network address is 167.199.170.64/27.

74 Example 14 An organization is granted the block 130.34.12.64/26. The organization needs to have four subnets. What are the subnet addresses and the range of addresses for each subnet? Solution The suffix length is 6. This means the total number of addresses in the block is 64 (2 6 ). If we create four subnets, each subnet will have 16 addresses.

75 Solution (Continued) Let us first find the subnet prefix (subnet mask). We need four subnets, which means we need to add two more 1s to the site prefix. The subnet prefix is then /28. Subnet 1: 130.34.12.64/28 to 130.34.12.79/28. Subnet 2 : 130.34.12.80/28 to 130.34.12.95/28. Subnet 3: 130.34.12.96/28 to 130.34.12.111/28. Subnet 4: 130.34.12.112/28 to 130.34.12.127/28. See Figure 5.15 on next slide

76 Figure 5-15 Example 14

77 Example 15 An ISP is granted a block of addresses starting with 190.100.0.0/16. The ISP needs to distribute these addresses to three groups of customers as follows: 1. The first group has 64 customers; each needs 256 addresses. 2. The second group has 128 customers; each needs 128 addresses. 3. The third group has 128 customers; each needs 64 addresses. Design the sub-blocks and give the slash notation for each sub-block. Find out how many addresses are still available after these allocations.

78 Solution Group 1 For this group, each customer needs 256 addresses. This means the suffix length is 8 (2 8  256). The prefix length is then 32  8  24. Customer1: 190.100.0.0/24  190.100.0.255/24 Customer2: 190.100.1.0/24  190.100.1.255/24 ………………………………….. Customer64: 190.100.63.0/24  190.100.63.255/24 Total  64  256  16,384

79 Solution (Continued) Group 2 For this group, each customer needs 128 addresses. This means the suffix length is 7 (2 7  128). The prefix length is then 32  7  25. The addresses are: Customer1: 190.100.64.0/25  190.100.64.127/25 Customer2: 190.100.64.128/25  190.100.64.255/25 … Customer128: 190.100.127.128/25  190.100.127.255/25 Total  128  128  16,384

80 Solution (Continued) Group 3 For this group, each customer needs 64 addresses. This means the suffix length is 6 (2 6  64). The prefix length is then 32  6  26. The addresses are: Cust1: 190.100.128.0/26  190.100.128.63/26 Cust2: 190.100.128.64/26  190.100.128.127/26 … Cust128: 190.100.159.192/26  190.100.159.255/26 Total  128  64  8,192


Download ppt "Network Layer/IP Protocols 1. Outline IP Datagram (IPv4) NAT Connection less and connection oriented service 2."

Similar presentations


Ads by Google