1 Real Networkers don’t use Decimal! Part 1. Binary & Interpreting IP Addresses October 19, 2004
2 Understanding Binary Computers, networks and network addressing schemes use the binary number system. Number systems are based on “powers of” the base number. Binary is based on powers of 2. The powers of 2 table is a powerful tool for network designers.
3 Counting in Binary
4 Powers of 2 powerdecimalbinary , , , , , , , POWER Example 2 3 = 8 decimal = 1000 binary Notice 3 zeros.
5 Powers of 2, continued powerdecimalbinary 17131, , , ,048, ,097, ,194, ,388, ,777, ,554, ,108, ,217, ,435, ,870, ,073,741, ,147,483, ,294,967, ’s
6 Conversion from Binary to Decimal Decimal value is determined by the total value of bits. Each bit position value is some power of 2
7 Conversion sample Add the value of each bit position containing a one. = = 877
8 Conversion sample Add the value of each bit position containing a one. = = 898,925
9 Key Points of IP addressing 32 bits addressing allows 4,294,967,295 possible addresses. Not feasible to keep track of 4.3 trillion routes to individual hosts. Separating the address into Network Bits and Host bits allows a single network address to summarize information for many hosts Network Bits Host bits
10 Identifying networks A network address represents a way to connect to many hosts. One Class A network address connects 16,777,215 hosts One Class C network connects 255 hosts. Network addresses are identified by setting the host bits to 0 in an IP Address is a Class C network is a host on that network
11 Three types of IP addresses Network Address:Host bits all 0 ’s Broadcast Address:Host bits all 1 ’s Host Address:at least one 0 & one is a network address is the broadcast address for that network is a host address on that network. All 0’s All 1’s
12 Address Ranges 32 bits on every device Class A: 8 network bits, 24 host bits, starts 0… Class B: 16 network bits, 16 host bits, starts 10… Class C: 24 network bits, 8 host bits, starts 110… Does this address identify a host or a network?
13 Address Ranges Class D: Multicast, starts 1110… and are used by OSPF Class E: Reserved, starts 1111… Classes D & E are not important in CCNA1.
14 Address Ranges in Decimal Class A (127 is local loopback) Class B Class C Class D Class E
15 Special Address Ranges Private Class A Private Class B Private Class C Local Loopback Automatic Private IP Addressing
16 Notation Scheme IP: 32 bit binary number for all addresses Reading and writing 32 bits of binary is too hard! Converting all 32 bits to Decimal is too tedious Break 32 bits into 4 groups of 8 bits called octets Dotted Decimal notation converts octets to decimal A notation scheme is merely a way of representing the bits in an address, it is for convenience – networking is based on the bits not the notation!
17 Sample Address in bits Without breaking it down into octets = 2,893,753,464 too hard to do correctly
18 Sample Address, dotted decimal Same address using octets easy to add up each octet ● ● ● = in dotted decimal notation
19 Sample Address Network & Host Bits Begins 10… so it is a Class B address with the first 16 bits representing the network in dotted decimal. This is the host on the network.
20 Subnetting begins! In A, B, & C networks, boundary between network and host bits always on an octet boundary Subnetting: some host bits are converted to subnet bits One octet may have both subnet & host bits.
21 How many subnets? has three subnet bits. Represents just one subnet. When 3 bits are used for subnetting, how many possible subnets may be created? Lets list them. Subnet #BitsSubnet #Bits subnets Notice that when the bits are converted from binary to decimal, you get the subnet number!
22 Possible subnets in Binary 3 bits are borrowed in a Class B network SN# 0: SN# 1: SN# 2: SN# 3: SN# 4: SN# 5: SN# 6: SN# 7: Subnet number is decimal of subnet bits
23 Possible subnets in Dotted Decimal 3 bits are borrowed from a class B network SN# 0: SN# 1: SN# 2: SN# 3: SN# 4: SN# 5: SN# 6: SN# 7:
24 Some Addresses on a Subnet ( ) and ( ) are both hosts on the ( ) network. What address type is ( ) ?
25 The Formula! 3 bits can provide for 8 possible subnets, 4 bits can provide for 16 possible subnets. What is the rule? # of Possible Subnets = 2 Number of subnet bits The Powers of 2 table again!
26 Why a mask is necessary A 32 bit address may be interpreted many ways /16 (no subnet) /19 (subnetted using 3 bits) /21 (subnetted using 5 bits) IP address is meaningless without a mask!
27 Masking Subnet mask: every network bit is 1 and every host bit is 0. Binary Address: Binary Mask: Dotted Decimal Address: Dotted Decimal Mask: This is the default mask of a class B network.
28 Masking a 3 bit Subnet Network, Subnet, & Host Bits Binary Address: Binary Mask: Prefix: count 1’s 19 Dotted Decimal Address: Dotted Decimal Mask: Prefix: /19 The mask does not distinguish between network and subnetwork bits!
29 Masking a 4 bit Subnet Network, Subnet, & Host Bits Binary Address: Binary Mask: Dotted Decimal Address: Dotted Decimal Mask: Prefix: /_ _ Only 9 possible mask values: 0, 128, 192, 224, 240, 248, 252, 254 and 255
30 How many subnet bits? A mask has only network and host bits. The number of subnet bits must be calculated. Number of subnet bits = Number of actual mask network bits – Number of default (class) mask network bits
31 Example Subnet bits calculation. Address: Mask: or / Address begins 10… so it is a Class B address which has a /16 default mask. 20 mask bits – 16 default mask bits = 4 subnet bits
32 How a Mask works. The IP address and the mask are ANDed to determine the network address. 0 AND 0 = 0 0 AND 1 = 0 1 AND 0 = 0 1 AND 1 = 1 The mask acts as a filter which keeps only the network bits, sets all others to 0.
33 Sample Mask Application What is the network address of Address: Mask: or / Apply the mask: Network Address: AND Applying a Mask to an IP address leaves the network address!
34 Determining the Broadcast Address for a network Start with a network address and mask ( ) ( ) Apply the mask; network bits remain unchanged! Set all host bits to 1’s Put them together and you have the broadcast address is the broadcast address for the /20 network The mask is necessary!
35 Interpreting IP Addresses To get the network address from a specific host address and mask. 1. Convert Address and Mask to binary 2. AND the Address and Mask to get the Network Address 3. Convert the Network Address to decimal
36 Determining a Broadcast address To get the broadcast address from a specific network address and mask. 1. Convert Network Address and Mask to binary 2. Use the Mask to identify the network and host bits 3. Copy the network bits from the Network Address and make the remaining host bits all 1’s. 4. Convert to dotted decimal.
37 HAPPY NETWORKING!