68
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 IP Addresses

IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

IP Addresses

Page 2: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

The IP addresses are unique.

An IPv4 address is a 32-bit address.

An IPv6 address is a 128-bit address.

Page 3: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

The address space of IPv4 is 232 or

4,294,967,296.

The address space of IPv6 is 2128

Page 4: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

IPv4 Notations:

1. Binary Notation

2. Dotted Decimal Notation

3. HexaDecimal Notation

Page 5: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

01110101 10010101 00011101 11101010

Binary Notation

Page 6: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Dotted-decimal notation

Page 7: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

0111 0101 1001 0101 0001 1101 1110 1010

Hexadecimal Notation

75 95 1D EA

0x75951DEA

Page 8: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

In classful addressing,

the address space is

divided into five classes:

A, B, C, D, and E.

Page 9: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Finding the class in binary notation

Page 10: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Finding the address class

Page 11: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Finding the class in decimal notation

Page 12: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Netid and hostid

Page 13: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Unicast, Multicast, and

Broadcast Addresses

Unicast communication is one-to-one.

Multicast communication is one-to-many.

Broadcast communication is one-to-all.

Page 14: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Blocks in class A

Page 15: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Blocks in class B

Page 16: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Blocks in class C

Page 17: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Class D addresses

are used for multicasting;

there is only

one block in this class.

Page 18: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Class E addresses are reserved

for special purposes;

most of the block is wasted.

Page 19: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

A 0.0.0.0 to 127.255.255.255

Netid : 1 Byte

Hostid : 3 Byte

(Leftmost bit =0 from 1

byte (8-1 = 7))

27 = 128 blocks

256 * 256 * 256

= 16,777,216

2,147,483,648

Class Range Total # of Networks

(blocks)

N1

Host Address

per Network

N2

Total # of

Address in

each class

N1*N2

B 128.0.0.0 to

191.255.255.255

Netid : 2 Byte

Hostid : 2 Byte

(Leftmost two bit =10

from 2 byte (16-2 =14))

214 = 16,384 blocks

256 * 256

= 65,536

1,073,741,824

C 192.0.0.0 to

223.255.255.255

Netid : 3 Byte

Hostid : 1 Byte

(Leftmost three bit =110

from 3 byte (24-3 =21))

221 = 2,097,152 blocks

256 536,870,912

D 224.0.0.0 to

239.255.255.255

Multicast address

(Leftmost Four bit =1110)

= 1 block

228 = 268,435,456

268,435,456

E 240.0.0.0 to

255.255.255.255

Reserved for future use

(Leftmost four bit = 1111)

=1 block

228 = 268,435,456

268,435,456

Total 2,113,666 232

=4,294,967,296

Page 20: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Network Addresses

The network address is the first address in the

block.

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

Page 21: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

In classful addressing,

the network address

(the first address in the block)

is the one that is assigned

to the organization.

Network address is not allocated to any

physical device.

Page 22: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

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.

Page 23: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

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.

Page 24: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

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.

Page 25: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Masking concept

Page 26: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

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.

Class Network Mask / Default Mask A 255.0.0.0

B 255.255.0.0

C 255.255.255.0

Page 27: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

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.

Page 28: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Network addresses

Page 29: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Private Addresses A number of blocks in each class are assigned

for private use. They are not recognized

globally. These blocks are depicted in Table.

Class Range Total# of Address

A 10.0.0.0 to 10.255.255.255 256 * 256 * 256 = 16,777,216

B 172.16.0.0 to 172.31.255.255 16 * 256 * 256 = 1,048,576

B 169.254.0.0 to 169.254.255.255 256 * 256 =65,536

C 192.168.0.0 to 192.168.255.255 256*256 = 65,536

Page 30: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Three-level Addressing : Subnetting TWO-LEVEL HIERARCHY

NETWORK HOST NUMBER

NETWORK SUBNET HOST NUMBER

THREE-LEVEL HIERARCHY

Page 31: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

A network with three levels of

hierarchy (subnetted)

Page 32: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Default mask and subnet mask

