LECTURE # 20
IP ADDRESSING
Binary
2
All digital electronics use a binary
method for communication.
Binary can be expressed using only two
Converting Binary to
Decimal
3
First, moving from right to left, create a
chart that starts at the decimal number 1 and then double it 7 times.
Converting Binary to
Decimal
4
Given a binary number, place the number
under the chart (right justified).
128 64 32 16 8 4 2 1
1 0 1 1 0 0 1 1
•Add the numbers together to arrive at a final decimal amount.
Converting Decimal to
Binary
5
Find the largest number that is equal to
or less than the number you are
converting to binary. If our example
number is 220, the largest number that is equal to or less than 220 is 128. Place a 1 under that space on the chart.
Converting Decimal to
Binary
6
Next, subtract that number from the
original decimal number. Subtracting 128 from 220 gives us 92.
Repeat this process until we have a
subtracted result of 0.
128 64 32 16 8 4 2 1
Counting in Binary
7
0 + 1 = 1
1 + 1 = 10 (carry the 1)
10 + 1 = 11
11 + 1 = 100
100 + 1 = 101
101 + 1 = 110
Binary Counting Chart
8
1 1 11 1011
2 10 12 1100
3 11 13 1101
4 100 14 1110
5 101 15 1111
6 110 16 10000
7 111 17 10001
8 1000 18 10010
9 1001 19 10011
Addressing Principles
9
Logical addresses in TCP/IP are 32 bits in
length.
To make addressing more humanly
manageable, the 32 bits are broken into four 8 bit octets.
We separate the octets by using a period
Dotted-decimal notation
TCP/IP Host
11
A host is a device that has a network
interface card connected to a network.
If a device has two network interfaces, it
should be considered two separate hosts.
Each host that is attached to a TCP/IP
TCP/IP Addresses
13
IP Addresses divided into two parts
(network address and host address) :
Network ID or Net ID
Analogous to a street address.
Host ID
Analogous to a house or building number.
TCP/IP Addresses are hierarchical addresses
Example 1
Example 1
Change the following IP addresses from binary notation to dotted-decimal notation.
a. 10000001 00001011 00001011 11101111
b. 11111001 10011011 11111011 00001111
Solution
Solution
We replace each group of 8 bits with its equivalent decimal number and add dots for separation:
a. 129.11.11.239
b. 249.155.251.15
Example 2
Example 2
Change the following IP addresses from dotted-decimal notation to binary notation.
a. 111.56.45.78
b. 75.45.34.78
Solution
Solution
We replace each decimal number with its binary equivalent
a. 01101111 00111000 00101101 01001110
b. 01001011 00101101 00100010 01001110
In classful addressing, the address
space is divided into five classes: A, B,
C, D, and E.
Note
Note
:
:
Finding the class in binary notation
Finding the address class
Example 3
Example 3
Find the class of each address:
a. 000000001 00001011 00001011 11101111
b. 111111110011 10011011 11111011 00001111
Solution
Solution
a. The first bit is 0; this is a class A address.
b. The first 4 bits are 1s; this is a class E address.
Finding the Class in decimal Notation
Example 4
Example 4
Find the class of each address: a. 227.12.14.87
b. 252.5.15.111 c. 134.11.78.56
Solution
Solution
a.The first byte is 227 (b/w 224 and 239); the class is D. b.The first byte is 252 (b/w 240 and 255)the class is E. c.The first byte is 134 (b/w 128 and 191); the class is B.
Example
22
A 00001010 00000010 00000000 00100101 B 10101100 00010000 00001010 00000001 C 10000001 00110100 00000110 00000001
Solution
A 10.2.0.37
B 172.16.10.1
Netid and Hostid
Class A Address
24
First bit will always be a 0.
Remaining bits can be either 0s or 1s.
Range of first octet is 00000001 to
01111111
Network addresses cannot be all 0s. 127 is reserved for loopback testing.
126 valid Class A network addresses
Host ID Portion
25
Cannot be all 0s
If host portion is all 0s, represents a
network address.
Cannot be all 1s
If host portion is all 1s, represents a
Blocks in class A
Class B Address
27
First two bits will always be a 10.
Remaining bits can be either 0s or 1s.
Range of first octet is 10000000 to
10111111
Range of networks 128.0.y.z to
191.255.y.z
Blocks in class B
Class C Address
29
First three bits will always be a 110.
Remaining bits can be either 0s or 1s.
Range of class C addresses is
11000000.x.y.z to 11011111.x.y.z 192.0.0.z to 223.255.255.z.
2,097,152 valid Class C network
Blocks in class C
Class D Address
31
First octet in binary is defined as
1110xxxx, replacing x’s with whatever we wish.
Range of Class D addresses is from
224.x.y.z to 239.x.y.z.
Used for multicasting – method of
Class E Address
32
First octet is 1111xxxx, replacing x’s
with whatever we wish.
Address ranges from 240.x.y.z to
255.x.y.z.
Experimental address range that is not
A network address is different from a
netid. A network address has both
netid and hostid,
with 0s for the hostid.
Note
Note
:
:
Network address
Example 5
Example 5
Given the address 23.56.7.91, find the network address.
Solution
Solution
The class is A. Only the first byte defines the netid. We can find the network address by replacing the hostid bytes (56.7.91) with 0s. Therefore, the network address is 23.0.0.0.
Example 6
Example 6
Given the address 132.6.17.85, find the network address.
Solution
Solution
The class is B. The first 2 bytes defines the netid. We can find the network address by replacing the hostid bytes (17.85) with 0s.
Therefore, the network address is 132.6.0.0.
Example 7
Example 7
Given the network address 17.0.0.0, find the class.
Solution
Solution
The class is A because the netid is only 1 byte.
Addressing Guidelines
38
Network ID Cannot Be 127
127 is reserved for lookback functions
Network ID and Host ID Cannot Be 255 (All Bits Set to 1)
255 is a broadcast address
Network ID and Host ID Cannot Be 0 (All Bits Set to 0)
0 means “this network only”
Example: 145.20.0.0 refers to Class B network 145.20.0.0
Assigning Network IDs
39
1
1 22 33
124.x.y.z
124.x.y.z 192.121.73.192.121.73.zz 131.107.131.107.y.zy.z
Assigning Host IDs
40 Router Router 124.0.0.27 124.0.0.27 124.0.0.28 124.0.0.28 124.0.0.29 124.0.0.29 131.107.0.27 131.107.0.27 131.107.0.28 131.107.0.28 131.107.0.29 131.107.0.29 192.121.73. 1 192.121.73. 1 124.0.0.1124.0.0.1 192.121.73. 2
192.121.73.
2
131.107.0.1 131.107.0.1
124.x.y.z
124.x.y.z 192.121.73.192.121.73.zz 131.107.0.131.107.0.zz
1
Address Class Summary
41 [[ Number Number of Networks of Networks Number Number of Networks of Networks 126 126 16,384 16,384 2,097,152 2,097,152Number of Hosts Number of Hosts
per Network per Network Number of Hosts
Number of Hosts
per Network per Network 16,777,214 16,777,214 65,534 65,534 254 254 Class A Class A Class A Class A Class B Class B Class B Class B Class C Class C Class C Class C Range of Range of Network IDs Network IDs (First Octet) (First Octet) Range of Range of Network IDs Network IDs (First Octet) (First Octet)
1 – 126
1 – 126
128 – 191
128 – 191
192 – 223
Reserved IP Addresses
42
Defined in RFC 1918.
Class A
10.0.0.0 to 10.255.255.255
Class B
172.16.0.0 to 172.31.255.255
Class C
192.168.0.0 to 192.168.255.255
Reserved IP Addresses
43
169.254.0.0 to 169.254.255.255
used for operating systems that
44
Europe :
194.0.0.0 – 195.255.255.255
North America:
198.0.0.0 – 199.255.255.255
Central & South America:
200.0.0.0 – 201.255.255.255
Asia & Pacific:
202.0.0.0 – 203.255.255.255