Class C addresses uses the first three octets for network address and the final octet for the host ID. This Class provides the greatest number of Network addresses and fewer hosts. The massive jump between Class A, B and C is what lead to the developing of Subnetting which eliminates the need for classes and allows far more probabilities for network and host ranges.
Class D addresses are reserved for multicasting. This means that any data sent to these addresses will be forwarded to all interested receivers. The diagram to the right shows this. The red circle indicates multicast address and the green circles show the interested receivers.
This type of address has no set network number of host number.
Class E addresses are reserved for experimental purposes, and like Class D addresses, there are no set network or number of hosts.
Subnetting
Subnets are much more flexible with the number of digits used for the network ID or and host ID. This means that it is much more efficient way of using the 32 bits used in IPv4. This means that there is a much greater range of host device IPs instead of every network having 254, 65,000 or 16 million hosts.
The problem with class allocation is that when a network needs move over the available host IDs, even if only by one device, a higher class is assigned. An example would be a Class C address which has 254 devices but wishes to add 10 more. This means a Class B address is required. This means that 65,000 host IPs are available but only 264 are being used. This means that well over 64,000 IP host addresses are being wasted!
The second reason for subnetting is the large organisations that don’t want to have all of their hosts on one physical network. With the use of broadcast addresses; it’s possible to split the network down into much smaller physical networks with fewer hosts and still have the network work as a big network. Most of these networks are classed as supernets; which means they are subnetted outside of the usual classes– this is explained further in the next section. An excellent example of this is Google, and this is better explained in the example explained at the end of this document.
For Google to have a single physical network would cause it to be slow and clumsy, instead Google relies on many servers scattered across the world. Google searches are sent to a broadcast address which is passed forward to the relevant addresses.
Subnetting relies on subnet masks to distinguish between network and host.
These masks are 32 bits long and are made of 1s and 0s, just like the binary IP addresses. When the mask is applied over the IP address, wherever there is a 1 covering, this is the IP address.
An example:
A 12 bit mask: 11111111111100000000000000000000 covering an IP means that the first 12 bits are for the network ID and the other 20 bits are for host addresses.
For a router to determine the network ID, it must have both the IP address and subnet mask and then carry out an AND operation.
A subnet can be thought of as a block of IPs with a common network ID.
CIDR and Supernetting
Classless Inter-Domain Routing is simply a method of displaying how many bits the subnet mask contains. CIDR is the replacement for traditional classes – although domains with Classes can still be displayed in CIDR The table below shows the possible variations of using the different length masks. This will be useful later on in the Google subnetting example.
Subnet Restrictions
- The minimum number of network ID bits is always 8. All subnets must therefore start with 255 or 11111111.
- Maximum number of network ID bits is 30.
- 31 bit mask leaves only two options
- 1 would be the broadcast ID
- 0 would be the network ID
- This leaves no room for hosts!
Public and Private Address
Any device connected to the Internet needs a unique IP address. However, not every device is directly connected to the Internet such as those on independent LANs or those behind firewalls. For these devices special IPs are assigned that are unique on that network but not to the Internet.
This means that fewer IPs are needed internally and reduces the number of external IPs being used when they aren’t needed.
IPv6
Why? How?
NAT
Many network devices use Network Address Translation to hide the IPs from the outside world. This works through changing the public IP to the internal private ID when passing through the device.
This is one method of reducing the number of required public IP addresses, as each NAT device can use a single IP address for many hosts. This relies on the NAT device keeping track of requests sent out of the network and sending requested data back to that device.
Domain Name to IP
A Google Example
One of Google.com’s main servers IP addresses is 216.239.57.99 making it a class C address. This is easily found with a quick search of the web. Another search later and it’s easy to discover that Google uses a 19 bit subnet mask of 255.255.224.0. From this it is possible to calculate one of the ranges of addresses that Google uses.
To do this Google’s IP address needs to be converted into binary.
216.239.57.99 converted to binary is: (11011000.11101111.001)11001.01100011
255.255.224.0 converted to binary is: (11111111.11111111.111)00000.00000000
And this leaves us with: (11011000.11101111.001)00000.00000000
Note that there are 19 1’s in the mask – this means that those first 19 binary numbers are ‘masked’ off away from the others and therefore remain untouched. Everything outside of the brackets is knocked down to the default 0 to find the network IP.
When converted back to DDN we get 216.239.32.0. This is Google’s network address.
To find out the host addresses, the same thing is done again except with the mask inverted.
216.239.57.99 converted to binary is: 11011000.11101111.001(11001.01100011)
The inverted mask is 13 bits: 00000000.00000000.000(11111.11111111)
This leaves us: 00000000.00000000.000(11001.01100011)
Translated back to DDN, this is: 0.0.25.99. This is the number of hosts that Google has.
So now it is possible to see that Google’s server IP addresses start at 216.239.32.0 and that this particular server has a (theoretical) host IP of 0.0.25.99. This can be tested by adding 216.239.32.0 and 0.0.25.99 together, and sure enough this equals the original IP of 216.239.57.99.
The broadcast address for this subnet is 216.239.63.255. This is the top of this range of addresses and is reserved for this purpose. To find the broadcast address of this network, we take the network IP we found earlier (216.239.32.0) and apply the inverted subnet mask (0.0.31.255) and carry out an XOR calculation.
This is easily tested by carrying out a search for google.com online. The results are displayed below and show that the smallest possible address was the one first calculated and the biggest address is the broadcast address listed.
This is an and explanation,
XOR – compare two binary values. If just 1 of the values is 1 then the result is 1. If both are 1 or both are 0 then the result is 0.