6.4. How to assign an Internet address


This address is assigned by the NIC and it has two section or parts. The one on the left represents network identification and the one on the right represents the node identification. In consideration of the point mentioned above (four numbers between 0-255, or 32 bits or four bytes), each byte represents either the network or the node. The NIC assigns the net and the institution (or provider) assigns the node.

There are some restrictions: 0 (for example, in the network space is reserved for the routing by default and 127 (for example, is reserved for the (local loopback or local host), 0 in the node part refers to this network (for example, and 255 is reserved for sending packets to all (broadcast) machines (for example, There may be different types of networks or addresses in the different assignations:

Class A (network.host.host.host): to (126 networks, 16 million nodes) define the large networks. The binary standard is: 0 + 7 network bits + 24 node bits.

Class B (network.network.host.host): to (16K networks, 65K nodes); (usually, the first node byte is used to identify subnets within an institution). The binary standard is 10 + 14 network bits + 16 node bits.

Class C (net.net.net.host): to (2 million of networks, 254 nodes). The binary standard is 110 + 21 network bits + 8 node bits.

Classes D and E (network.network.network.host): to reserved for multicast (from one node to a set of nodes that form part of the group) and experimental purposes.

Some address ranges have been reserved so that they do not correspond to public networks, and are considered private networks (interconnected computers without external connection; the messages will not be sent through Internet, but through an intranet). These address ranges are class A to, class B to and class C to

The broadcast address is special, because each node in a network listens to all the messages (as well as its own address). This address makes it possible to send datagrams (generally routing information and warning messages) to a network and all nodes on the network will be able to read them. For example, when ARP tries to find the Ethernet address corresponding to an IP, it uses a broadcast message, which is sent to all the machines on the network at the same time. Each node in the network reads this message and compares the IP that is being searched and sends back a message to the sender node if they match.

Two concepts that are related to the point described above are the subnets and routing between these subnets. Subnets subdivide the node part into smaller networks within the same network, so as to, for example, improve the traffic. A subnet is in charge of sending traffic to certain IP address ranges, extending to the same concept of Class A, B and C networks, but only applying this rerouting in the IP node part. The number of bits interpreted as a subnet identifier is provided by a netmask, which is a 32-bit number (as is an IP). In order to obtain the subnet identifier, we will have to perform a logical AND operation between the mask and the IP, which will provide us with the subnet IP. For example, an institution with a B class network, with number, would therefore have a netmask with number Internally, this network is formed by small networks (one per floor in the building, for example). In this way, the range of addresses is reassigned in 20 subnets (floors in our example, except, that has a special role), to The point that connects all these floors, called the backbone, has its own address, for example

These subnets share the same network IP, whereas the third is used to identify each of the subnets within it (which is why it will use the netmask

The second concept, routing, represents the mode in which the messages are sent through the subnets. For example, let us say there are three departments with Ethernet subnets:

1)Purchases (subnet,
2)Clients (subnet,
3)Human Resources, (subnet
4)Backbone with FFDI (subnet

In order to route the messages between the computers on the three networks, we need three gateways that will each have two network interfaces to switch between Ethernet and FFDI. These would be:

1)PurchasesGW IPs: and,
2)ClientsGW IPs: and
3)HumanResourcesGW IPs: and, in other words, one IP on the subnet side and another on the backbone side.

When messages are sent between machines in the purchases area, it is not necessary to leave the gateway, as the TCP/IP will find the machine directly. The problem arises when the Purchases0 machine wishes to send a message to HumanResources3. The message must pass through the two respective gateways. When Purchases0 "sees" that HumanResources3 is on another network, it sends the packet through the PurchasesGW gateway, which in turn sends it to HumanResourcesGW, which, in turn, sends it to HumanResources3. The advantage of having subnets is obvious, given that the traffic between all the purchases machines, for example, will not affect the Clients or Human Resources machines (although this is more complex and expensive in terms of designing and building the network).

IP uses a table to route the packets between the different networks, in which there is a default routing associated to net All the addresses coincide with this one, as none of the 32 bits are necessary; they are sent through the default gateway to the indicated network. In the purchasesGW, for example, the table would be:

The '-' means that the machine is directly connected and does not need routing. The procedure for identifying whether routing is required or not consists of performing a very simple operation with the two logic ANDs (subnet AND mask and origin AND mask) and comparing the two results. If they match, there is no routing, but the machine defined as gateway must be sent in each machine, so that this machine routes the message.

For example, a message from to would mean: AND = AND =

As the results are the same, there would be no routing. On the other hand, if we do the same from to we see that there will be routing through with an interface change (eth0 to ffdi0) to and from here to with another interface change (fddi0 to eth0) and then to The default routing will be used when none of the rules match. If two rules match, the routing that matches the most precisely, in other words, the one with the least zeros, will be used. In order to build the routing tables, we can use the route command during machine startup; however, if it is necessary to use more complex rules (or automatic routing), we can use the routing information protocol (RIP) command or, between independent systems, the external gateway protocol (EGP) or also the border gateway protocol (BGP) commands. These protocols are implemented through the gated command.


In order to install a machine on an existing network, it is necessary to have the following information, obtained from the network provider or the administrator: node IP address, network IP address, broadcast address, netmask address, router address and DNS address.

If we are setting up a network that will never have an Internet connection, we can choose the addresses that we wish, but it is advisable to maintain an appropriate order corresponding to the size of the network that will be needed, so as to avoid administrative problems within the network in question. We will now see how to define the network and node for a private network (we have to be careful, as, if the machine is connected to the network, we can inconvenience another user to whom this address has been assigned): node address, netmask, net part 192.168.110., node part .23, net address, broadcast address