DHCP vs Static IP Explained (and How to Set Each)

Here is the short answer. DHCP means the router (or a DHCP server) hands each device its IP address automatically, for a set time called a lease. A static IP means you type the address on the device yourself, and it never changes. Use DHCP for devices that only use the network, like laptops and…

The YouTube player loads only when you press play. Open on YouTube

Here is the short answer. DHCP means the router (or a DHCP server) hands each device its IP address automatically, for a set time called a lease. A static IP means you type the address on the device yourself, and it never changes. Use DHCP for devices that only use the network, like laptops and phones. Give a fixed address to devices that others connect to, like servers, printers, cameras and the router. For printers and cameras, the easiest fixed address is a DHCP reservation on the router.

Watch the video: https://youtu.be/bOZV9Kfr7iE

This is part 2 of my Network Fix series. I checked the steps on 30 November 2026 against the official netplan documentation and Microsoft’s current Windows network settings help.

What every device needs

Every device on a network needs four settings:

SettingExampleWhat it does
IP address192.168.50.104The device’s own address
Subnet mask255.255.255.0 (/24)Which addresses are “local”
Gateway192.168.50.1Where traffic to other networks goes (usually the router)
DNS server192.168.50.1Turns names like mouhimen.dev into addresses

There are only two ways to get them: the network hands them out (DHCP), or you type them in (static). If /24 is new to you, read my subnetting guide for beginners first.

In this guide I use one small office network, 192.168.50.0/24, with the router on .1, a laptop (ABD-LAPTOP), a printer (HR-PRINTER) and an Ubuntu server (srv-web01) that runs a test site for mouhimen.dev.

DHCP vs static IP: the difference

DHCP (Dynamic Host Configuration Protocol). When my laptop joins the network, four messages fly:

  1. Discover: the laptop asks, “is there a DHCP server?”
  2. Offer: the router offers an address, for example .104.
  3. Request: the laptop asks for that address.
  4. Acknowledge: the router confirms, and the lease starts.

People remember it as DORA. The lease lasts a set time, for example 24 hours, and the device renews it before it runs out. After a few days away, a laptop can come back with a different address. For a laptop, that’s fine.

Static IP. You type all four settings on the device. The address never moves, even if the router is down.

DHCPStatic IPDHCP reservation
Who sets itThe routerYou, on each deviceYou, once, on the router
Address changes?It canNeverNever
Risk of conflictsVery lowHigh if inside the poolVery low
Best forLaptops, phones, guestsRouter, key serversPrinters, cameras, smart TVs

My tip: plan the addresses first

Before you set anything, split the network:

  • .1 the router
  • .2 to .49 static devices (servers, the NAS, switches)
  • .100 to .199 the DHCP pool (laptops and phones)
  • the rest spare

Static addresses and the DHCP pool never overlap, and that alone prevents most IP problems.

How to set a static IP on Windows 11

First, check what you have. Open Terminal and run:

ipconfig /all

DHCP Enabled . . . : Yes means the address came from DHCP, and you’ll see the lease times under it.

To set a static IP:

  1. Open Settings > Network & internet, then Ethernet (or Wi-Fi and your network).
  2. Next to IP assignment, select Edit.
  3. Change Automatic (DHCP) to Manual, and turn on IPv4.
  4. Fill in the four settings:
  5. IP address: 192.168.50.20
  6. Subnet mask: 255.255.255.0
  7. Gateway: 192.168.50.1
  8. Preferred DNS: 192.168.50.1
  9. Select Save. IP assignment now says Manual.

Notice I picked .20, outside the DHCP pool, so no other device will ever get it.

Back to DHCP: select Edit again, choose Automatic (DHCP), save, then get a fresh lease:

ipconfig /release
ipconfig /renew

How to set a static IP on Ubuntu with netplan

Ubuntu keeps its network settings in YAML files in /etc/netplan/:

ls /etc/netplan

On a cloud or server install you’ll often see 50-cloud-init.yaml. The DHCP version looks like this (enp3s0 is the network card; check yours with ip link):

network:
  version: 2
  ethernets:
    enp3s0:
      dhcp4: true

For a static IP, set dhcp4 to false and add the address, the default route and the DNS servers:

network:
  version: 2
  ethernets:
    enp3s0:
      dhcp4: false
      addresses:
        - 192.168.50.10/24
      routes:
        - to: default
          via: 192.168.50.1
      nameservers:
        addresses: [192.168.50.1, 1.1.1.1]

