After installing Ubuntu 22.04 the default network interface assigns an IP address using the DHCP server. Also, the wireless network will be active and enable the networking over the wifi network.

You can also configure the network interface with static IPv4 addresses. Ubuntu 22.04 uses the Netplan as a network manager.

This tutorial helps you to configure network interfaces on Ubuntu 22.04 Desktop and Server versions. The desktop users can use any one of the below methods but the server users that have CLI only access use the second method to edit network interface configuration files.

Method 1: Configuring Static IPv4 Address on Ubuntu 22.04 Desktop

The Ubuntu Desktop editions have a graphical interface for configuring the network interfaces. Follow the below steps to configure a static IP address on Ubuntu 22.04 Desktop system.

    • Click the network icon in the upper-right corner.
    • Then expand the Wired Connected dropdown.
    • Now, click on Wired Setting as shown below image.

    How to Configure Static IP Address on Ubuntu 22.04 Netplan Networking static ip ubuntu
    Edit Wired Interface Settings

    • A network settings dialog box will appear.
    • Now, click “Network” in left sidebar.
    • Under the Wired section, click the Gear icon as showing in below image

    How to Configure Static IP Address on Ubuntu 22.04 Netplan Networking static ip ubuntu
    Edit Network Interface

    • A new Wired dialog box will appear.
    • Now, click on “IPv4” tab.
    • Set IPv4 Method to Manual
    • Input a valid IP address, Netmark and Gateway address
    • Set the DNS server (optional)
    • Click Apply button to save changes

    How to Configure Static IP Address on Ubuntu 22.04 Netplan Networking static ip ubuntu
    Configuring Static IP on Ubuntu

  1. All done. Ubuntu Desktip system IP address is now changed.

Method 2: Configuring Static IPv4 Address on Ubuntu 22.04 Server with CLI

Server editions are installed without any graphical interface. In that case, you need to configure the IP address using the command line.

Ubuntu uses the Netplan as a network manager that is responsible for configuring the network interfaces. Follow the below steps:

  1. First, find out the network interface name in your system. The interface name can differ based on the installation type and system hardware. To find the interface name type:
    sudo ip a 
    
    How to Configure Static IP Address on Ubuntu 22.04 Netplan Networking static ip ubuntu
    Checking the network interface name

    The above output shows that the system is configured with the network interface name eth0. This can be different on your system.

  2. Now, create or edit the network configuration file under the /etc/netplan directory. Create a configuration file and edit in a editor:
    sudo vi /etc/netplan/01-netcfg.yaml 
    

    Add the network configuration in YAML format as below:

    network:
      version: 2
      renderer: networkd
      ethernets:
        eth0:
          dhcp4: no
          addresses:
            - 192.168.1.10/24
          gateway4: 192.168.1.1
          nameservers:
            addresses:
              - 8.8.8.8
              - 8.8.4.4
    

    In the above configuration:

    • eth0 – is the network interface name
    • 192.168.1.200/24 – is the IPv4 address to set on interface. Make sure to define CIDR.
    • dhcp4: no – Set that no DCHP IP will be assigned to system.
    • gateway4: 192.168.1.2 – Set the gateway IP address of the network
    • 8.8.8.8 – is the IP address of the DNS server (Google).
    • 8.8.4.4 – Another DNS server provided by Google..

    Make sure the IPv4 address belongs to the system network and has the correct gateway Ip address. Once confirmed, save file content and close it.

  3. Apply the changes by running the following commands.Now, execute the following command to apply the changes:
    sudo netplan apply 
    

    That’s it. The static IP address is configured on your Ubuntu system.

Conclusion

In this tutorial, you have learned 2 methods of configuring network interface on Ubuntu 22.04 systems. The first method uses the GUI interface to set up a static IP address. The second method provides you with the instructions to configure the network interface via the command line using Netplan.

You can also configure multiple IP addresses on a single network interface.