Guides

Static IP address: what it is, and how to set one on Linux and Windows

A static IP stays the same every time; a dynamic one is handed out fresh. What that means in practice, and how to set a static IP with netplan, nmcli and on Windows.

Published ~8 min read

Short answer: a static IP address is one that stays the same every time a device connects — assigned by hand or reserved for it — instead of being handed out fresh from a pool each time, which is how a dynamic IP works. Below: which one you have, why a server needs a static IP and a home connection usually does not, and how to set one on Debian, Ubuntu, RHEL-family distributions and Windows.

Static IP vs dynamic IP

Static IPDynamic IP
Assigned byYou, or reserved for your deviceDHCP server, from a pool, each time
Changes?No, unless you change itCan change on reconnect or lease renewal
Typical useServers, printers, VPNs, firewall rulesLaptops, phones, most home internet
CostOften a paid add-on from an ISP; included on a VPSUsually the default, free

Every VPS, by contrast, gets a static IP from the first boot — the provider assigns it to that virtual machine and it does not change on reboot, which is exactly why you can point a domain’s DNS record at it once and leave it.

Why a static IP matters

A DNS A record, a firewall allowlist rule, an SSH known_hosts entry and a VPN peer configuration all point at an IP address directly. If that address can change without warning, every one of those breaks the moment it does. That is the entire reason to care: nothing about a static IP makes a connection faster or more secure by itself, it only makes the address something else can depend on.

How to tell which one you have

On a home or office connection, the ISP almost always hands out a dynamic IP unless you asked for and paid for a static one — check the contract or ask support. On a server you rent, read the provider’s panel: a VPS or dedicated server’s main IP is static by definition, assigned to that machine for as long as you have it.

See the address your machine currently has
# Linux
ip -4 addr show scope global

# Windows (PowerShell)
Get-NetIPAddress -AddressFamily IPv4 | Where-Object { $_.PrefixOrigin -ne 'WellKnown' }

PowerShell’s PrefixOrigin column reads Manual for a static address and Dhcp for one leased from a DHCP server. On Linux, the only way to be sure is to check the configuration file or tool below — the running address looks identical either way.

Setting a static IP on Debian and Ubuntu (netplan)

Both distributions configure networking through netplan since Ubuntu 18.04 and Debian 12. Find your file and interface name first:

Debian · Ubuntu
ls /etc/netplan/
ip link show   # note the interface name, e.g. eth0 or enp1s0
/etc/netplan/50-cloud-init.yaml (or your file)
network:
  version: 2
  ethernets:
    eth0:
      dhcp4: no
      addresses:
        - 203.0.113.10/24
      routes:
        - to: default
          via: 203.0.113.1
      nameservers:
        addresses: [1.1.1.1, 9.9.9.9]
Apply it
sudo netplan try    # shows a preview, reverts automatically if it breaks the connection
sudo netplan apply

A VPS from a provider that uses cloud-init may regenerate /etc/netplan/50-cloud-init.yaml on the next boot and overwrite your edit — if that happens, put the static configuration in a new file instead, such as /etc/netplan/99-static.yaml, which netplan merges on top of the generated one.

Setting a static IP on RHEL, Rocky and AlmaLinux (nmcli)

Rocky · AlmaLinux · RHEL
nmcli connection show                 # find the connection name, often "eth0" or "System eth0"

sudo nmcli connection modify eth0 \
  ipv4.addresses 203.0.113.10/24 \
  ipv4.gateway 203.0.113.1 \
  ipv4.dns "1.1.1.1 9.9.9.9" \
  ipv4.method manual

sudo nmcli connection up eth0

nmcli connection modify only edits the saved profile; nothing changes until connection up re-applies it, which briefly drops the interface the same way the netplan apply does — again, have console access ready.

Setting a static IP on Windows

PowerShell (Administrator)
# Find the interface alias first
Get-NetAdapter

New-NetIPAddress -InterfaceAlias "Ethernet" -IPAddress 203.0.113.10 -PrefixLength 24 -DefaultGateway 203.0.113.1
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses 1.1.1.1,9.9.9.9

The same settings are in Settings → Network & internet → Ethernet → IP assignment → Edit, switched from “Automatic (DHCP)” to “Manual”, for anyone who would rather not use PowerShell.

The address format above is IPv4; the same static/dynamic distinction applies to IPv6 addresses, though most consumer ISPs still hand out only a dynamic IPv6 prefix even on a static IPv4 plan.

Every VPS comes with a static IPv4 address included — there is nothing extra to configure on the provider’s side, only inside the operating system if you add a second address or change the default one.

Frequently asked

What is a static IP address?

An IP address assigned to a device that stays the same every time, rather than being handed out fresh from a pool on each connection the way a dynamic IP is. Servers, VPNs and printers typically use one; most home internet connections use a dynamic one by default.

Is a static IP more secure than a dynamic one?

No — the address type itself has nothing to do with security. A static IP is simply predictable, which is exactly what a DNS record, firewall rule or VPN configuration needs to keep working.

Does my VPS already have a static IP?

Yes. A VPS or dedicated server's main IP address is static by definition — the provider assigns it to that virtual machine and it does not change on reboot, which is why you can point a domain at it once.

How do I know if my home internet connection has a static or dynamic IP?

Check your contract or ask your ISP — most residential connections are dynamic by default, and a static IP is usually a paid add-on. ipconfig (Windows) or ip addr (Linux) only shows the address you currently have, not whether it can change.

Related articles

All guides