Skip links

How to Check Network Configuration in Debian/Ubuntu

How to Check Network Configuration in Debian/Ubuntu

Checking network configuration in Debian/Ubuntu involves verifying the settings in the /etc/network/interfaces file and using the ifconfig command to confirm the network interface configurations. Here are the specific steps to do this:

  1. Login to your VM: Log in to your VM using the command below
$ ssh ubuntu@IP_ADDRESS

2.Check the /etc/network/interfaces File: Open the /etc/network/interfaces file in a text editor. You can use the nano or vim For example, to open the file using vim, run:

   sudo vim /etc/network/interfaces
  1. Review the Configuration: In the /etc/network/interfaces file, you will see the network interface configurations. It typically looks something like this:
   auto lo
   iface lo inet loopback

   auto enp1s0
   iface enp1s0 inet dhcp
  • auto indicates whether the interface should be automatically started during boot.
  • iface specifies the interface name.
  • inet indicates the address family, typically IPv4.
  • loopback or dhcp is the network configuration method for the interface. In this example, “loopback” is for the localhost interface, and “dhcp” is for dynamically obtaining an IP address from a DHCP server.

4. Verify the Configuration: Ensure that the configuration matches your network setup. Common issues you might encounter include:

  • Incorrect interface name: Verify that the interface name (eth0, eth1, etc.) matches the one you intend to configure.
  • Incorrect IP configuration method: Check if the method (static, dhcp, etc.) is appropriate for your network setup.
  • Incorrect IP addresses and subnet masks: Confirm that the IP addresses and subnet masks are set correctly.

5.Save and Exit: If you make any changes to the /etc/network/interfaces file, save your modifications. In nano, you can do this by pressing Ctrl + O, confirming the file name, and then pressing Enter. To exit, press Ctrl + X.

6.Check Interface Configurations with ifconfig: After verifying and potentially modifying the network configuration, use the ifconfig command to check the current network interface settings. Run the following command to display the network interface information:


This command will list all the network interfaces along with their current IP addresses, MAC addresses, and other network-related information.

7.Verify Network Interface Configuration: Review the information provided by ifconfig to ensure that the network interface has the expected IP address, subnet mask, and other relevant settings. If you made changes to the /etc/network/interfaces file, make sure that these changes are reflected in the output of ifconfig.

By following these steps, you can check and verify the network configuration of your Ubuntu virtual machine. If you encounter any discrepancies or issues, you may need to make corrections to the configuration file and restart the networking service to apply the changes.