1 of 15

IPv4 Addressing

Dariusz Dwornikowski,

Andrzej Stroiński

2 of 15

Problems

  • How to address computers in the Internet ?
  • How to assign networks ?
  • What is IP mask ?

3 of 15

IPv4 Address

  • 4 bytes block (32 bits)
  • Hierarchical - the first part is a network number, the second one - computer number

Example:

001110010001010 01110111001000111

Network part

Computer part

4 of 15

Decimal Notation

  • every byte -> decimal number
  • four blocks delimited by "."

00111001 00010100 11101110 01000111

57 . 20 . 238 . 71

byte range - 0 (00000000) - 255 (11111111)

5 of 15

Special addresses - network address

not only computers but also network has its own address

Network address - the computer part of an address is filled with zeroes (0)

Example:

Assuming 16 bits comp. part:

150.254.0.0

1001011011111110000000000000000

Assuming 8 bit comp. part:

192.168.1.0

11000000101010000000000100000000

6 of 15

Special addresses - broadcast address

The computer part of an address is filled with ones (1)

Any packet sent to this address will be received by all computers in a network.

Example:

Assuming 16 bits comp. part:

150.254.255.255

1001011011111111111111111111111

Assuming 8 bit comp. part:

192.168.1.255

11000000101010000000000111111111

7 of 15

IP address mask

  • defines proportion between the network number and the computer number
  • used to calculate network address from a computer address by AND operation
  • masks (hides) computer number in an IP address
  • it should be always present with an IP address
  • 32 bits long, block of ones and block of zeroes
  • shorter notation - \n, where n is the number of ones (1) in an IP address

8 of 15

IP address mask

Example:

11111111111111110000000000000000

255.255.0.0

/16

For an IP address the network part will be 16 bits long, so we have 16 bit for computer addressing.

9 of 15

Calculating network address

  • ANDing IP address and mask

Example:

computer address: 150.150.10.10 /16

mask: 255.255.0.0

10010110 10010110 00001010 00001010

AND .......

11111111 11111111 00000000 00000000

Net. addr 10010110 10010110 00000000 00000000

150.150.0.0/16

10 of 15

Calculating the addressing range

network address: 150.150.0.0/16

10010110 10010110 00000000 00000000

10010110 10010110 00000000 00000001

10010110 10010110 00000000 00000010

...

10010110 10010110 11111111 11111110

10010110 10010110 11111111 11111111

Net. address: 150.150.0.0/16

Computers : 150.150.0.1 -150.150.255.254

Bcast : 150.150.255.255

Network address

1st computer

Broadcast address

11 of 15

Public addresses

Addressing in the Internet needs to meet two requirements:

  1. Unique network address
  2. Unique computer address within the network

First requirement - regional institutions controlled by IANA regulate assigning of IP networks.

Second requirement must be met by the administrator.

12 of 15

Private addresses

  • Not all addresses need to be unique
  • Small allocation space of IPv4
  • NAT

Private address - no registration, not routable in the Internet.

10.0.0.0/8 (old class A)

172.16.0.0/12 (old class B)

192.168.0.0/16 (old class C)

13 of 15

Public addresses

14 of 15

Classful Allocation (historical)

  1. Initially the only mask possible was 16

This was inefficient and dropped fast.

2. Classful addressing divided address space into classes

A - big networks, most significant bit 0, min. mask /8

B - medium, most significant bits 10, min.mask /16

C - small, most significant bits 110, min. mask /24

D - multicast, 1110

E - reserved (now given away)

15 of 15

Exercises:

  1. Display your IP address (Linux ip a, Windows ifconfig). Calculate number of ones in the mask and the network address.
  2. Give a formula for the number of computers in a network with a known mask length (n).
  3. Calculate computer range and broadcast address for 150.150.64.0/255.255.192.0