How to Set a Static IP Address on Ubuntu 24.04

IT Consultancy

IT Consultancy Get expert guidance to leverage technology for your business growth. We help you identify the right IT solutions, optimize infrastructure, and ensure your digital environment is secure,…

Digital Marketing

Digital Marketing Grow your brand and reach the right audience with data-driven marketing strategies. We help you create campaigns that convert, manage social channels effectively, and optimize your d…

Privacy Policy

Privacy Policy At CometSoul, accessible from https://cometsoul.com, one of our main priorities is the privacy of our visitors. This Privacy Policy document contains types of information that is collec…

Terms and Conditions

Welcome to CometSoul! These terms and conditions outline the rules and regulations for the use of CometSoul’s Website, located at https://cometsoul.com. By accessing this website we assume you a…

Disclaimer

If you require any more information or have any questions about our site’s disclaimer, please feel free to contact us. Disclaimers for CometSoul All the information on this website – https…

Tutorial

Wifi Managed Service

Managed Wi-Fi Service

Managed Wi-Fi Service Build a fast, stable, and secure Wi-Fi for your business at Zero depreciation cost. Enterprise-Grade Guest Wi-Fi With $0 Upfront Hardware Costs. We provide, install, and support …

System Integrator

Smart Business System Integrator

Smart Business System Integrator Simplify your daily operations with smart systems that automate bookings, schedules, and routine tasks so you can focus on growing your business. We set up and integra…

Computer Managed Service

IT Procurement & Hardware Managed Service

IT Procurement & Hardware Managed Service Keep your technology running smoothly from the hardware you use every day to the systems that power your business. We provide end-to-end IT management so …

Setting a static IP address on Ubuntu 24.04 is useful when you need a server or workstation to keep the same IP address all the time. This is common for web servers, file servers, domain controllers, and other systems that must stay reachable on a fixed address. On Ubuntu, network configuration is handled through Netplan, which uses YAML files to define IP settings, routes, and DNS. (Ubuntu)

In this guide, you will learn how to configure a static IP address on Ubuntu 24.04 using Netplan. We will cover how to identify your network interface, edit the Netplan configuration file, apply the changes, and verify that the new IP address is working properly. Netplan supports static IP configuration with keys such as addresses, routes, and nameservers. (Netplan)

Step 1: Check Your Network Interface Name

Before editing the network settings, find your active network interface name:

ip a

Look for an interface such as enp0s3, ens18, or eth0.

Step 2: Find the Netplan Configuration File

Netplan configuration files are usually stored in:

/etc/netplan/

List the files with:

ls /etc/netplan/

You may see a file like:

00-installer-config.yaml

or

50-cloud-init.yaml

Step 3: Back Up the Existing Configuration

Before making changes, create a backup:

sudo cp /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.bak

Replace the filename if your system uses a different Netplan file.

Step 4: Edit the Netplan File

Open the file with nano:

sudo nano /etc/netplan/00-installer-config.yaml

Use a configuration like this:

network:
  version: 2
  renderer: networkd
  ethernets:
    ens18:
      dhcp4: false
      addresses:
        - 192.168.1.50/24
      routes:
        - to: default
          via: 192.168.1.1
      nameservers:
        addresses:
          - 8.8.8.8
          - 1.1.1.1

In this example:

  • ens18 is the network interface name
  • 192.168.1.50/24 is the static IP address
  • 192.168.1.1 is the default gateway
  • 8.8.8.8 and 1.1.1.1 are DNS servers

Ubuntu documentation shows that static IP settings in Netplan are defined with YAML and commonly include an interface name, one or more addresses, DNS servers, and a default route. The renderer can be networkd or NetworkManager, depending on the system. (Ubuntu)

Step 5: Test the Configuration

Before applying the change permanently, test it:

sudo netplan try

This lets you confirm the network still works before the configuration is committed.

Step 6: Apply the Static IP Configuration

If everything looks correct, apply the new configuration:

sudo netplan apply

Ubuntu and Netplan documentation recommend applying changes with the netplan command after editing the YAML file. (Ubuntu)

Step 7: Verify the Static IP Address

Check that the new IP address is active:

ip a

Check the default route:

ip route

Test DNS and internet connectivity:

ping -c 4 8.8.8.8
ping -c 4 google.com

If the IP address, route, and DNS all work, your Ubuntu 24.04 static IP setup is complete.

Common Netplan Mistakes

A failed Netplan setup is often caused by small YAML errors. Watch for these common issues:

  • Wrong indentation
  • Incorrect interface name
  • Wrong gateway address
  • Missing /24 subnet prefix
  • Tabs instead of spaces

Netplan uses YAML syntax, so spacing and indentation must be correct for the configuration to work. (Ubuntu)