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:
- Login to your VM: Log in to your VM using the command below
$ ssh ubuntu@IP_ADDRESS
/etc/network/interfaces File: Open the
/etc/network/interfaces file in a text editor. You can use the
vim For example, to open the file using
sudo vim /etc/network/interfaces
- Review the Configuration: In the
/etc/network/interfacesfile, 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
autoindicates whether the interface should be automatically started during boot.
ifacespecifies the interface name.
inetindicates the address family, typically IPv4.
dhcpis 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 (
eth1, etc.) matches the one you intend to configure.
- Incorrect IP configuration method: Check if the method (
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
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.