Page 33: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Example

What is the subnetwork address if the

destination address is 200.45.34.56 and the

subnet mask is 255.255.240.0?

Page 34: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Solution

11001000 00101101 00100010 00111000

11111111 11111111 11110000 00000000

11001000 00101101 00100000 00000000

The subnetwork address is 200.45.32.0.

Page 35: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

The number of subnets must be

a power of 2.

Page 36: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Example

A company is granted the site address

201.70.64.0 (class C). The company needs

six subnets. Design the subnets.

Solution

The number of 1s in the default

mask is 24 (class C).

Page 37: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Solution (Continued)

The company needs six subnets. This number

6 is not a power of 2. The next number that is

a power of 2 is 8 (23).

We need 3 more 1s in the subnet mask. The

total number of 1s in the subnet mask is 27

bits (24 + 3).

The total number of 0s is 5 (32 - 27). The

mask is

Page 38: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Solution (Continued)

11111111 11111111 11111111 11100000

or

255.255.255.224

The number of subnets is 8.

The number of addresses in each subnet

is 25 (5 is the number of 0s) or 32.

Page 39: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Subnetwork Subnetid

(3 bits)

Hostid

(5 bits)

Range

1 000 00000 to 11111 201.70.64.0 201.70.64.31

2 001 00000 to 11111 201.70.64.32 201.70.64.63

3 010 00000 to 11111 201.70.64.64 201.70.64.95

4 011 00000 to 11111 201.70.64.96 201.70.64.127

5 100 00000 to 11111 201.70.64.128 201.70.64.159

6 101 00000 to 11111 201.70.64.160 201.70.64.191

7 110 00000 to 11111 201.70.64.192 201.70.64.223

8 111 00000 to 11111 201.70.64.224 201.70.64.255

Page 40: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Example

Page 41: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Supernetting

Supernetting combines multiple network

addresses into a single network address

In supernetting, bits from the network ID are

borrowed to be used as the host ID.

Supernetting decreases the number of networks

an organization can have, but increases the

number of hosts that can be on each network.

Page 42: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Comparison of subnet, default,

and supernet masks

Page 43: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

A supernetwork

Page 44: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Class Address Purpose

Network Address First address in block

Subnet work

address

First address in a sub network

Direct Broadcast

Address

Last address in block. used to send packet to all

hosts in a specific network.

E 255.255.255.255

Limited Broadcast

Address

Host used this address as a destination address, to

send message to every other host machine.

B Loop Back Address

127.0.0.0 to

127.255.255.255

Loopbacks are used for testing. An IP loopback is application-level testing. Allows the node to send test packet to itself without generating network traffic.

A 0.0.0.0

All Zero Address

Reserved for communication when host needs to

send an IPv4 packet but it does not know its own

address. Used during bootstrap time.

Special Addresses

Page 45: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Classless Addressing

In classless addressing, the prefix defines

the network and the suffix defines the

host.

The prefix length in classless addressing

can be 1 to 32.

There is only one condition on the number

of addresses in a block; it must be a power

of 2 (2, 4, 8, . . .).

Page 46: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Variable-length blocks

Page 47: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Slash notation

Page 48: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Slash notation is also called

CIDR

(Class less Inter Domain Routing)

notation.

Page 49: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Example

A small organization is given a block with the beginning

address and the prefix length 205.16.37.24/29 (in slash

notation). What is the range of the block?

Solution

The beginning address is 205.16.37.24.

To find the last address we keep the first 29 bits

and change the last 3 bits to 1s.

Beginning:11001111 00010000 00100101 00011000

Ending : 11001111 00010000 00100101 00011111

There are only 8 addresses in this block.

Page 50: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

length of the suffix is 32 - 29 or 3.

So there are 23 = 8 addresses in this block.

If the first address is 205.16.37.24, the last address is

205.16.37.31 (24 + 7 = 31).

Page 51: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

A block in classes A, B, and C

can easily be represented in slash

notation as

A.B.C.D/ n

where n is

either 8 (class A), 16 (class B), or

