Complete Guide to Ubuntu Network Configuration: GUI & CLI Setup for Desktop and Server

目次

1. Introduction

When Do You Need Network Configuration on Ubuntu?

Ubuntu is a popular Linux distribution widely used for everything from desktop environments to server operations. In most cases, network settings are configured automatically, but there are many situations where manual network configuration is required.

For example:

  • Setting a static IP address when operating as a server
  • Manually specifying DNS servers
  • Using special network configurations such as VPNs
  • Configuring networks from the CLI in environments without a GUI

Is Ubuntu Network Configuration Complicated?

In older versions of Ubuntu, editing the /etc/network/interfaces file was common. Today, Netplan is the standard configuration method, and NetworkManager is widely used in GUI environments.

As a result, many users now wonder which configuration method they should use.

  • Beginners who want easy GUI-based configuration
  • Intermediate and advanced users who prefer command-line control
  • Administrators who want minimal configurations for servers or cloud environments

Choosing the appropriate method based on your needs is essential.

What You Will Learn in This Article

This article provides a beginner-friendly yet comprehensive explanation of Ubuntu network configuration, covering:

  • Both GUI (NetworkManager) and CLI (Netplan, nmcli) configuration methods
  • Wired LAN and Wi-Fi connection procedures
  • How to configure static IP addresses
  • DNS server settings and VPN connections
  • Common network troubleshooting techniques
  • Frequently asked questions about network configuration

By reading this guide, you will eliminate uncertainty about Ubuntu network settings and gain the confidence to configure networks according to your specific use case.

2. How Ubuntu Network Configuration Works

Basic Network Management Architecture in Ubuntu

In Ubuntu, network configuration and management are handled through NetworkManager or Netplan. The tool used depends on the Ubuntu version and whether the system is a desktop or server environment.

NetworkManager Is Standard in Desktop Environments

GUI-enabled versions such as Ubuntu Desktop (e.g., Ubuntu 22.04 LTS) use NetworkManager to manage network settings. It provides a graphical interface that allows even beginners to configure networks intuitively.

NetworkManager offers features such as:

  • Automatic wired and wireless connections
  • Manual IP address configuration
  • DNS and proxy management
  • VPN connection management

CLI tools such as nmcli and nmtui are also available, allowing flexible configuration even when a GUI is not accessible.

Netplan Is Used for Server Environments

Ubuntu Server and other GUI-less configurations use Netplan, a modern network configuration system. Netplan stores configuration in YAML files and applies them using netplan apply.

Netplan was introduced for reasons such as:

  • Centralized and manageable configuration files
  • Excellent compatibility with automation tools like Ansible
  • Strong integration with systemd for modern system architectures

Netplan can switch between underlying renderers such as NetworkManager and systemd-networkd, allowing flexible behavior depending on the environment.

/etc/network/interfaces Is Deprecated

The /etc/network/interfaces file previously used for network configuration is now deprecated in most Ubuntu environments.

It is only used in older versions (Ubuntu 16.04 and earlier) or in special cases. Today, Netplan YAML configuration files (e.g., /etc/netplan/01-netcfg.yaml) are the standard.

3. How to Connect to a Network on Ubuntu

There are two main ways to connect to the internet on Ubuntu: using GUI tools or using the command line (CLI). This section explains both methods for wired LAN and Wi-Fi connections.

Network Connections Using the GUI (NetworkManager)

Wired LAN Connection

Wired LAN connections are usually detected and connected automatically when a cable is plugged in. To manually configure the IP address, follow these steps:

  1. Click the network icon in the top-right corner
  2. Select “Wired Connected” → “Settings”
  3. Open the “IPv4” tab
  4. Change “Automatic (DHCP)” to “Manual”
  5. Enter the IP address, subnet, gateway, and DNS
  6. Save and apply the settings

Connecting to Wi-Fi

