1. Computer Networks
IP addressing
Course Title: Computer Networks
Instructor: Tahira Malik (Lecturer)
Email Address: tahira@uosahiwal.edu.pk
Department of Computer Science
Term (Semester): Fall 2020
1
3. Binary
2
◻ All digital electronics use a binary method for
communication.
◻ Binary can be expressed using only two values: 0
or 1.
4. 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.
128 64 32 16 8 4 2 1
5. 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.
•128 + 32 + 16 + 2 + 1 = 179
6. 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.
128 64 32 16 8 4 2 1
7. 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
1 1 0 1 1 1 0 0
10. 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 symbol –
135.87.252.57. This is referred to as dotted
decimal notation.
12. 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 network
must have a unique TCP/IP address.
14. TCP/IPAddresses
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/IPAddresses are hierarchical addresses (combination
of location ID and host ID) as opposed to flat addresses
(e.g. MAC address).
15. 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
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
14
16. 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
We replace each decimal number with its binary
equivalent
a. 01101111 00111000 00101101 01001110
b. 01001011 00101101 00100010 01001110
15
17. In classful addressing, the address
space is divided into five classes: A, B,
C, D, and E.
Note:
16
20. Example 3
Find the class of each address:
a. 00000001 00001011 00001011 11101111
b. 11110011 10011011 11111011 00001111
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.
19