How To Troubleshoot Ubuntu 22.04 LTS Network Configuration

Garry Gayles
Garry Gayles
  • Updated

Network configuration in Ubuntu 22.04 LTS is managed by Netplan, which utilizes YAML files to define settings for either networkd ( default for servers ) or NetworkManager ( default for desktops ) network services.

Analysis normally involves checking the network connection status, validating the Netplan configuration, and testing network connectivity. 

 

Step 1 - Check system network connection status -

Inspect the NIC ( network interface card ) RJ-45 port connectivity status:

RJ-45 port LED status -

There are normally two LEDs; one for link or physical connection; another for activity or transmitting and receiving.

These will vary in color depending upon vendor and sometimes the model; however, will range in matched or mixed pairs from red, amber, orange, yellow to green.

Their behavior will vary from off ( disabled or not connected ) to steady or blinking ( enabled or connected or active ) .

Check network interface status from CLI:

$>sudo ip a

Verify:

A primary network interface device ID ( e.g., enp3s0, eth0 )

An assigned IP address

An UP state

Check NetworkManager status ( if applicable ) :

$>sudo nmcli dev status

This displays the status of devices controlled by NetworkManager and is useful for desktop installations.

Check DNS resolution:

$>sudo resolvectl status

This displays the current DNS server configuration.

Edit /etc/resolv.conf file to view active nameservers.

$>sudo cat /etc/resolv.conf

… or edit the DNS YAML file …

$>sudo nano /etc/resolv.conf

Test basic connectivity:

Ping the local gateway

$>ping -c 3 < gateway_ip >

Ping a public DNS server

$>ping -c 3 8.8.8.8

Test DNS lookup

$>ping -c 3 google.com

 

Step 2 - Validate system Netplan configuration -

If diagnostics isolate connectivity failure to a particular system, check the Netplan YAML file.

A YAML file name can vary; however, will always have *.yaml suffix

The Netplan YAML file is located in /etc/netplan/

Display the Netplan YAML file:

$>sudo cat /etc/netplan/*.yaml

Normally, there is only one Netplan YAML file; and only one can be in use; however, there may be several Netplan YAML files with names in the format of …

00-installer-config.yaml

… or …

01-netcfg.yaml

… or …

99-config.yaml

Review YAML file configuration:

DHCP IP address configuration Netplan YAML file example:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      dhcp4: true

Static IP address configuration Netplan yaml file example:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      dhcp4: no
      addresses: [192.168.1.10/24]
      routes:
        - to: default
          via: 192.168.1.1
      nameservers:
        addresses:

Note: Indentation is crucial in YAML.

Incorrect spacing will cause the file to fail.

 

The renderer is typically networkd for servers and NetworkManager for desktops.

 

Validate and Apply Netplan YAML file changes:

If a Netplan YAML file is altered, check the Netplan YAML file for syntax errors before applying …

$>sudo netplan try

If any changes pass syntax check, apply the new configuration …

$>sudo netplan apply

Step 3 - Test Network Connectivity - Check Firewall Settings -

A misconfigured firewall can block network traffic for properly configured system Netplan configurations.

Check ufw ( Ubuntu Firewall ) status:

$>sudo ufw status verbose

If ufw is active, review the firewall rules to ensure that essential Ethernet ports and services are not blocked. 

 

Step 4 - Test Network Connectivity - Restart network services -

A network service restart is sometimes necessary to put Netplan configuration changes into effect.

Restart NetworkManager ( for desktops ) :

$>sudo systemctl restart NetworkManager

Restart systemd-networkd ( for servers ) :

$>sudo systemctl restart systemd-networkd

 

Step 5 - Test Network Connectivity - Check hardware and drivers -

If the above steps fail, the issue may be hardware-related.

Check for driver issues:

$>sudo  lshw -C network

This will list hardware information for the installed network interfaces.

Additionally, parse journalctl ...

$>sudo journalctl -b | grep -i < nic-device-id >

Look for a driver entry and check for any UNCLAIMED status that may indicate a missing or faulty driver.

NIC driver reinstallation will vary from vendor to model.

 

Step 6 - Test Network Connectivity - Check Subnet Network Infrastructure

Physically reconnect Ethernet cables and/or restart the system.

Reboot subnet network infrastructure devices such as routers or switches.

Related to

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.