Connecting to Wi-Fi is straightforward:

  1. Click the network icon
  2. Select a Wi-Fi network from the available list
  3. Enter the password and connect

Network Connections Using the CLI

In server environments or when accessing systems via SSH, network configuration must be done from the command line. The primary tool used here is nmcli.

Checking and Enabling Wired Connections

nmcli device status
nmcli device connect enp0s3

Connecting to Wi-Fi

nmcli device wifi list
nmcli device wifi connect "SSID" password "password"

Checking Connection Status

nmcli connection show --active

Knowing both GUI and CLI methods allows you to handle any Ubuntu environment with confidence.

4. How to Configure a Static IP Address

When operating Ubuntu as a server or building a specific network environment, configuring a static IP address is often required. This section explains both GUI-based (NetworkManager) and CLI-based (Netplan) methods.

Configuring a Static IP Using the GUI (NetworkManager)

In Ubuntu desktop environments, you can change network settings graphically. Follow the steps below to configure a static IP address.

Steps

  1. Click the network icon in the top-right corner
  2. Select “Settings” or the connected network
  3. Switch to the “IPv4” tab
  4. Change “Automatic (DHCP)” to “Manual”
  5. Enter the following information in the “Addresses” section:
  • IP Address (e.g., 192.168.1.100)
  • Netmask (e.g., 255.255.255.0)
  • Gateway (e.g., 192.168.1.1)
  1. If necessary, specify DNS servers (e.g., 8.8.8.8)
  2. Click “Save” and reconnect

To apply the settings, either turn the network connection off and on again or reboot the system.

Configuring a Static IP Using the CLI (Netplan)

In GUI-less environments such as Ubuntu Server, Netplan is used for configuration. You define the settings in a YAML file and apply them using a command.

1. Check the Configuration File Location

The configuration file is usually located at one of the following paths:

  • /etc/netplan/00-installer-config.yaml
  • /etc/netplan/01-netcfg.yaml

2. Example YAML Configuration

network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s3:
      dhcp4: no
      addresses:
        - 192.168.1.100/24
      gateway4: 192.168.1.1
      nameservers:
        addresses: [8.8.8.8, 1.1.1.1]

Note: enp0s3 varies depending on the environment. Check it using the ip a command.

3. Apply the Configuration

sudo netplan apply

Verification and Troubleshooting

After applying the configuration, verify it with the following command:

ip a

If the network does not connect, test connectivity to the gateway or external DNS using:

ping 8.8.8.8

5. How to Change DNS Servers

If your internet connection is unstable or name resolution is slow, reviewing your DNS settings can help. In corporate or privacy-focused environments, you may also need to specify custom DNS servers.

Specifying DNS Servers Using the GUI

Follow these steps in Ubuntu Desktop:

Steps

  1. Click the network icon in the top-right corner
  2. Open “Settings” or the connected Wi-Fi/Wired network
  3. Select the “IPv4” or “IPv6” tab
  4. Manually enter DNS addresses (e.g., 8.8.8.8, 1.1.1.1)
  5. Disable “Automatic DNS” if applicable
  6. Save and reconnect the network

After applying the settings, verify DNS resolution with:

dig www.google.com

or

systemd-resolve --status

Changing DNS Using the CLI (Netplan)

1. Open the Configuration File

sudo nano /etc/netplan/01-netcfg.yaml

2. Example DNS Configuration

network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s3:
      dhcp4: no
      addresses:
        - 192.168.1.100/24
      gateway4: 192.168.1.1
      nameservers:
        addresses:
          - 8.8.8.8
          - 1.1.1.1

3. Apply the Settings

sudo netplan apply

4. Verify DNS Status

resolvectl status

or

cat /etc/resolv.conf

Note: resolv.conf is a symbolic link. Direct editing is not recommended. Always configure DNS via Netplan or NetworkManager.

The Relationship Between systemd-resolved and DNS

