The network is one of the most important components on a server. If there is no network to function properly, then how the user will be able to access services that are on the server? For this we should immediately perform a network configuration in Ubuntu Server is new we install.
Configuring An Ad Hoc Network
There are two types of network configuration in Ubuntu, the first is temporary. In this type of configuration we set all only temporary in nature. He will be gone so the server is restarted. His arrangements are done by typing commands directly on the command line. Before getting started, let's check first the IP address of the ethernet interface which is owned by the companies owned by the server.
eth0 is the name of the ethernet ports on the server. We can also check without knowing the name of the ethernet on Ubuntu server by performing a small change to the above command, follows his orders:
The results of the command into two more or less the same, but the difference is only the first command displays the IP address of interface eth0.
The same command we use to assign IP addresses on a network interface. But now we will add the IP address and netmask.
sudo ifconfig eth0 10.10.10.210/24
Do not forget to use the "sudo" because we need root access to do the configuration. Check the IP address command to make sure that we execute is correct.
We also need to add the address of the gateway used to access other networks. Execute the following commands to perform the settings default gateway address:
sudo route add default gw 10.10.10.254
Use the following command to check the gateway address assigned to the server.
The result will look like in the screenshots below. The default gateway is located on the row with the column of the Destination value 0.0.0.0
Then please do the test, whether we can already access another server using the ping command.
The gateway server at the address 10.10.10.254 has given reply, meaning that the configuration is correct.
Permanent Network Configuration
When the previous configuration will be lost when the server is restarted, this type is quite the opposite. Network configuration will still be there even if the server is turned off and then turned on again. The arrangements we do by changing the file "/etc/network/interfaces". We can use an editor such as vim or nano to do the conversion.
sudo nano /etc/network/interfaces
Add the following lines at the end of the file.
iface eth0 inet static
And then you have to enable the above configuration by running the following command:
sudo ifdown eth0
sudo ifup eth0
Don't forget to check back whether eth0 is already getting the new IP address.