How you should design your Network Topology
Each device in network that operates at the third layer and needs to communicate with other devices (hosts), must have assigned its logical network address. This address is called an IP address in IP networks and its function is to identify a network, as well as specific hosts in it.
Therefore every IP address in the network must be unique. Designing and dividing of logical addresses for hosts in networks is called a logical design of networks.
Addressing at the Network Layer
As have already been mentioned above, devices at the network layer have assigned their own IP addresses. An address consists of 32 bits. These 32 bits are formatted for easier interpretation into four 8-bit blocks – octets.
Each of these octets is represented in decimal numeration system by a number from 0 to 255 and these numbers are separated by a dot. The most commonly used notation is in decimal, because this notation is most acceptable for human memory.
Another option is also a notation in hexadecimal or in binary numeration system. IP address , as defined in the RFC, consists of two parts: a net ID and a host ID. Furthermore, five address classes were defined.
The classes are identified by the most significant bits of an IP address. Their function is to determine how many bits are used to identify a network, how many remain for identification of a host and they indicate also the maximum count of hosts in network.
Class A is determined by the most significant bit which has value “0“. Together with the next 7 bits, so the whole first octet, identify the network, while the remaining three octets are used to identify a host in given network. The first octet of class A address of is represented by a decimal number from 0 to 127 (some values are reserved, see below). This class is suitable for a small number of extremely large networks with more than 16 million hosts.
Addresses of class B have always set the first 2 bits to value “10”. With the subsequent 14 bits identify a network. The remaining 16 bits are then used to determine a host. IP addresses from this class have in the first octet a decimal number from 128 to 191. They were assigned to large networks with more than 65 000 nodes and the number of such networks was still insufficient.
The three most significant bits of Class C addresses have a constant value “110”. Together with the following 21 bits create net ID and the remaining only 8 bits, so the last octet, forms host ID. The number of networks with the IP address of this class is the most abundant, but as a host in network is identified only by the last octet, addresses of Class C are suitable just only for small-scale networks (up to 254 hosts).
The first four bits of Class D address are always set to the value “1110”. Therefore, the first octet is composed of numbers from 224 to 239. Since these addresses are reserved for multicast, they cannot be used in unicast communication.
The first four bits of IP addresses of Class E are all set to value “1”. Therefore, the first 8 bits may only compose number from 240 to 255 (in decimal). The count of such addresses is relatively large and all of them are reserved for research and future use. As a result of that, they are not used in the Internet.
Some IP addresses cannot be assigned to a host, since they are reserved for specific function. These are the addresses:
0.0.0.0 – this address is interpreted as an IP address of any network (known as Any network address), often used as the address of default gateway (default gateway is used when routing packets without known destination)
255.255.255.255 – broadcast IP address, which includes all the networks (known also as All network address)
127.X.X.X – each Class A address with the value of the first octet equal to 127 is reserved for testing purposes. For example sending a packet to receiver with IP address 127.0.0.1 can be done to test sending and receiving of packets without creating a network traffic, and this way verify the functionality of TCP/IP stack on that host.
Only zeros in host ID – it’s an IP address of given subnet 2 (also known as subnet ID).
Only ones in host ID – it’s a broadcast address of given subnet (also known as subnet broadcast), packets with this destination address will be delivered to all host in that network segment.
Public and Private IP Addresses
Each host connected to the Internet must have assigned a unique address within the Internet. Such IP address is called a public IP address.
To preserve the uniqueness of public IP addresses, they are only allocated on demand from internet service providers. In case the connection to the Internet is not required, we can use only private addresses in such network.
Private addresses are addresses that are not unique and as result, multiple networks can use the same IP addresses. These addresses are reserved for local or internal use.
If we want to connect such network to the Internet or to another private network, that shares the same address space, then the technique of translation private addresses to the public (Network Address Translation – NAT) is needed.
Use of private addresses where it is appropriated significantly saves public IP space. Therefore the following three ranges of address were allocated and specified for this purpose:
class A: range from 10.0.0.0 to 10.255.255.255,
class B: range from 172.16.0.0 to 172.31.255.255,
class C: range from 192.168.0.0 to 192.168.255.255.
In general, determination of net ID and host ID according to classes uses address space in very inefficient way. On one side, there are networks of class A, that are enormous extensive with more than 16 million addresses in each such network.
It is not very real to use all addresses in just one network. Just try to imagine a broadcast traffic that would occur in such network ! On the other side, there is a huge number of class C networks, but these are often insufficiently with limited number of usable addresses (equivalent for addresses in network that can be assigned to the hosts) up to 254.
Between these two classes there is a compromise: use of Class B networks. However they still provide much more IP addresses are usually used. Count of class B network is slightly higher than 16,000 and that is not sufficient for global needs at all.
This division into classes creates a paradox, when on one hand there is wastage of IP address and on the other hand there is lack of them. This problem had to be solved. Given that, a flexible allocation of IP addresses has been enabled to solve the problem at least partially.
A network mask has been defined and its function is to split IP address into net ID and host ID. It was not longer necessary to rely on the classes to identify net ID, because the network mask could have done it instead of them. In addition, waste of IP address has been reduced because the network mask has allowed to get approximately as big address space as is needed.
But actually, what is a network mask? According to RFC 950 which has defined it, the network mask is 32-bit value that clearly distinguish a net ID from a host ID in every IP address. The mask use bitwise multiplication for distinction.
All bits that identifies a network in an IP address are set to “1” in network mask. Likewise bits with value “0” in network mask characterizes part of IP address with host ID . The network mask can be written in several ways:
Binary notation – mask is written in binary numeration system, this notation is not very appropriate for human memory.
Decimal notation – the same format as decimal IP notation. The mask is written into four octets separated by dots.
Slash format – behind slash there is written a count of ones in network mask.
To sum up each host in the network must have assigned not only an IP address but also a network mask. This mask is either standard mask derived from class of IP address or constant or variable network mask assigned during subnetting.