Ubuntu uses systemd-resolved to handle DNS resolution, and /etc/resolv.conf is generated by this service.

You can restart it with:

sudo systemctl restart systemd-resolved

6. How to Configure VPN Connections

VPN connections are often required for secure access to corporate networks, protection on public Wi-Fi, or bypassing regional restrictions.

Configuring OpenVPN via the GUI (NetworkManager)

Install Required Packages

sudo apt update
sudo apt install network-manager-openvpn-gnome

Rebooting after installation is recommended.

Configuration Steps

  1. Click the network icon → “VPN Settings” or “Add VPN”
  2. Select “OpenVPN” and click “Create”
  3. Enter the provided VPN details:
  • Server address
  • Authentication method
  • Certificates and keys if required
  1. Configure proxy or DNS if needed
  2. Save and activate the connection

A key icon appears when the VPN is successfully connected.

Configuring L2TP/IPsec via the GUI

Install Additional Packages

sudo apt install network-manager-l2tp-gnome

Reboot to enable the L2TP option.

Steps

  1. Add a VPN and select “L2TP”
  2. Enter the server address, username, and password
  3. Open “IPsec Settings” and enter the pre-shared key
  4. Review advanced options such as MPPE
  5. Save and connect

Configuring OpenVPN via the CLI

1. Install OpenVPN

sudo apt install openvpn

2. Connect Using a Configuration File

sudo openvpn --config your-config.ovpn

Troubleshooting VPN Connections

  • Verify server address and port
  • Check firewall settings (ufw) and ISP restrictions
  • Ensure certificates are correctly placed
  • Review logs using journalctl -xe or /var/log/syslog

7. Common Network Issues and Solutions

Even with proper configuration, issues such as no internet access or missing Wi-Fi networks can occur.

Basic Connectivity Checks

1. Hardware Verification

  • Ensure LAN cables are connected
  • Confirm wireless adapters are enabled
nmcli device status

2. IP Address Assignment

ip a

3. Connectivity Testing

ping 192.168.1.1
ping 8.8.8.8

Wi-Fi Not Detected or SSID Missing

lshw -C network
sudo ubuntu-drivers devices
sudo apt install [recommended-driver]

DNS Resolution Issues

If IP connectivity works but domain names fail, DNS settings are likely misconfigured.

Changes Not Applied

sudo netplan apply
sudo systemctl restart NetworkManager

8. FAQ About Ubuntu Network Configuration

Q1: Wi-Fi Does Not Appear on Ubuntu. What Should I Do?

A: Check device recognition and install the recommended driver using ubuntu-drivers.

Q2: I Configured a Static IP but Cannot Connect to the Internet.

A: Verify gateway, DNS, subnet prefix, and ensure netplan apply was executed.

Q3: Can Network Configuration Be Done Using CLI Only?

A: Yes. Use nmcli and netplan depending on the environment.

Q4: Is Reboot Required to Apply Changes?

A: Not necessarily. Reconnect the network or use netplan apply.

Q5: How Can I Reset Network Settings?

nmcli connection show
nmcli connection delete <connection-name>

9. Summary

Ubuntu network configuration offers multiple approaches depending on your environment and use case.

Key Takeaways

  • GUI-based configuration using NetworkManager
  • CLI-based configuration using nmcli and Netplan
  • Static IP and DNS customization
  • VPN setup and troubleshooting
  • Practical diagnostics and FAQs

Choose the Right Method for Your Environment

Use CaseRecommended Method
Desktop usageGUI (NetworkManager)
Server / CloudCLI (Netplan)
Remote managementSSH + nmcli / YAML
Security-focused setupsVPN + Manual DNS

Stable Networking Improves Productivity

Ubuntu’s flexibility allows powerful customization, but incorrect settings can cause connectivity issues. Use this guide to eliminate uncertainty and confidently manage your network.

This concludes the complete guide to Ubuntu network configuration.

年収訴求