24 (class C).

Page 52: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Example

What is the network address if one of the addresses is

167.199.170.82/27?

Solution

The prefix length is 27.

we must keep the first 27 bits as is and change the

remaining bits (32-27 = 5) to 0s.

The last byte is 01010010. Changing the last 5 bits

to 0s, we get 01000000 or 64.

The network address is 167.199.170.64/27.

Page 53: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Prefix Length

Page 54: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Two Level Addressing

In Class less addressing, the prefix defines the

network and suffix defines host.

Prefix = n bits suffix = 32 – n bits

Network Mask = First n bits set to 1s and rest

of the bits set to 0s.

Page 55: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

The number of addresses in the block =

N = 232 –n , n is prefix length

Last Address

= keep n bits(prefix bits) as it is and set 32-n

bits to 1s.

First Address

=(any address) AND (network mask)

Page 56: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Example

One of the addresses in a block is 110.23.120.24/20. Find

the number of addresses, the first address and the last

address in the block.

Solution

The prefix length is 20.

Network Mask = 255.255.240.0

Number of address = 232-20 = 210 = 4096

First Address = 110.23.112.0/20

Last Address = 110.23.127.255/20

Page 57: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

In classless addressing, the last

address in the block does not

necessarily end in 255.

Page 58: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Subnetting

Three level hierarchy can be created using sub netting.

Number of addresses in each sub network should be a

power of 2.

Page 59: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Example

An organization is granted the block 130.34.12.64/26.

The organization needs to have four subnets. What are the

subnet addresses and the range of addresses for each

subnet?

Solution

The suffix length is 6 (32 -26= 6).

Total number of addresses in the block is 64 (26).

4 subnet require = 2 bits from suffix.

Page 60: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

130.34.12.64/26

10000010 00100010 00001100 0100 0000

The subnet prefix is then /28.

Subnet Last byte

range

1 0100 0000

to 0100 1111

130.34.12.64/28 130.34.12.79/28

2 0101 0000

to 0101 1111

130.34.12.80/28 130.34.12.95/28

3 0110 0000

to 0110 1111

130.34.12.96/28 130.34.12.111/28

4 0111 0000

to 0111 1111

130.34.12.112/28 130.34.12.127/28

Page 61: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Example

Page 62: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Example

The address of a class B host is to be split into subnets with a 6-bit

subnet number. What is the maximum number of subnets and the

maximum number of hosts in each subnet? (GATE 2007)

(A)62 subnets and 262142 hosts.

(B) 64 subnets and 262142 hosts.

(C) 62 subnets and 1022 hosts.

(D) 64 subnets and 1024 hosts.

Page 63: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Example

The subnet mask for a particular network is 255.255.31.0. Which

of the following pairs of IP addresses could belong to this

network? (GATE 2003)

(A)172.57.88.62 and 172.56.87.233

(B) 10.35.28.2 and 10.35.29.4

(C) 191.203.31.87 and 191.234.31.88

(D) 128.8.129.43 and 128.8.161.55

Page 64: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Example

GATE 2008

If a class B network on the Internet has a subnet mask of

255.255.248.0, what is the maximum number of hosts per subnet?

(A)1022 (B) 1023 (C) 2046 (D) 2047

GATE 2012

Page 65: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Example

Suppose computers A and B have IP addresses 10.105.1.113 and

10.105.1.91 respectively and they both use the same net mask N.

Which of the values of N given below should not be used if A and

B should belong to the same network? (GATE 2010)

(A)255.255.255.0

(B) 255.255.255.128

(C) 255.255.255.192

(D) 255.255.255.224

Page 66: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

NAT: Network Address Translation

It provides mapping between the private and

universal (public/live/global) addresses.

It allows to use a set of private addresses for

internal communication and set of global

internet addresses for communication with the

rest of the world.

Page 67: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

NAT :

Page 68: IP Addresses · 2014-04-26 · McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 The IP addresses are unique. An IPv4 address is a 32-bit address. An IPv6 address is a 128-bit address

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000