Two rules that save hours:

  • Use routes, not gateway4. Older guides use gateway4: 192.168.50.1. The netplan reference marks gateway4 as deprecated; use a routes entry with to: default instead.
  • Indent with spaces, never tabs. Each level is two spaces.

On a cloud image, cloud-init may rewrite 50-cloud-init.yaml on reboot. If your change disappears, put it in its own file (for example /etc/netplan/60-static.yaml) and disable cloud-init’s network config as the file’s own comment explains.

Now apply it safely:

sudo netplan generate
sudo netplan try

netplan generate checks the YAML first. netplan try applies the change and asks you to press Enter to keep it. If you don’t confirm within 120 seconds (the default timeout), it rolls back on its own. That’s your safety net over SSH.

Then check the result:

ip address show enp3s0
ip route

You should see inet 192.168.50.10/24 and default via 192.168.50.1 ... proto static. netplan status also shows the DNS servers.

If you host websites on this server, my Nginx reverse proxy guide picks up from here.

How to set a DHCP reservation on your router

A DHCP reservation gives you a fixed address without touching the device. The printer stays on DHCP, but the router always gives it the same address.

  1. Find the MAC address. It’s on the printer’s network settings page, or run arp -a on a PC in the same network and look for the printer’s current IP.
  2. Open the router’s admin page (often http://192.168.50.1), go to the DHCP settings and find Address Reservation. Some routers call it a static lease or a DHCP binding.
  3. Add the reservation: device name, the MAC address, and the address you want, for example 192.168.50.30. Save.
  4. Restart the printer. It comes back on .30, every time.

Why I like this: every fixed address lives in one place, the router. So for printers, cameras and smart TVs I use reservations. I only type a static IP on the router itself and on servers that must keep working even when DHCP is down, like a domain controller (see my Active Directory Domain Services guide for why a DC needs one).

Errors and fixes

1. The address starts with 169.254

ipconfig shows Autoconfiguration IPv4 Address . . : 169.254.x.x. The device asked for DHCP and nobody answered, so Windows gave itself an APIPA address (Automatic Private IP Addressing, range 169.254.0.0/16). It can’t reach the internet or other subnets.

Fix: check the cable or Wi-Fi, check DHCP is turned on in the router, check the pool isn’t full, then run ipconfig /renew. Windows also keeps checking for a DHCP server in the background and swaps the APIPA address for a real one when it finds it.

2. “Windows has detected an IP address conflict”

Two devices have the same address. Usually someone typed a static IP inside the DHCP pool, and later the router handed the same address to another device.

Fix: move the static address outside the pool (to .2–.49 in my plan), or delete it and use a DHCP reservation instead. arp -a shows which MAC address holds the IP.

3. Static IP set, but no internet

  • If ping 1.1.1.1 works but ping mouhimen.dev fails, the DNS field is empty or wrong. Add your router or a public DNS server.
  • If you can’t ping anything outside your network, check the gateway. It must be inside your own network: 192.168.5.1 on a 192.168.50.0/24 network will never work.

4. One wrong space locks you out of the server

A wrong indent in the netplan file, or a wrong address while you’re connected over SSH, and the server drops off the network. If it’s in a data center, that’s a long drive.

Fix: always run sudo netplan generate first, then sudo netplan try instead of netplan apply. If the connection dies, you can’t press Enter, so after 120 seconds netplan rolls back and you just connect again. If try times out, check the settings really reverted before you reboot.

FAQ

Is a static IP faster than DHCP?
No. Once a device has its address, traffic is exactly the same. DHCP only runs when the device joins and when it renews its lease.

Should my home or office printer have a static IP?
It needs an address that never changes, but a DHCP reservation on the router is usually the better way to give it one. You manage it in one place and there’s no risk of typing it inside the pool.

What’s the difference between a static IP and a DHCP reservation?
A static IP is set on the device and works even when the DHCP server is down. A reservation is set on the router: the device still uses DHCP, but always gets the same address.

Is this the same as a static public IP from my internet provider?
No. This guide is about private addresses inside your own network (like 192.168.50.x). A static public IP is the address your provider gives your connection on the internet, and you buy it from them.

What does 169.254 mean?
It’s an APIPA address. The device couldn’t reach a DHCP server, so it picked an address for itself. Fix the DHCP problem and renew the lease.

Keep going

Next in Network Fix (#3, Friday 11 December): VLAN Tutorial for Beginners: VLAN vs Subnet.

Some links in my video descriptions are affiliate links; I may earn a commission at no extra cost to you. The voice-over is made with ElevenLabs.

Leave a Reply

Your email address will not be published. Required fields are marked *