CyberLab TCP/IP and IP Addressing & Subnetting

Embed Size (px)

Citation preview

Introduction to Computer Networking

Introduction to Computer NetworkingIP Addressing and subnetting

www.cyberlabzone.com

www.cyberlabzone.com

1

In This Session. . . .IP addressing Reserved addressesNetwork identityHost identitySubnetworkingSubnet masks2

www.cyberlabzone.com

2

Internet Layer - IP AddressesHierarchical addressing scheme32 bit addressDotted decimal notationUsed for addressing and routingDivided into 2 main sectionsNetwork identityHost identity3

www.cyberlabzone.comIP version 44 bytes divided into 4 sectionsEach section can range from 0 to 255If any portion of the IP address contains a number greater than 255 it is ILEGAL !Presented with dots in between 4 bytese.g. 193.60.61.24311000001.00111100.00111101.111100114

www.cyberlabzone.comFor subnetting use BINARYAlways work in BinaryAll solutions can be discovered in BinaryEventually you will see shortcutsUse Binary firstIt will take time to understandPractice makes perfect5

www.cyberlabzone.comAddress Classes (a history lesson)Classes A, B, C, D, E were createdIP numbers that began with : 1 to 126 are class A addresses128 to 191 are class B addresses 192 to 223 are class C addresses 224 to 239 are class D addresses 240 to 254 are class E addresses.6

www.cyberlabzone.comExercise 1 class identification To which class do the following IP numbers legally belong ? 193.45.67.12322.23.24.25131.74.59.12210.217.12,98193.260.50.177

www.cyberlabzone.com8Class C addressesFirst 3 bytes is network portionLast byte for hosts on networkHow many hosts can class C have ?C

www.cyberlabzone.comClass B addressesFirst 2 bytes is network portionLast 2 bytes for hosts on networkHow many hosts can class B have ?9

B

www.cyberlabzone.comClass A addressesFirst byte is network portionlast 3 bytes for hosts on networkHow many hosts can class A have ?

10A

www.cyberlabzone.comThe end of Address class systemClasses wasted addresses through inflexibilityA better way of dividing network space was soughtThis was known as Variable Length Subnet Masking or VLSMNow we have to explicitly show the boundary of the host and network portion of an address11

www.cyberlabzone.comCaveat to classless addressingMany people and textbooks still refer to the address class systemNo networks EVER use the class system in a production environmentBe aware of the translations between the classful and classless systemRemember ALWAYS to use the classless system despite the terminology of the question12

www.cyberlabzone.comSubnet Mask identifies the boundarySometimes called the Extended Network PrefixIdentifies the two sections of the IP address, network and host fieldsUsed by routers to work out the network a particular host belongs toWritten either as dotted decimal or slash notation13

www.cyberlabzone.comSubnet Mask two notationsDotted decimal is one of the notations255.255.255.0In binary this is 11111111.11111111.11111111.00000000Slash is the second notationCount the number of 1sThere are 24 1sSo another way of expressing this subnet mask is /2414

www.cyberlabzone.comNetwork (or wire) AddressThis is the identity of the network and is used by routers to deliver packets across networksNo host is ever given this addressTo discover the network address, convert IP address from decimal to binaryReplace the host section with 0sConvert back to decimal15

www.cyberlabzone.comFinding the Network Identity175.13.155.121 /1610101111.00001101. 10011011. 01111001What address class was this ?Which is the host field ?Replace with 0sConvert back to dotted decimal

16

www.cyberlabzone.comBroadcast Address RFC 919Each network needs a broadcast addressNo host is ever given this addressA broadcast can message all hosts in a LANUseful when a host needs to find information without knowing exactly what other host can supply it e.g. ARPWhen a host wants to provide information to a large set of hosts in a timely manner

17

www.cyberlabzone.comFinding the Broadcast NumberSubstitute the host section of the binary version of the IP address with 1sConvert back to dotted decimalWhat is the broadcast address for the IP 175.13.155.121 /16

18

www.cyberlabzone.comReserved addressing numbersHost bits set to 0 are Network addressHost bits set to 1 are Broadcast address127 network numbers reserved for loopback127.0.0.1 is my NIC192.168.x.x & 172.16-31.x.x & 10.x.x.x are non-routable private addresses for NAT and private networks only defined in RFC 191819

www.cyberlabzone.comExercise 2Write the network & broadcast number

12.123.14.235 /24177.177.177.177 /16220.17.124.14 /24277.14.13.86 /3320

www.cyberlabzone.comHost numbers on networksOriginal assignment of classes wasted many IP addresses ( 3 bears problem )Class A for governments with 224 hostsClass B can have 65 534 hostsmore than most companies requireClass C can have 254 hostsless than most companies require21

www.cyberlabzone.comSubnetworkingSolution is to subdivide networksTake a network numberDivide it into smaller networksThese are called subnetworks (subnets)

22

