IP Address Subnetting

Classless Inter-Domain Routing

  • abandoning the classful approach (a mask can be shorter than the shortest mask allowed by the classful approach),
  • enforces allocation of addresses as per necessity — the term "a network of class XX" replaced by the term "CIDR address block," for which only mask length matters,
  • technology used with VLSM (variable length subnet masking),
  • technology, according to which Internet Service Providers (ISP) allocate addresses.
  • allows for shorter routing tables — row aggregation,

Problem:

  • A company has a single IP network address (public).
  • A company has several buildings, each with a LAN network.
  • How to design the networks within the company?
    • How to allocate addresses?
    • How to separate networks?

Division of networks into equal-sized subnetworks

Given a network IP address:

  • the network part has of length s bits (mask is /s)
  • the computer part is of length k bits (k = 32-s)

Division of a network into p (equal-sized) subnets, subnetwork address derivation:

  • "borrow" from the computer part of the address as many bits, as are needed to count p networks: ⌈log₂(p)⌉
  • use the "borrowed" bits to assign numbers to subnetworks
  • extend the network mask by ⌈log₂(p)⌉

We get ⌈log₂(p)⌉ subnetworks, where each subnetwork has a (correct) IP address:

  • each subnet has its own network and broadcast addresss
  • each network can have 2^(k - ⌈log₂(p)⌉) - 2 computers in it
  • each network mask is longer than the mask of the original network (s + ⌈log₂(p)⌉)

Vocabulary: subnetwork = subnet.

Example

Divide 150.10.0.0/16 into 4 subnets.

Fist subnet

All subnets

Subnet no.

Subnet address

Subnet mask

Subnet mask

Computer address range

Broadcast address

00

150.10.0.0

255.255.192.0

/18

150.10.0.1--150.10.63.254

150.10.63.255

01

150.10.64.0

255.255.192.0

/18

150.10.64.1--150.10.127.254

150.10.127.255

10

150.10.128.0

255.255.192.0

/18

150.10.128.1--150.10.191.254

150.10.191.255

11

150.10.192.0

255.255.192.0

/18

150.10.192.1--150.10.255.254

150.10.255.255

Network design

Division of networks into different-sized subnetworks

Problem:

  • a company has several buildings containing differing numbers of computers

Variable Length Subnet Masking (VLSM):

  • dividing a network into subnets that are described by different masks (with different address ranges)
  • modus operandi:
    • division into equal-sized network
    • division of one of the subnets into smaller subnets

Example

Divide the network 150.10.0.0/16 into:

  • 3 subnets containing 15 000 computers each, and
  • 4 additional subnets containing 4000 computers

Dividing 150.10.0.0/16 into 4 subnets with mask /18

Subnet no.

Subnet address

Subnet mask

Subnet mask

Computer address range

Broadcast address

00

150.10.0.0

255.255.192.0

/18

150.10.0.1--150.10.63.254

150.10.63.255

01

150.10.64.0

255.255.192.0

/18

150.10.64.1--150.10.127.254

150.10.127.255

10

150.10.128.0

255.255.192.0

/18

150.10.128.1--150.10.191.254

150.10.191.255

11

150.10.192.0

255.255.192.0

/18

150.10.192.1--150.10.255.254

150.10.255.255

Dividing 150.10.64.0/18 into 4 subnets with mask /20

Subnet no.

Subnet address

Subnet mask

Subnet mask

Computer address range

Broadcast address

00

150.10.64.0

255.255.240.0

/20

150.10.64.1--150.10.79.254

150.10.79.255

01

150.10.80.0

255.255.240.0

/20

150.10.80.1--150.10.95.254

150.10.95.255

10

150.10.96.0

255.255.240.0

/20

150.10.96.1--150.10.111.254

150.10.111.255

11

150.10.112.0

255.255.240.0

/20

150.10.112.1--150.10.127.254

150.10.127.255

Subnets

All subnets:
  • 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
  • Routers located outside the network only maintain one row in their routing table: the row contains only 150.10.0.0/16
  • Routes to subnets have to be remembered within all routers within the network 150.10.0.0/16

Applicability condition

Given a network 100.0.0.0/8 that contains routers R1 and R2 that find routes based on a dynamic routing protocol (eg. RIP)

Problem:
  • router R2 sends to R1 the information about network 100.192.0.0; what mask is R1 supposed to assume for this network?
  • solution: (the applicabiliy condition) -- network communication using IP must also contain the network mask

