Overview
NetDB supports classless IP addressing, also known as variable length subnet masking. These sets of addresses are called "address spaces". One or many address spaces may be grouped into a Network record which corresponds with an actual network. For example, the Ivory Tower building has one network which contains 2 address spaces -- 171.64.60.0/24 (the regular address space) and 172.24.60.0/24 (private address space).
Address Space Notation
Address spaces are generally specified with 2 parameters:
- Network Number - first address in the address space
Example: 171.64.60.10, 128.12.75.2, 172.24.60.10 - Subnet mask or Network Prefix Length - determines size of address space by specifying division between network ID and host ID
- subnet mask
32 bit number expressed as 4 decimal numbers separated by dots
examples: 255.0.0.0, 255.255.0.0 - network prefix length
front slash with decimal number specifying how many bits are in the network ID
sometimes called "slash notation"
examples: /24, /23
- subnet mask
Subnet Mask | Prefix Length | Addresses |
---|---|---|
255.255.252.0 | /22 | 1024 |
255.255.254.0 | /23 | 512 |
255.255.255.0 | /24 | 256 |
255.255.255.128 | /25 | 128 |
255.255.255.192 | /26 | 64 |
255.255.255.224 | /27 | 32 |
255.255.255.240 | /28 | 16 |
255.255.255.248 | /29 | 8 |
Given a subnet mask, here's how to figure out address space size:
- Convert subnet mask to binary
- Count number of zeros
- Raise 2 to this power, This number gives you the available addresses.
- The first address in an address space is the network address and cannot be used as a host address.
- The last address in an address space is the broadcast address and cannot be used as a host address.
- At Stanford, the standard is to use the first available host address as the router address.
- The total available host addresses is 3 less than the total available addresses
Given a network prefix length, here's how to figure out address space size:
- Subtract network prefix length from 32
- Raise 2 to this power
- The first address in an address space is the network address and cannot be used as a host address.
- The last address in an address space is the broadcast address and cannot be used as a host address.
- At Stanford, the standard is to use the first available host address as the router address.
- The total available host addresses is 3 less than the total available addresses
Example 1 - Network # = 36.53.0.0, Subnet Mask = 255.255.255.0
In binary, 255.255.255.0 = 11111111.11111111.11111111.00000000. Note that there are 24 ones followed by 8 zeros. The transition between 1's and 0's marks the division between the network ID and the host ID. Therefore, in IP address 36.53.0.2, 36.53.0 is the network ID and 2 is the host ID. The first address in this address space is 36.53.0.0 (because it's the network number). The following addresses are:
36.53.0.1
36.53.0.2
36.53.0.3
..
36.53.0.254
36.53.0.255 (as last address, reserved for broadcast address)
Note that the number of addresses in this address space is 256 or 2 to the 8th power. The first address (network address) and the last address (broadcast address) are reserved for special purposes which leaves 256-2 = 254 addresses for actual computers.
Using the formula above:
- 255.255.255.0 = 11111111.11111111.11111111.00000000
- 255.255.255.0 has 8 zeros
- 2 to the 8th power is 256 addresses which is the size of the address space
- 36.53.0.0 is the network address
- 36.53.255.255 is the broadcast address
- 36.53.0.1 is the router address
- The number of available host address is 256-3=253.
Example 2 - Address Space = 171.64.20.0/23
Using the formula above:
- 32-23=9
- 2 to the 9th power is 512 addresses
- 171.64.20.0 is the network address
- 171.64.21.255 is the broadcast address
- 171.64.20.1 is the router address
- The number of available host addresses is 512-3 = 509.