Cloud and Self-Hosting

how to change ip address of ubuntu server 24.04 to static ip

To configure a static IP address on Ubuntu Server 24.04, you'll need to modify the Netplan configuration file. Here's how to do it: First, identify...

By Amjid Ali · · Updated · 1 min read

Prefer to watch? This video walks through it step by step. Prefer to read? The full guide is below.

To configure a static IP address on Ubuntu Server 24.04, you’ll need to modify the Netplan configuration file. Here’s how to do it:

  1. First, identify your network interface name:
ip a
  1. Create or edit the Netplan configuration file: (there might be a different file name too, like 50-cloud-init.yaml) or whatever is avaialble, i will be using below
sudo nano /etc/netplan/00-installer-config.yaml
  1. Configure the file with your static IP information:
network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s18:  # Replace with your interface name
      dhcp4: false
      addresses:
        - 10.11.12.7/24  # Your desired static IP/subnet mask
      routes:
        - to: default
          via: 10.11.12.1  # Your gateway IP
      nameservers:
        addresses: [10.11.12.1, 1.1.1.1]  # DNS servers
  1. Apply the configuration:
sudo netplan apply
  1. Verify the new IP address:
ip a

Make sure to replace:

  • enp0s18 with your actual interface name
  • 10.11.12.7/24 with your desired IP address and subnet mask
  • 10.11.12.1 with your gateway address
  • DNS servers as needed for your network

If you encounter any issues, you can check the configuration with:

sudo netplan --debug apply

Related videos

Video library
  • Cloud and Self-Hosting

    Set a Static IP and Hostname on Ubuntu Server 24.04 (Netplan)

    · 9:02 · 1.6K views

    Watch on YouTube
  • Cloud and Self-Hosting

    Ubuntu Server Auto Updates with Crontab | Automate System Updates on Ubuntu 24.04

    · 6:17 · 302 views

    Watch on YouTube
  • Cloud and Self-Hosting

    How to Change the IP Address of a Proxmox Virtual Environment Node

    · 2:57 · 20.8K views

    Watch on YouTube