How to Configure and Troubleshoot Networks in Linux
09:48, 25.05.2026
Any Linux server can have some issues, and to solve them, it is highly important to have some helpful techniques and tools. It doesn’t matter what Linux distro you are using, because major processes and configurations are fairly common. That’s why we decided to share several essential commands that will help with troubleshooting.
In case your Linux server is not accessible, you should still be able to log in to the control panel or a VNC connection. After logging in, check the internet connection. This may be done in the following way:
ping -c 4 8.8.8.8
When the server cannot reach any destination, there might be some issues with the configuration. So, let’s start the process by checking network settings.
Verify Your Network Settings
The initial thing that should be done is to check the network interfaces. To check the status of all the interfaces, ip addr command is needed. By using it, you can check whether such critical connections as eth0 are enabled. Once the disabled interfaces are found, you can activate them with ifup. For the restarting process, the following commands should be used: ifdown –force and ifup.
Once you use ip addr command, you will see the status of every interface. To switch on the disabled interfaces, use the following:
sudo ifup <name of the interface>
Once all the interfaces are enabled, repeat the ping command. In case the same issue isn’t solved, check whether interfaces have assigned IPs.
For the restating of any problematic interface use:
sudo ifdown < name of the interface>
sudo ifup < name of the interface>
If this doesn’t help, then it is recommended to try:
sudo ifdown --force <name of the interface>
sudo ifup <name of the interface>
If that helped, that's fantastic; if not, we will guide you through other possible troubleshooting processes.
Review the Network Configuration File
Most of the network settings are stored in the files, and changes can be made by opening them in a text editors. For Ubuntu-based and Debian systems, this can be done as follows:
sudo nano /etc/network/interfaces
In Red Hat and CentOS, the information about the network interfaces is divided between several files. The default interface is usually eth0.
sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0
If, after opening these files, you notice that the information in the files doesn’t match the original functionality, you should edit the files. You can restart the interfaces, with the usage of recommendations that we have already mentioned with the commands ifdown and ifup. This should be done after you have made the necessary changes in the files.
Inspect the Server’s DNS Configuration
When the server pings IP, but cannot connect to the domain, that might be related to a DNS issue. To check domain name resolution, use:
ping upcloud.com
Then, check DNS configuration is properly done. If the domain doesn’t reply, the issue might be connected with the domain name being resolved to IP. Here you should better check DNS records:
sudo cat /etc/resolv.conf
The list should include at least one name, and all the default DNS resolvers should have the same IP. The DNS servers are given automatically by the DHCP protocol, and there is no necessity for manual configuration.
In case this list is empty, don’t add it manually, but in some Debian systems, use the following command:
sudo resolvconf -u
But this command will work only if you have resolv.conf installed, if you don’t use:
sudo nano /etc/resolv.conf
On the next step, add the following lines and save the file:
nameserver 8.8.8.8
nameserver 8.8.4.4
If, after the update command, resolv.conf is empty, add nameservers to the interfaces file.
sudo nano /etc/network/interfaces
The following information should be added after the eth0 section:
iface eth0 inet dhcp
dns-nameservers 94.237.127.9
Then save the file with all the changes and restart the network service with:
sudo service networking restart
For the users of Red Hat and CentOS, the process might be slightly different. In case resolv.conf file is empty, you can add two DNS entries. To open the file, use the following command:
sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0
The edited file should look as follows:
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=8.8.8.8
DNS2=8.8.4.4
After exiting the editor, restart the interface.
Perform Bidirectional Connectivity Tests
To ping the server over the internet, open the command prompt and use the following command. The server's public IP can be checked in the UpCloud control panel:
ping <server public IP>
Testing internet connection by pinging another website from the server, this can be done as follows:
ping 8.8.8.8
In case there is another server deployed on the account, and the issue is in the interface assigned to the private IP. Then the best option is to ping the server from and to with the private IP. If ping doesn’t work, then it is recommended to restart network services.
For the Ubuntu and Debian users, the command is as follows:
sudo service networking restart
For the Red Hat and CentOS systems, use the following command:
sudo service network restart
For Ubuntu 14.04 and newer, the command should be run for each interface, as follows:
sudo ifdown eth0 && sudo ifup eth0
After the completion of restarting, run ping both ways. In case ping works only in one direction, then it is recommended to check the settings of the firewall.
Identify the Point of Connection Failure
In case the previously-discussed options haven’t helped with solving an issue, there are such tools as tracepath or mtr that can help. With these commands, it is possible to identify the network failure.
For the Ubuntu users, the following command is needed:
mtr 8.8.8.8
For Debian users, the command is the following:
traceroute -4 8.8.8.8
For CentOS users, the necessary command is:
tracepath 8.8.8.8
Different Linux distributions have various commands, and the output is slightly different.
Examine Firewall Rules and Access
To examine whether firewall rules are blocking connections, you should check everything. For Red Hat distros, the next command will display firewall rules:
sudo iptables -L
The output will be in the form of the firewall table, where will be listed the rules for which traffic is allowed and which is blocked.