You are on page 1of 29

Lecture 3: IP Addressing HCNA-01

Network Layer: IP Addressing

Engr. Usman Raza

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

Next Header Processing


6 Bytes 6 Bytes 2 Bytes 46-1500 Bytes 4 Bytes

DMAC SMAC Type Data FCS

IP 0x0800

• Prior to discarding frame, it is necessary to determine next set of instruction from


frame’s header.

• This information is extracted from the type field of the frame header.

• The key function of the frame is to determine whether the intended physical
destination has been reached, that the integrity of the frame has remained intact.

• The focus of this section will identify how data is processed following the discarding of
the frame headers and propagation of the remaining data to the Internet Protocol.
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 3: IP Addressing HCNA-01

IP Packet Header
20-60 Bytes

IP Data

0 16 31
Header DS Field Total Length
Version
Length

Identification Flags Fragment Offset


Message
Header Time to Live Protocol Header Checksum 20
Bytes
Source IP Address

Destination IP Address

IP Options

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

IP Addressing

Network Host

192.168.1 .1

11000000.10101000.00000001 .00000001

 The IP address identifies networks, and network hosts.

 Binary is the base numbering system used for IP addressing.

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

IPv4 Addressing: Fundamentals


• What is IPv4 Address?
– Your Digital Home.
– Logical Address.
– 32-bits long

• Why use them?


– To communicate with different hosts.

• What is “dotted.decimal.notation.format”?
– Four octets, each with a value ranging from 0 to 255.

• How to find your own IP address?


– Type “ipconfig” in command prompt (Windows)
– Type “ifconfig” in command terminal (Linux)
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 3: IP Addressing HCNA-01
IPv4 Addressing
Binary

6
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 3: IP Addressing HCNA-01

Subnet Masks
• Defines your neighborhood.
• Determine the network and hosts portion in an IP address.
• Inserts a dividing line between network and hosts.
• Subnet Mask Mechanism:
– 32 bits in IPv4 Address
– 32 bits in Subnet Mask
– Mask “on” bits = Network Portion on IP.

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

Subnet Mask
Network Host
192.168.1 0

11000000.10101000.000000001 00000000

Subnet
255.255.255 0

11111111.11111111.11111111 00000000

 Subnet masks distinguish between the binary values that


represent each (sub)network and those that represent each host.

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology,


Page 8 Topi
Lecture 3: IP Addressing HCNA-01

IP Addressing

Network Address

192.168.1 .0

11000000.10101000.00000001 .00000000

Broadcast Address

192.168.1 .255

11000000.10101000.00000001 11111111

 The upper and lower most host address values are reserved.

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

IPv4 Addressing
Organizations
• Internet Assigned Numbers Authority (IANA)
– Devised the hierarchical IP addressing structure

• Internet Corporation for Assigned Names and Numbers


(ICANN)
– A global, government-independent entity with overall responsibility for
the Internet.
– ICANN has effectively replaced IANA.

10
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 3: IP Addressing HCNA-01

Decimal, Binary and Hexadecimal

Format Value Range Base Value

Binary 0—1 2

Decimal 0—9 10

Hexadecimal 0—F 16

 Binary and Hexadecimal are common numbering systems used


within IP networks.

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

Binary vs. Decimal Conversion

Bit Order 1 1 1 1 1 1 1 1
Binary
Power 27 26 25 24 23 22 21 20

Binary 128 64 32 16 8 4 2 1

Decimal Binary Hexadecimal Decimal Binary Hexadecimal

0 00000000 00 9 00001001 09

1 00000001 01 10 00001010 0A

2 00000010 02 11 00001011 0B

3 00000011 03 12 00001100 0C

4 00000100 04 13 00001101 0D

5 00000101 05 14 00001110 0E

6 00000110 06 15 00001111 0F

7 00000111 07 … … …

8 00001000 08 255 11111111 FF

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

Binary Conversion

Network Host

Binary 11000000 10101000 00000001 00000001

27+26 27+25+23 20 20

Decimal 192 168 1 1

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

IP Address Classes
1.0.0.0~126.255.255.255

Class A 0 Network(8bit) Host (24bit)


Host (24bit)

128.1.0.0~191.254.255.255

Class B 10 Network (16bit) Host (16bit)

192.0.1.0~223.255.254.255
Class C 110 Network (24bit) Host (8bit)

