Table of Contents
Today in this article we are going to show you how to Configure networking on Ubuntu servers. Whether you are a Linux administrator or a regular user, you need to know the basics of network configuration on your Linux system. This can be useful when troubleshooting issues with internal and external connectivity. Basic knowledge includes knowing the interface name, current IP configuration, and hostname.
Ubuntu Server is part of the larger line of Ubuntu products and operating systems developed by Canonical Ltd. Ubuntu Server is a special addition, slightly different from Ubuntu Desktop, to make it easier to install on servers. Ubuntu tools, which are open source software, are alternatives to many types of licensed products. The word “Ubuntu” comes from a South African term for coming together and sharing.
Ubuntu Server differences include replacing a graphical user interface with a character-based interface for installation, as well as other interface changes. These can be customized by the user. The system supports many different platforms such as Microsoft Hyper-V and VMware ESX Server. We have mentioned below the steps to configure the network on Ubuntu servers.
Steps to Configure Networking on Ubuntu Servers
Set/change an IP address
Network configuration from the command line
On Ubuntu, you can set your IP address via terminal commands.
Step 1: first type netstat -I to find the interface name. Then type the command below:
sudo ifconfig eth0 192.168.72.6 netmask 255.255.255.0
step 2: So stop add a default gatewayadd the command below:
sudo route add default gw 192.168.72.1 eth0
Network configuration using the GUI
Step 1: You may set an IP address through the graphical user interface in Ubuntu. On the desktop, click on the Start menu and look for Settings. In the Settings window, click the Network tab. Then in the right pane, select the interface and click the gear icon Open Definitions for that interface.
step 2: In the IPv4 tab, you can select radio Automatic (DHCP) button to allow the system to dynamically obtain the IP address.
step 3: If you want to set a static IP addressclick on the radio Manual button. Enter the IP address, subnet mask and a default gateway. Then click Apply to save the current changes.
Configure the network by editing the /etc/interfaces file
Here is another method you can use to configure the IP address. To dynamically set the IP address, you need to edit /etc/network/interfaces. The basic interface configuration is stored in /etc/network/interfaces.
Step 1: To edit /etc/network/interfaces typing the following command in the terminal.
sudo nano /etc/network/interfaces
step 2: Then add the following lines:
auto eth1iface eth1 inet dhcp
Step 3: Save the file and restart network services using the command below.
sudo systemctl restart network
step 4: For set a static IP address, you have to edit /etc/network/interfaces
sudo nano /etc/network/interfaces
Step 5: Add the lines below to /etc/network/interfaces.
auto eth1iface eth1 inet staticaddress 192.168.72.8netmask 255.255.255.0gateway 192.168.72.1dns-nameservers 8.8.8.8 4.4.2.2
Step 6: save the file and restart network services.
sudo systemctl restart network
Context up/Change hostname
The Ubuntu OS hostname is configured in the /etc/hostname file.
Step 1: For edit /etc/hostname, type the command below:
sudo nano /etc/hostname
step 2: This file contains only the host name of the file, change the name and save it.
Editing the /etc/hosts file
The Hosts file locally maps the hostname to the IP address. For example, if you have a server on your local network, instead of remembering its IP, you can map its IP to a name in the /etc/hosts file. This will allow you to access the machine with a name instead of the IP.
Step 1: For To edit a hosts file, type:
sudo nano /etc/hosts
step 2: Add the IP address and server name in the hosts file in the following format.
file server 192.168.72.10
step 3: To save the file and restart the system to apply the changes.
Final Words
We hope you like our article on how to Configure networking on Ubuntu servers. Ubuntu comes with some graphical utilities for configuring network devices, but there are a few topics that server administrators need to be particularly good at, including knowing how to configure network devices from the command line. To manage your Ubuntu server network from the command line, it is important to understand concepts such as Ethernet interfaces, IP addressing, bridging, and name resolution.