www.cyberlabzone.comSubnettingTake a /24 (class C) address24 network bits & 8 host bitsCompany may need different departmentsWe can borrow bits from host field to augment network field

23

www.cyberlabzone.comSubnetting /24 (Class C) addresse.g. 198.234.125.011000110.11101010.01111101.00000000Write network number10111100.11101010.00000000.00000000Borrow 4 bits from host field10111100.11101010.00000000.000000004 bits remain for host identity30/09/201524

www.cyberlabzone.comSubnetted /24 (Class C)How many hosts does this allow on each subnet ?How many subnetworks can we use ?First and last subnet numbers are reservedFirst and last host numbers are reserved25

www.cyberlabzone.comMore SubnettingCan borrow 2 host bits minimumMaximum host bits that can be borrowed is all but the rightmost 2 bits of the IP addressWhy is this so ?

26

www.cyberlabzone.comCalculating subnet mask1. Express the subnetwork IP address in binary form2. Replace the network and subnet portion of the address with all 1s3. Replace the host portion of the address with all 0s4. Now convert the binary expression back to dotted-decimal notation27

www.cyberlabzone.comExample of subnet maskCalculate the subnet mask for the Subnetted class C address 199.177.166.34 that has borrowed 3 bits from the host field 11000111.10110001.10100110.0010001027 bits for network identity - substitute these 27 bits for 1sChange remaining 5 host bits to 0sConvert to dotted decimal255.255.255.22428

www.cyberlabzone.comExercise 3Calculate subnet masks for class B that has borrowed 4 bits from host field 155.233.2.13Calculate subnet masks for class C that has borrowed 5 bits from host field 200.123.23.3

29

www.cyberlabzone.comUse of Subnet MaskMask is ANDed with IP address of hostThis gives network identityCan now be used to route the message30

www.cyberlabzone.comExampleWhat is the network number for the IP address 199.177.166.34 given that the subnet mask is 255.255.255.224Convert to binaryAND both numbers togetherResult is network identity31

www.cyberlabzone.comExercise 3IP network address 213.72.83.0. You require at least 17 subnets. Calculate1. The required subnet mask2. The number of total subnets3. The number of available host IP per subnet4. The first four subnet addresses5. The valid range of host addresses for the first four subnets6. The Broadcast address for each subnet32

www.cyberlabzone.comConclusion3 Classes available, A, B, CStrictly not used any longer but well understoodFlexibility gained by subnettingSubnets concealed from outside networks using subnet masksMasks are ANDed with IP address of host to discover network identity33

www.cyberlabzone.comHosts on class AThere are a possible 224 = 16 777 216 combinations available for the last 24 bitsSubtract the two combinations that cannot be used as host addressesA class A address can have 16 777 216 - 2 = 16 777 214 different hosts34

www.cyberlabzone.com35Hosts on class BThere are a possible 216 = 65 536 combinations available for the last 16 bitsSubtract the two combinations that cannot be used as host addressesA class B address can have 65 536 - 2 = 65 534 different hosts

www.cyberlabzone.com36Hosts on class CThere are a possible 28 = 256 combinations available for the last 8 bitsSubtract the two combinations that cannot be used as host addressesA class B address can have 256 - 2 = 254 different hosts

www.cyberlabzone.comNetwork Address10101111.00001101. 00000000.00000000175.13.0.0

It means this network 37

www.cyberlabzone.comBroadcast number10101111.00001101. 11111111.11111111175.13.255.255Reaches all hosts on a networkWill not reach other hosts on different network

38

www.cyberlabzone.comClasses & numbers12.123.14.0 12.123.14.255 (looks like Class A)177.177.0.0 177.177.255.255 (Class B)220.17.124.0 220.17.124.255 (Class C)277.14.13.86 Illegal numberAnd illegal subnet mask

39

www.cyberlabzone.comSubnetted Class C 24 = 16 -2 = 14 hosts

24 = 16 subnetworksNote that 14 hosts x 16 subnets is less than 256Why is this ?40

www.cyberlabzone.comSubnet masks11111111.11111111.11110000.00000000255.255.240.0

11111111.11111111.11111111.11111000255.255.255.248

41

www.cyberlabzone.comNetwork mask discoveryConvert to dotted decimal199.177.166.32How many hosts on this subnet ?

42

www.cyberlabzone.comExercise 3Need 17 subnets. Calculate bits required for 17 subnets = 5Leaves 3 bits for host identity on subnetsWhen calculating the first four subnet addresses, you will begin with:00000000 = 000001000 = 800010000 = 1600011000 = 24

43

www.cyberlabzone.comExercise 3 contd3 bits for the host leaves 23 - 2 = 6 host addresses per subnetValid host range213.72.83.1 213.72.83.2213.72.83.3 213.72.83.4213.72.83.5 213.72.83.644

www.cyberlabzone.com

Thank You

www.cyberlabzone.com