KeepItTechie
Josh | KeepItTechie

Your Ubuntu Server Needs a Static IP Address

This guide walks through why your server needs a static IP and how to configure one on Ubuntu Server 26.04 using the terminal GUI nmtui or the manual Netplan method, with practical tips to avoid locking yourself out.

KeepItTechie#Linux#Ubuntu#Netplan#Nmtui#Networking#Self-Hosting#Docker#Containers
Your Ubuntu Server Needs a Static IP Address

Why your Ubuntu Server needs a static IP

If you run servers or self-host services like Docker containers, Plex, Pi-hole, Nextcloud, or Proxmox VMs, you already know what a pain it is when the server changes IP and suddenly things stop working. A static IP keeps your services reachable, makes firewall and port forwarding rules predictable, and removes a frequent source of breakage from a home or lab network.

In the video I walk through two ways to set a static IP on Ubuntu Server 26.04. One is the beginner-friendly terminal GUI called nmtui. The other is the manual Netplan method for people who want full control. Below I cover the mental checklist and the exact steps you should think about before changing anything, plus some practical gotchas to avoid.

Two supported approaches at a glance

  • nmtui: A terminal GUI that makes it easy to pick an interface, set an address, and configure DNS and gateway without editing raw files. Great for beginners or quick changes.

  • Netplan: The manual, file-based approach where you edit the Netplan configuration directly. This is the method most admins use for scripted setups or when they want reproducible configuration in source control.

Both methods achieve the same end result. Pick whatever fits your comfort level.

Step 1. Find your network interface

Before you change anything you need to know which network interface your server is using. Many modern Ubuntu Server installations use predictable names like eno1 or enp3s0, but your system could be different depending on hardware and virtualization.

Take a moment to identify the correct interface. This is the one currently routing traffic between your server and the rest of your network. Changing the wrong interface will not help and can cause confusion.

Step 2. Choose the right static IP

Choosing an address is more than picking a free number. Here are the options and considerations:

  • Pick an IP outside your router's DHCP pool to avoid the router handing the same address to another device. Many routers let you shrink the DHCP range or reserve addresses, so check the router settings if you can.

  • Alternatively, use your router's static lease / DHCP reservation feature. That keeps the server using DHCP while guaranteeing the same address, which can be easier for some setups.

  • Stay inside the same subnet and use the correct subnet mask that your network uses. The gateway you set must be on the same network.

  • Avoid IPs already in use. Scan or check your router client list to ensure no conflict before you make the change.

Step 3. Configure DNS and gateway

A static address without correct DNS and gateway settings will leave your server unable to resolve names or reach the internet. When you configure a static IP you will also need to set:

  • Gateway: the router IP that forwards traffic off your subnet.

  • DNS servers: either your router's IP, a local resolver like Pi-hole, or public DNS providers. Choose what makes sense for your environment.

If your server needs access to network resources by hostname, DNS must be correct. If you rely on a local DNS resolver, point the static configuration to it.

Applying changes safely

This is the part where many people make a critical mistake. Netplan and network manager changes will alter the server's network stack immediately. If you are connected remotely over SSH and you apply a change with the wrong address or gateway you can lock yourself out.

Safe practices I always use:

  • Do the work from the server console if possible. If you are in front of the machine or have hypervisor console access, you can fix mistakes quickly.

  • If you must change the network remotely, schedule a maintenance window and make sure you have out-of-band access or a second way to reach the machine.

  • Before applying persistent changes, take a backup of existing configuration. With Netplan that means saving a copy of the current configuration file. With nmtui you can note down the previous values so you can revert.

  • After making changes, verify local connectivity and DNS resolution before closing your remote session. If you lose SSH, allow a few minutes and then try your known recovery steps.

What to check after applying

  • Can you ping the default gateway from the server using the new address? If not, gateway is likely wrong or on a different subnet.

  • Can the server resolve domain names? If DNS is misconfigured you will get errors even if routing is fine.

  • Can external services reach your server? Test any important ports or services from another machine on the network.

Common mistakes and a concrete gotcha to avoid

Gotcha: Changing network settings while connected only by SSH without an out-of-band console often leads to being locked out. If you are remote and the new static IP or gateway is incorrect, your SSH session will drop and you will not be able to reconnect. The only way to fix this is local console or hypervisor access.

Other common mistakes:

  • Choosing an IP inside the router DHCP pool and causing a conflict when the router assigns it to another device.

  • Forgetting to set DNS or setting the wrong gateway, which leaves you with a working IP but no internet or name resolution.

  • Mis-typing the interface name or editing the wrong configuration file and assuming the change took effect.

Which method should you use?

  • Use nmtui if you want a safe, guided interface that minimizes typing and is quick to learn. It reduces the chance of YAML formatting errors or syntax mistakes.

  • Use Netplan if you manage servers through automation, version config files, or you want the configuration in a text file you can put into git. Netplan is the right choice for reproducible infrastructure.

Final checklist before you make changes

  1. Confirm the server interface name.
  2. Pick an IP and verify it is not in use and not inside the DHCP pool.
  3. Note current DNS and gateway values and save a backup of current config.
  4. Make the change from console if possible, or ensure you have recovery access.
  5. Apply the change and verify connectivity and DNS.
  6. Update any firewall, router, or port forwarding rules that reference the old address.

Wrapping up

Setting a static IP on Ubuntu Server 26.04 is a small but critical step for reliable self-hosting. Whether you choose the nmtui terminal GUI or the manual Netplan route, do it carefully: pick the right address, set DNS and gateway properly, and never change network settings remotely without a recovery path. Follow the checklist above and you will avoid the most common headaches and outages.

If you liked the walkthrough in the video, hit Like and Subscribe for more practical Linux tips. Thanks for reading and see you in the next one. Josh

~ KeepItTechie

Source: YouTube Video

Your Ubuntu Server Needs a Static IP Address

Based on a YouTube video and enhanced with additional context.

Watch the original video on YouTube.Watch on YouTube
KeepItTechie Weekly

Get weekly Linux, homelab, and open-source content from KeepItTechie.

Practical write-ups, clean walkthroughs, and the kind of notes that save you time when you are building or fixing something real.

Related Articles

Keep Reading