1 of 22

IP addressing 2

Dariusz Dwornikowski,

Andrzej Stroiński

2 of 22

Problems

  • equal subnetting (RFC 950, 1985)
  • unequal subnetting (RFC 1009, 1987)
  • CIDR (RFC 1517-1520, 1993)

3 of 22

Subnetting

A company has been given one network address.

The company has 4 buildings.

How to allocate addresses ?

How to separate networks ?

The solution is to divide one network into few smaller ones.

4 of 22

Equal length subnetting

  • "borrow" bits from computer part to extend the network part
  • enumerate subnets in the borrowed part
  • calculate network address, range and broadcast for every new subnet
  • calculate new masks for new subnets

Network part

Computer part

Network part

Computer part

New network part

Borrowed bits

5 of 22

Example

Divide 150.10.0.0/16 into 4 subnets:

  • Decide how many bits we need to borrow to enumerate 4 subnets - 2 bits
  • Enumerate subnets with combinations on the borrowed bits

00 - the first one

01 - the second one

10 - the third one

11 - the fourth one

6 of 22

Example

Network part

Computer part 16 bits

Network part

Computer part 14 bits

- -

Two bits size

Before

After

7 of 22

Example: First subnet

  • Calculate network address
    • first 16 bits is untouched
    • the borrowed part 00
    • computer part : 14 zeroes
    • decimal: 150.10.0.0
  • Calculate new network mask
    • mask needs to be extended by two borrowed bits
    • new mask is 18 ones long
    • decimal: 255.255.192.0 or /18

Network part

Computer part (14 bits)

0 0

8 of 22

Example: First subnet

  • Calculate range
    • smallest computer number 00000000000001
    • decimal 150.10.0.1
    • largest comp. number 11111111111110
    • decimal 150.10.63.254
  • Calculate broadcast address
    • computer part filled with ones
    • decimal 150.10.63.255

9 of 22

Example

Subnet number

Address

Mask

Range

Bcast

00

150.10.0.0

255.255.192.0

150.10.0.1-150.10.63.254

150.10.63.255

01

150.10.64.0

255.255.192.0

150.10.64.1-150.10.127.254

150.10.127.255

10

150.10.128.0

255.255.192.0

150.10.128.1-150.10.191.254

150.10.191.255

11

150.10.192.0

255.255.192.0

150.10.192.1-150.10.255.254

150.10.255.255

10 of 22

Example: solution

11 of 22

Unequal subnetting (VLSM)

Variable Length Subnet Mask (VLSM)

  • We want some subnets smaller, some bigger

Solution: multiple subnetting, divide to smaller subnets, then divide these subnets again.

12 of 22

VLSM Example

Let's divide 150.10.64.0/18 into 4 more subnets.

Subnet number

Address

Mask

Range

Bcast

00

150.10.0.0

255.255.192.0

150.10.0.1-150.10.63.254

150.10.63.255

01

150.10.64.0

255.255.192.0

150.10.64.1-150.10.127.254

150.10.127.255

10

150.10.128.0

255.255.192.0

150.10.128.1-150.10.191.254

150.10.191.255

11

150.10.192.0

255.255.192.0

150.10.192.1-150.10.255.254

150.10.255.255

13 of 22

VLSM Example

150.10.0.0/18

150.10.128.0/18

150.10.192.0/18

150.10.64.0/20

150.10.80.0/20

150.10.96.0/20

150.10.112.0/20

This way routers outside 150.10.0.0/16 can have only one entry in their routing tables

Routes to subnets need to be handled inside the network (supernet).

14 of 22

VLSM - applicability condition

lets assume that routers R1 and R2 are using RIP algorithm in order to designate routing paths

used VSLM network is 100.0.0.0/8

Problem:

  • router R2 is sending message to router R1 with network address 100.192.0.0
  • what network mask address should router R1 use in order to handle this request?

Solution:

  • (applicability condition) - with each protocol message sent in the network, both addresses should be present: network address and mask address

15 of 22

VLSM usability condition

VLSM can only be used in routing protocols which announce IP address with its mask.

RIP v2

OSPF

EIGRP

16 of 22

CIDR (Classless Inter-Domain Routing)

  • classless (mask can be shorter than the min. mask in classful)
  • allows for aggregating network addresses into on supernet address
  • saving space in routing tables
  • used with VLSM
  • address ranges given according to demand
  • widely used

17 of 22

CIDR allocation

In classful allocation - small flexibility:

A class - /8 mask - over 16 million addresses

B class - /16 mask - 65536 addresses

C class - /24 mask - 256 addresses

CIDR allocates according to the need:

/27 - 32 addresses

/26 - 64 addresses

...

/13 - 524288 addresses

18 of 22

CIDR aggregation

  • given IP address range, find the longest matching sequence of bits
  • cut the remaining part and shorten the mask

Example:

200.1.0.0/24 11001000.00000001.000000 00.00000000

200.1.1.0/24 11001000.00000001.000000 01.00000000

200.1.2.0/24 11001000.00000001.000000 10.00000000

200.1.3.0/24 11001000.00000001.000000 11.00000000

Supernet address: 200.1.0.0/22

19 of 22

CIDR aggregation

dest

mask

gateway

dest

mask

gateway

20 of 22

CIDR aggregation

  • sometimes aggregation to only one address is not possible (it would include non-existing address)

Example:

200.1.48.0/24 - 200.1.79.0/24

Aggregates to:

200.1.48.0/20 for (200.1.48.0 - 200.1.63.0)

and

200.1.64.0/20 for (200.1.64.0 - 200.1.79.0)

first aggregation

second aggregation

21 of 22

Exercises:

  • Divide 200.10.20.0/24 to 8 equal subnets
  • Aggregate networks
    • 202.1.0.0/24 - 202.1.63.0/24
    • 202.1.24.0/24 - 202.1.39.0/24
  • For the diagram below, propose a network addressing, given the demands and a network address 200.200.50.0/23.

22 of 22

Diagram for ex. 3

R1

R2

R3

R4

200.200.50.0/23

100

120

70

50

30

30