This article describes the implementation of a TCP/IP network for all Linux distributions. It does not address the implementation of network startup files.
Assigning the hostname
For most network applications, it is often important to define a hostname.
For this you can use the hostname command:
(Where "Jak" is the name of my machine)
Assigning IP addresses
First you shall ask yourself what you intend to do with this network and how users it can support. Indeed the number of client determines the IP address range to choose from.
Class C (less than 255 clients): 192.168.0.0 - 192.168.255.0 : 255.255.255.0
Class B (less than 65535 clients): 172.16.0.0 - 172.31.0.0 : 255.255.0.0
Class A (more than 65535 clients): 172.16.0.0 - 172.31.0.0 : 255.255.0.0
Note that: If you simply want to configure networks applications, without any clients on the same network. You can use the loopback interface (127.0.0.1).
The loopback interface
Now we will configure your network. All the commands must be entered as root:
On most Linux distributions, the loopback interface is already configured. You can check it using the following command:
The following shall be displayed:
# ifconfig lo
lo Link encap Local loopback
inet addr 127.0.0.1 Bcast [NONE SET] Mask 255.0.0.0
UP BROADCAST LOOPBACK RUNNING MTU 2000 Metric 1
RX packets 0 errors 0 dropped 0 overrun 0
TX packets 0 errors 0 dropped 0 overrun 0
Otherwise use this command:
# ifconfig lo 127.0.0.1
We must now enter this interface in the routing table
# route add 127.0.0.1
Now that the loopback interface is configured, test it using the ping command:
# ping 127.0.0.1
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=32 time=1 ms
64 bytes from 127.0.0.1: icmp_seq=0 ttl=32 time=0 ms
Your loopback interface is properly configured.
The Ethernet interface
The configuration of the Ethernet interface make use of the same tools and the same methods as the Loopback interface.
We will configure this interface with a class C for 254 clients.
But you can change the IP address according to the table mentioned above. Before you do this, you must insert network module corresponding to your network card.