224.0.0.0~239.255.255.255
Class D 1110 Multicast

240.0.0.0~255.255.255.254

Class E 1111 Experimental

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

Default Mask For Each Class

• Standard (default) subnet masks:


• Class A subnet mask is 255.0.0.0
• Class B subnet mask is 255.255.0.0
• Class C subnet mask is 255.255.255.0

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

CIDR (Classless Inter Domain Routing)


• In classless addressing (CIDR), variable-length blocks are used
that belong to no classes.
– We can have a block of 1 address, 2 addresses, 4 addresses, 128
addresses, and so on.
– One of the restrictions, as we discuss later, is that the number of
addresses in a block needs to be a power of 2.
• Prefix Length: Slash Notation
– In class full addressing we used fixed prefix(Subnet Mask) to determine
the class IP’s network and host portion.
– In CIDR, the prefix length or network bits length, n, is added to the
address, separated by a slash.

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

Some review Question


• What is equivalent of subnet mask \13 in dotted decimal
notation of subnet mask?

• Given an IP address 192.168.128.0 / 20:


– What is the equivalent subnet mask ?
– Total IPs in this block ?
– Network ID ?
– Broadcast Address ?
– Total valid ?
– Range ?

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

IP Communication
Host A Host B

192.168.1.1 192.168.2.1

192.168.1.2 192.168.2.2

Host C Host D

Network Host
192 168 1 0

192 168 2 0

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

Address Planning
IP Address 192 168 1 7

Subnet Mask 255 255 255 0

11000000 10101000 00000001 00000111


11111111 11111111 11111111 00000000

Network Address
(Binary) 11000000 10101000 00000001 00000000

Network Address 192 168 1 0

Host Addresses: 2n 256

Valid Hosts: 2n - 2 254

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

Scenario

IP Address 172 16 1 7

Subnet Mask 255 255 0 0

Network Address ? ? ? ?

Host Addresses: 2n ?

Valid Hosts: 2n - 2 ?

 Determine the network for the given IP address, and the


number of actual, and valid host addresses in the network.

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

Extracting Information from CIDR Address


• Given any address in the block, we normally like to know three
pieces of information about the block to which the address
belongs:
– The number of valid addresses in the block,
– The first address in the block, and
– The last address in the block.

• Example:
– 167.199.170.90/27
– 192.168.10.10/20

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

Addressing Limitations

192.168.2.0/24

192.168.1.0/24 20 Hosts

30 Hosts 192.168.3.0/24
10 Hosts

 Network design using the default subnet mask results in


address wastage.

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

VLSM Calculation
IP Address 192 168 1 7

Subnet Mask 255 255 255 128

11000000 10101000 00000001 00000111


11111111 11111111 11111111 10000000

11000000 10101000 00000001 00000000

Network Address 192 168 1 0

Host Addresses: 2n 128

Valid Hosts: 2n - 2 126

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

VLSM Case Scenario

20 Hosts

30 Hosts
10 Hosts

 Using only the network 192.168.1.0/24, implement VLSM for


the given number of hosts in each network segment.

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

IP Gateways

Host A L3 Host B
L2 L2

192.168.1.1 192.168.1.253 192.168.2.253 192.168.2.1

Host A Host B

L3 L3

192.168.1.1 L2 192.168.2.1

 Gateways use IP to forward packets between networks.

 Hosts may act as gateways between networks in a LAN.


Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 3: IP Addressing HCNA-01

IP Fragmentation

Host A Host B
L3

L2 L2

Header DS Field Total Length


Version
Length

Identification Flags Fragment Offset

Time to Live Protocol Header Checksum

Source IP Address

Destination IP Address

IP Options

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

Time To Live

Host A Host B

TTL=255 TTL=254 TTL=253

Header DS Field Total Length


Version
Length

Identification Flags Fragment Offset

Time to Live Protocol Header Checksum

Source IP Address

Destination IP Address

IP Options

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

Protocol Field
IP Data

0x06/0x11 TCP/UDP

0x01 ICMP

Header DS Field Total Length


Version
Length

Identification Flags Fragment Offset

Time to Live Protocol Header Checksum

Source IP Address

Destination IP Address

IP Options

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 3: IP Addressing HCNA-01

Summary
 What is the IP subnet mask used for?
 What is the purpose of the TTL field in the IP header?
 How are gateways used in an IP network?

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

You might also like