0% found this document useful (0 votes)
5 views72 pages

Lecture 4 - IP Address

The document provides an overview of IP addresses, specifically focusing on IPv4, which is a 32-bit numerical representation used to identify devices on a network. It explains the structure of IP addresses, the concept of classful addressing, and the division of IP addresses into netid and hostid. Additionally, it includes examples and exercises related to converting between binary and decimal notations, identifying address classes, and understanding network addresses and masks.

Uploaded by

Tamim Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views72 pages

Lecture 4 - IP Address

The document provides an overview of IP addresses, specifically focusing on IPv4, which is a 32-bit numerical representation used to identify devices on a network. It explains the structure of IP addresses, the concept of classful addressing, and the division of IP addresses into netid and hostid. Additionally, it includes examples and exercises related to converting between binary and decimal notations, identifying address classes, and understanding network addresses and masks.

Uploaded by

Tamim Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 72

CSE 233

Computer Networks
Lecture 4 – IP Address

1
IP (Internet Protocol) Address
An IP address is a numerical representation that uniquely identifies a specific
device/interface on the network.

2
• An IP (in IPv4) address is a 32-bit address.

• For convenience, it is usually written in dotted decimal format.


3
Structure of IP
• IP addresses consist of four sections/octet.

• Each section is 8 bits long.

• Each section can range from 0 to 255

For example:
128.35.0.72

4
IP Address Space
addr1 ………….. …………..
addr15
addr2 ………….. ………
…………..
addr41 addr226
addr31
………….. …………..

For N-bit IP address,


the address space is 2N
The address space of IPv4 is
232
or
4,294,967,296.
Binary Notation

01110101 10010101 00011101 11101010


Dotted-decimal notation
Hexadecimal Notation

0111 0101 1001 0101 0001 1101 1110 1010

75 95 1D EA

0x75951DEA
Example 1

Change the following IP address from binary notation to


dotted-decimal notation.
10000001 00001011 00001011 11101111

Solution

129.11.11.239
Example 2

Change the following IP address from dotted-decimal


notation to binary notation.
111.56.45.78

Solution

01101111 00111000 00101101 01001110


Example 3

Find the error, if any, in the following IP address:


111.56.045.78

Solution

There are no leading zeroes in dotted-decimal notation


(045).
Example 4

Find the error, if any, in the following IP address:


75.45.301.14

Solution

In dotted-decimal notation, each number is less than or


equal to 255; 301 is outside this range.
Example 5

Change the following IP addresses from binary notation to


hexadecimal notation.
10000001 00001011 00001011 11101111

Solution

0X810B0BEF or 810B0BEF16
Classful Addressing
A, B, C, D, E Classes
Figure: Occupation of the address space
In classful addressing,
the address space is
divided into five classes:
A, B, C, D, and E.
Figure: Finding the class in binary notation
Figure: Finding the address class
Example 5

How can we prove that we have 2,147,483,648 addresses in


class A?

Solution

In class A, only 1 bit defines the class. The remaining 31 bits


are available for the address. With 31 bits, we can have 231 or
2,147,483,648 addresses.
Example 6
Find the class of the address:
00000001 00001011 00001011 11101111

Solution

The first bit is 0. This is a class A address.


Example 7
Find the class of the address:
11000001 10000011 00011011 11111111

Solution

The first 2 bits are 1; the third bit is 0.


This is a class C address.
Figure: Finding the class in decimal notation
Example 8

Find the class of the address:


227.12.14.87

Solution

The first byte is 227 (between 224 and 239);


the class is D.
Example 9

Find the class of the address:


193.14.56.22

Solution

The first byte is 193 (between 192 and 223);


the class is C.
Parts of IP Address
• An IP address is divided into two parts: netid and hostid.

➢Netid: The part of an IP address that identifies the network.

➢Hostid: The part of an IP address that identifies a host in a network.

• The netid and hostid are of varying lengths, depending on the class of
the address.
Figure: Netid and hostid
Blocks in class A
Millions of class A addresses
are wasted.
Blocks in class B
Many class B addresses
are wasted.
Blocks in class C
The number of addresses in
a class C block
is smaller than
the needs of most organizations.
Class D addresses
are used for multicasting;
there is only
one block in this class.
Class E addresses are reserved
for special purposes;
most of the block is wasted.
Network Addresses
The network address is the first address.

The network address defines the network to the


rest of the Internet.
Given the network address, we can find the
class of the address, the block, and the range of
the addresses in the block
In classful addressing,
the network address
(the first address in the block)
is the one that is assigned
to the organization.
Example 9

