Title: Real Networkers don’t use Decimal! Part 1.
1Real Networkers dont use Decimal! Part 1.
- Binary Interpreting IP Addresses
- October 19, 2004
2Understanding 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.
3Counting in Binary
- 0
- 1
- 10
- 11
- 100
- 101
- 110
- 111
- 1000
- 1001
- 1010
- 1011
- 1100
- 1101
- 1110
- 1111
4Powers of 2
2POWER Example 23 8 decimal 1000
binary Notice 3 zeros.
5Powers of 2, continued
32 0s
6Conversion from Binary to Decimal
- Decimal value is determined by the total value of
bits. - Each bit position value is some power of 2
7Conversion sample 1
- 1101101101
- Add the value of each bit position containing a
one.
8Conversion sample 2
- 11011011011101101101
- Add the value of each bit position containing a
one.
- 524288 262144 65536 32768 8192 4096
1024 512 256 64 32 8 4 1 898,925
9Key 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. 001011000111101110101
10001111011
Network Bits
Host bits
10Identifying 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. - 11011110 00100001 00000100 00000000 is a Class C
network - 11011110 00100001 00000100 00100100 is a host on
that network
11Three types of IP addresses
- Network Address Host bits all 0s
- Broadcast Address Host bits all 1s
- Host Address at least one 0 one 1
- 11011110 00100001 00000100 00000000 is a network
address. - 11011110 00100001 00000100 11111111 is the
broadcast address for that network. - 11011110 00100001 00000100 00100100 is a host
address on that network.
All 0s
All 1s
12Address Ranges
- 32 bits on every device
- 10101100 01111011 10101100 01111011
- Class A 8 network bits, 24 host bits, starts
0 - 00101100 01111011 10101100 01111011
- Class B 16 network bits, 16 host bits, starts
10 - 10101100 01111011 10101100 01111011
- Class C 24 network bits, 8 host bits, starts
110 - 11001100 01111011 10101100 01111011
Does this address identify a host or a network?
13Address Ranges
- Class D Multicast, starts 1110
- 11100110 01111011 10101100 01111011
- 224.0.0.5 and 224.0.0.6 are used by OSPF
- Class E Reserved, starts 1111
- 11110100 01111011 10101100 01111011
- Classes D E are not important in CCNA1.
14Address Ranges in Decimal
15Special Address Ranges
16Notation Scheme
- IP 32 bit binary number for all addresses.
- 10101100011110111010110001111011
- 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!
17Sample Address in bits
- Without breaking it down into octets
- 10101100011110110010110001111000
- 2,893,753,464 too hard to do correctly
18Sample Address, dotted decimal
- Same address using octets
- 10101100.01111011.00101100.01111000
- easy to add up each octet
- 128 32 8 4 ? 64 32 16 8 2 1
? 32 8 4 ? 64 32 16 8
- 172.123.44.120 in dotted decimal notation
19Sample Address Network Host Bits
- Begins 10 so it is a Class B address with the
first 16 bits representing the network. - 10101100.01111011.00101100.01111000
- 172.123.44.120 in dotted decimal.
- This is the 00101100.01111000 host on the
10101100.01111011 network.
20Subnetting begins!
- In A, B, C networks, boundary between network
and host bits always on an octet boundary. - 10101100.01111011.00101100.01111000
- Subnetting some host bits are converted to
subnet bits. - 10101100.01111011.00101100.01111000
- 172.123.44.120
- One octet may have both subnet host bits.
21How many subnets?
- 10101100 01111011 00100000 00000000 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.
22Possible subnets in Binary
- 3 bits are borrowed in a Class B network
- SN 0 10101100 01111011 000 00000 00000000
- SN 1 10101100 01111011 001 00000 00000000
- SN 2 10101100 01111011 010 00000 00000000
- SN 3 10101100 01111011 011 00000 00000000
- SN 4 10101100 01111011 100 00000 00000000
- SN 5 10101100 01111011 101 00000 00000000
- SN 6 10101100 01111011 110 00000 00000000
- SN 7 10101100 01111011 111 00000 00000000
23Possible subnets in Dotted Decimal
- 3 bits are borrowed from a class B network
- SN 0 172.123.0.0
- SN 1 172.123.32.0
- SN 2 172.123.64.0
- SN 3 172.123.96.0
- SN 4 172.123.128.0
- SN 5 172.123.160.0
- SN 6 172.123.192.0
- SN 7 172.123.224.0
24Some Addresses on a Subnet
- 10101100 01111011 00100000 00000001
(172.123.32.1) and - 10101100 01111011 00100010 00000000
(172.123.34.0) are both hosts on the - 10101100 01111011 00100000 00000000 (172.123.32.0
) network.
What address type is 10101100 01111011 01100010
00000000 (172.123.98.0) ?
25The Formula!
- 3 bits can provide for 8 possible subnets, 4 bits
can provide for 16 possible subnets. - What is the rule?
- of Possible Subnets 2Number of subnet bits
26Why a mask is necessary
- A 32 bit address may be interpreted many ways.
- 10101100 01111011 00101100 01111000
- 172.123.44.120/16 (no subnet)
- 10101100 01111011 00101100 01111000
- 172.123.44.120/19 (subnetted using 3 bits)
- 10101100 01111011 00101100 01111000
- 172.123.44.120/21 (subnetted using 5 bits)
- IP address is meaningless without a mask!
27Masking
- Subnet mask every network bit is 1 and every
host bit is 0. - Binary Address 10101100.01111011.00101100.0111100
0 - Binary Mask 11111111.11111111.00000000.00000000
- Dotted Decimal Address 172.123.44.120
- Dotted Decimal Mask 255.255.0.0
- This is the default mask of a class B network.
28Masking a 3 bit Subnet
- Network, Subnet, Host Bits
- Binary Address 10101100 01111011 00101100
01111000 - Binary Mask 11111111.11111111.11100000.00000000
- Prefix
- 11111111.11111111.111
- count 1s 19
- Dotted Decimal Address 172.123.44.120
- Dotted Decimal Mask 255.255.224.0
- Prefix /19
The mask does not distinguish between network and
subnetwork bits!
29Masking a 4 bit Subnet
- Network, Subnet, Host Bits
- Binary Address 10101100 01111011 00101100
01111000 - Binary Mask 11111111.11111111.11110000.00000000
- Dotted Decimal Address 172.123.44.120
- Dotted Decimal Mask 255.255.240.0
Prefix /_ _ - Only 9 possible mask values
- 0, 128, 192, 224, 240, 248, 252, 254 and 255
30How 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
31Example Subnet bits calculation.
- Address 172.123.44.120 10101100 01111011
00101100 01111000 - Mask 255.255.240.0 or /20 11111111.11111111.11110
000.00000000 - 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
32How 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.
33Sample Mask Application
- What is the network address of
- Address 172.123.44.120 10101100 01111011
00101100 01111000 - Mask 255.255.240.0 or /20 11111111.11111111.1111
0000.00000000 - Apply the mask
- 10101100 01111011 00101100 0111100011111111.1111
1111.11110000.0000000010101100 01111011 00100000
00000000 - Network Address 172.123.32.0
AND
34Determining the Broadcast Address for a network
- Start with a network address and mask
- 10101100 01111011 00100000 00000000
(172.123.32.0) - 11111111.11111111.11110000.00000000
(255.255.240.0) - Apply the mask network bits remain unchanged!
- 10101100 01111011 0010
- Set all host bits to 1s
- 1111 11111111
- Put them together and you have the broadcast
address - 10101100 01111011 00101111 11111111
- 172.23.47.255 is the broadcast address for the
172.123.32.0 /20 network
35Interpreting IP Addresses
- To get the network address from a specific host
address and mask. - Convert Address and Mask to binary
- AND the Address and Mask to get the Network
Address - Convert the Network Address to decimal
36Determining a Broadcast address
- To get the broadcast address from a specific
network address and mask. - Convert Network Address and Mask to binary
- Use the Mask to identify the network and host
bits - Copy the network bits from the Network Address
and make the remaining host bits all 1s. - Convert to dotted decimal.
37HAPPY NETWORKING!