Subnetting (1)

Review

IPv4 address classes

  • IP addresses are assigned to companies or organizations by IANA - Internet Assigned Numbers Authority (a non-profit American corporation).

  • The IANA assigns IPv4 addresses/networks to companies based on their size.

  • A very large company might receive Class A or B network (more hosts), while a small company might receive a class C network (less hosts).

  • This led to many wasted IP addresses.

Example 1:

  • Routers connect different networks. So the links at the left and right corners are separate Layer3 networks.

  • The network connecting the 2 routers is called point-to-point network. Eg: connection between offices in different cities.

  • We don't need a large address block. So Class C network is used.

  • Class C network has 256 addresses in the network.

  • As you can see, 252 addresses are wasted.

Example 2 :

  • A company needs IP addressing for 5000 end hosts.

  • A Class C netowrk does not provide enough address, so a Class B network must be assigned, which has around 65k addresses.

  • This will result in about 60k addresses being wasted.

When the internet was first created, the creators did not predict that the internet would become as large as it is today. The total IPv4 address space includes over 4 billion addresses, which was huge then. But now address space exhaustion is a problem.

CIDR

  • Classless Inter-Domain Routing.

  • The IETF (Internet Engineering Task Force) introduced CIDR in 1993 to replace 'classful' addressing system.

  • With CIDR, the requirements of Class A address to use /8 mask, Class B address to use /16 mask, Class C address to use /24 mask were removed.

  • This allowed larger networks to be split into smaller networks, allowing greater efficiency.

  • These smaller networks are called subnetworks or subnets.

  • CIDR allows us to use different prefix lengths.

/24 mask

  • 254 usable addresses.

  • 252 addresses will be wasted in a point-to-point network.

/30 mask

  • 4 total addresses and 2 usable addresses.

  • 203.0.113.0/30 (with a mask 255.255.255.252) is a subnet of a larger Class C network.

  • Address range : 203.0.113.0 to 203.0.113.3

  • First is the network address (.0/30) and the last is the broadcast address (.3/30).

  • The other 2 addresses which are usable can be assigned to the 2 routers.

  • The other addresses (203.0.113.4 to 203.0.113.255) in the address block are now available to be used in other subnets.

/31 mask

  • Valid and more efficient than /30 for point-to-point connections.

  • Mask: 255.255.255.254

  • Address range : 203.0.113.0 to 203.0.113.1

  • 0 usable addresses (after subtracting the network and broadcast addresses).

  • For point-to-point connection it is possible to use /31 mask.

  • No need for network and broadcast address in a dedicated point-to-point network.

  • The remaining addresses (203.0.113.2 to 203.0.113.255) in the address block are now available to be used in other subnets.

/32 mask

  • Mask : 255.255.255.255 (entire address is the network and no hosts).

  • Usable addresses = -1 (not possible).

  • You will probably never use a /32 mask to configure an actual interface.

  • Use : when you want to create a static route to one specific host (and not to a network).

CIDR notation

Dotted decimal maskNotationNo. of hosts

255.255.255.128

/25

128-2 = 126

255.255.255.192

/26

64-2 = 62

255.255.255.224

/27

32-2 = 30

255.255.255.240

/28

16-2 = 14

255.255.255.248

/29

8-2 = 6

255.255.255.252

/30

4-2 = 2

255.255.255.254

/31

2-2 = 0

255.255.255.255

/32

0

Subnetting example

  • Divide the network into 4 subnets that can accomodate the number of hosts required.

  • There are 45 hosts per network, including the router.

  • Each network has a network and broadcast address, so we need 47 addresses per subnet, which adds upto 188 hosts.

  • Since 192.168.1.0/24 is a Class C network, there are 256 addresses and we will be able to assign 4 subnets to accomodate all hosts without a problem.

  • We need 4 equal sized subnets with enough room for at least 45 hosts.

  • /27 subnet doesn't provide enough address space (30 usable addresses) and /26 provides more addresses than we need (62 usable addresses), so you'll go with /26 subnet.

  • We can't always make subnets have exactly the number of addresses you want. There might be some unused address space (have some room for growth anyway).

Continued : Subnetting (2)

Subnet 1 : 192.168.1.0/26 to 192.168.1.63/26

Subnet 2 : 192.168.1.64/26 to 192.168.1.127/26

Subnet 3 : 192.168.1.128/26 to 192.168.1.191/26

Subnet 4 : 192.168.1.192/26 to 192.168.1.255/26

Last updated