Network address aggregation

Routing table at R2:

destination

mask

gateway

200.1.0.0

/24

R1

200.1.1.0

/24

R1

200.1.2.0

/24

R1

...

...

...

200.1.15.0

/24

R1

200.1.16.0

/24

R3

200.1.17.0

/24

R3

200.1.18.0

/24

R3

...

...

...

200.1.31.0

/24

R3

Aggregation rules

Given a range of IP addresses:
  • find the longest common prefix of their network parts
  • shorten the mask and create a common network IP address (called supernet address or a CIDR address)
  • warning: a supernet cannot contain addresses from outside a given range

Example

Example -- finding the supernet address for router R2:

200.1.0.0/24

11001000.00000001.0000-0000.00000000

200.1.1.0/24

11001000.00000001.0000-0001.00000000

200.1.2.0/24

11001000.00000001.0000-0010.00000000

200.1.3.0/24

11001000.00000001.0000-0011.00000000

200.1.15.0/24

11001000.00000001.0000-1111.00000000

200.1.0.0/24

11001000.00000001.0001-0000.00000000

200.1.1.0/24

11001000.00000001.0001-0001.00000000

200.1.2.0/24

11001000.00000001.0001-0010.00000000

200.1.3.0/24

11001000.00000001.0001-0011.00000000

200.1.15.0/24

11001000.00000001.0001-1111.00000000

Supernet addresses:
  • 11001000.00000001.00000000.00000000200.1.0.0/20.
  • 11001000.00000001.00010000.00000000200.1.0.0/20.

Aggregation

New routing table for router R2:

destination

mask

gateway

200.1.0.0

/20

R1

200.1.16.0

/20

R3

Advantage: smaller routing table (faster lookup)

Aggregation impossible

Often addresses cannot be aggregated to a single supernet address.

Example: finding a CIDR address for the following network addresses:

  • 200.1.48.0/24
  • 200.1.49.0/24
  • ...
  • 200.1.79.0/24

200.1.48.0/24

11001000.00000001.0-0110000.00000000

200.1.49.0/24

11001000.00000001.0-0110001.00000000

...

...

200.1.63.0/24

11001000.00000001.0-0111111.00000000

200.1.64.0/24

11001000.00000001.0-1000000.00000000

200.1.65.0/24

11001000.00000001.0-1000001.00000000

...

...

200.1.79.0/24

11001000.00000001.0-1001111.00000000

Aggregation to a single address 200.1.0.0/17 would include nonexistent network addresses, e.g.: 200.0.127.0/24. Instead, we aggregate into two supernets.

200.1.48.0/24

11001000.00000001.0011-0000.00000000

200.1.49.0/24

11001000.00000001.0011-0001.00000000

...

...

200.1.63.0/24

11001000.00000001.0011-1111.00000000

Supernet: 200.1.48.0/20

200.1.64.0/24

11001000.00000001.0100-0000.00000000

200.1.65.0/24

11001000.00000001.0100-0001.00000000

...

...

200.1.79.0/24

11001000.00000001.0100-1111.00000000

Supernet: 200.1.64.0/20

Exercises

  1. Divide the network with an IP address of 200.10.20.0/24 into 8 subnets.
  2. Divide one of the subnets from the exercise above into four additional subnets.
  3. Aggregate the following network addresses:
    1. 202.1.0.0/24, 202.1.1.0/24, ..., 202.1.63.0/24
    2. 202.1.24.0/24, 202.1.25.0/24, ..., 202.1.39.0/24
  1. For the figure below assume as follows:

    Service provider R1 (named the same as router R1 for verisimilitude) has a CIDR address of 200.200.50.0/23. A part of the addresses within R1's available space is kept for R1's private use: this part must be sized sufficiently to allocate addresses to 100 devices. The remainder of R1's address space is given away to subcontrators: R2 and R4. R2 uses a part of the address space it was given to allocate 50 devices, and subcontracts the remainder to service provider R3. R3 uses the remainder of the space to create two separate networks, each containing 30 devices. R4 uses the address space it was given to create two networks containig 120 and 70 devices respectively.

    Propose an address scheme for all of the resulting subnets.

Extra materials

SpaceForward
Right, Down, Page DownNext slide
Left, Up, Page UpPrevious slide
POpen presenter console
HToggle this help