is the output port to which the datagram has to be transmitted. The routing table can be constructed using simple or sophisticated algorithms. The sim- pler routing algorithm works as follows: every router of the network is associated to a subnetwork and to a reference gateway that is external to the subnetwork. Each time the router receives a datagram, it verifies if the IP address is comprised in its subnetwork. If this is true, the router sends the datagram to its destination, otherwise it sends it to the reference gateway. This is a simple and effective algorithm that is often used in data net- work, but does not take into account elements like QoS and it is not designed to optimize the computation capability of the router. If more control is desired on the routing, more complex algorithms have to be used. Using IP routing is a powerful method, but in the Internet history a proliferation of IP addresses has been created close to the maximum number that were possible to code with the original IP address format [25]. This was the main reason for the evolution of the IP through a series of subsequent ver- sions that were able to accommodate larger and larger IP addresses. Up to now mainly two versions of the IP are used in the network: IPv4 and IPv6. The IPv4 address format is shown in Figure 3.25 both in binary and in decimal dotted notation. Even if the possible number of globally unique IPv4 addresses is huge, the fast evolution of the Internet rapidly created the risk of IPv4 addresses exhaustion. Several ways were devised to avoid it, all of them are now obsolete, but for the concept of Private Network address. With the diffusion of the IP Suite, several private networks like companies local area networks (LANs) adopted the same protocol suite. Even if all the computers in a private LAN are labeled with an IPv4 address, these addresses have not to be globally unique, as far as the computers have no need of connecting to the Internet. If a user from inside a private LAN wants to connect with an external Inte