Given the network address 17.0.0.0, find the class, the block,
and the range of the addresses.

Solution

The class is A because the first byte is between 0 and 127.


The block has a netid of 17.
The addresses range from 17.0.0.0 to 17.255.255.255.
Example 10

Given the network address 132.21.0.0, find the class, the


block, and the range of the addresses.

Solution

The class is B because the first byte is between 128 and 191.
The block has a netid of 132.21.
The addresses range from 132.21.0.0 to 132.21.255.255.
Example 11

Given the network address 220.34.76.0, find the class, the


block, and the range of the addresses.

Solution

The class is C because the first byte is between 192 and 223.
The block has a netid of 220.34.76.
The addresses range from 220.34.76.0 to 220.34.76.255.
Mask
A mask is a 32-bit binary number that gives the
first address in the block (the network address)
when bitwise ANDed with an address in the
block.
128 . 11 . 3 . 31

IP 10000000 00001011 00000011 00011111

Mask 11111111 11111111 00000000 00000000


Masking concept
AND operation
The network address is the
beginning address of each block.
It can be found by applying
the default mask to
any of the addresses in the block
(including itself).
It retains the netid of the block
and sets the hostid to zero.
Example 12

Given the address 23.56.7.91 and the default class A mask,


find the beginning address (network address).

Solution

The default mask is 255.0.0.0, which means that only the


first byte is preserved and the other 3 bytes are set to 0s.
The network address is 23.0.0.0.
Example 13

Given the address 132.6.17.85 and the default class B mask,


find the beginning address (network address).

Solution

The default mask is 255.255.0.0, which means that the first 2


bytes are preserved and the other 2 bytes are set to 0s.
The network address is 132.6.0.0.
Example 14

Given the address 201.180.56.5 and the class C default mask,


find the beginning address (network address).

Solution

The default mask is 255.255.255.0, which means that the first


3 bytes are preserved and the last byte is set to 0.
The network address is 201.180.56.0.
We must not
apply the default mask
of one class to
an address belonging
to another class.
Other Issues
Figure 4-12

Some special Address


Network addresses
Example of direct broadcast address
Example of limited broadcast address
Example of this host on this address
Example of specific host on this network
Example of loop back address
Some Exercises
2.Which of the following is true of the IP address 192.0.0.0

(a) The netid is 192


(b) The hostid is 0.10.
(c) The network address is 192.0.0.0
(d) The hostid is 0.0.10.
2.Which of the following is true of the IP address 192.0.0.0

ANS:
(c) The network address is 192.0.0.0
3.Which of the following is a source IP address

(a) This host on this network


(b) Limited broadcast address
(c) Loop back address
(d) Specific host on this network
3.Which of the following is a source IP address

ANS:
(a) This host on this network
Figure 4-12

Using the broadcast address, a -------- sends a packet to -------


on the network

(a) Host; all other hosts


(b) Router; all other hosts
(c) Host;a specific host
(d) Host;itself
Using the broadcast address, a -------- sends a packet to -------
on the network

ANS:
(b) Router; all other hosts
Using the limited broadcast address, a -------- sends a packet to -------
on the network

(a)Host; all other hosts


(b)Router; all other hosts
(c)Host;a specific host
(d)Host;itself
Using the limited broadcast address, a -------- sends a packet to -------
on the network

ANS:
(a) Host; all other hosts
Figure 4-12

1. The loopback address is used to send a packet from the ---- to------

(a)Host; all other hosts


(b)Router; all other hosts
(c)Host;a specific host
(d)Host;itself
1. The loopback address is used to send a packet from the ---- to------

ANS:
(d) Host; itself
What destination address can be used to send a packet from a host with IP
Address 188.1.1.1to all hosts on the network

(a) 188.0.0.0
(b) 0.0.0.0
(c) 255.255.255.255
(d) B and c
What destination address can be used to send a packet from a host with IP
Address 188.1.1.1to all hosts on the network

ANS:
(c) 255.255.255.255
A host can get its IP address from its server by using ------ as the source
Address and ----- as the destination address.

(a) 127.127.127.127. ;0.0.0.0


(b) 255.255.255.255. ;0.0.0.0
(c) 127.0.0.0; 255.255.255.255
(d) 0.0.0.0 ;255.255.255.255
A host can get its IP address from its server by using ------ as the source
Address and ----- as the destination address.

ANS:
(d)
0.0.0.0 ;255.255.255.255

You might also like