Support > About cloud server > Complete Guide to Setting a Static IP on Debian 10/11 Servers: Three Methods and Tips for Avoiding DNS Pitfalls
Complete Guide to Setting a Static IP on Debian 10/11 Servers: Three Methods and Tips for Avoiding DNS Pitfalls
Time : 2026-12-03 14:11:13
Edit : Jtti

In the operation and maintenance of cloud servers, switching an IP address from DHCP (automatic assignment) to a static IP is a fundamental step in establishing a stable network environment. For Debian 10 and 11, network management is currently in a transitional phase: the traditional `/etc/network/interfaces` method remains available, while `systemd-networkd` and NetworkManager are also options. The correct method to choose depends on which management service is currently active on your server. Selecting the wrong one can lead to the IP address "disappearing" after a reboot, or being overwritten by another service.

This guide focuses on server environments (without a desktop interface) and outlines three viable configuration methods, while highlighting common pitfalls encountered during DNS setup.

Step 1: Identify your network interface name and current network management system

Before making any changes, you must determine two things: the name of your network interface and which service is currently managing your network.

Run `ip a` to view your network interface names. On Debian 10/11 cloud servers, common names include `ens33`, `eth0`, `ens3`, etc.—refer to the actual output from your system.

Next, identify the active network management system by checking the status of the following services:

systemctl status systemd-networkd

systemctl status NetworkManager

systemctl status networking

The `networking` service corresponds to the traditional `/etc/network/interfaces` method; `systemd-networkd` is the built-in network manager for newer versions of Debian; and `NetworkManager` is typically found in desktop environments or certain cloud images. Having multiple network managers enabled simultaneously is the primary reason for IP addresses being lost or configurations failing to take effect after a reboot. Ensure that only the method you have chosen remains active.

Method 1: `/etc/network/interfaces` (The traditional approach, offering the best compatibility for servers)

This is the most universal method for Debian servers and is compatible with the vast majority of cloud server images. Edit the configuration file:

sudo nano /etc/network/interfaces

Keep the existing `auto lo` and `iface lo inet loopback` configurations, then add your network interface configuration using the following format (replace `ens33` with your actual network interface name, and substitute the IP, gateway, and DNS values ​​with your own):

ini

auto ens33

iface ens33 inet static

address 192.168.1.100

netmask 255.255.255.0

gateway 192.168.1.1

dns-nameservers 8.8.8.8 1.1.1.1

The `dns-nameservers` syntax is a convention parsed by the `resolvconf` or `openresolv` packages. If these packages are not installed on your system, this line may not take effect; in that case, please refer to the "DNS Configuration" section later in this guide.

After saving the file, apply the changes using one of the following commands:

sudo systemctl restart networking

# Or, for a specific network interface:

sudo ifdown ens33 && sudo ifup ens33

Note: If you are connected remotely via SSH, running `ifdown` will immediately terminate your connection, potentially preventing the subsequent `ifup` command from executing. A safer approach is to use `systemctl restart networking`, or to perform the configuration directly via the VNC/serial console provided by your cloud service provider's dashboard.

Method 2: systemd-networkd (the built-in method for newer versions of Debian)

If your system’s network is managed by `systemd-networkd` (verify this by running `systemctl status systemd-networkd` and checking that it is "active"), you should not modify `/etc/network/interfaces`, as doing so may cause conflicts between the two services. Create or edit a configuration file (you can choose any filename, provided it has the `.network` suffix):

sudo nano /etc/systemd/network/20-wired.network

Add the following content:

ini

[Match]

Name=ens33

[Network]

Address=192.168.1.100/24

Gateway=192.168.1.1

DNS=8.8.8.8

DNS=1.1.1.1

The `Address` field uses CIDR notation (IP address/prefix length); `24` corresponds to the subnet mask `255.255.255.0`. For multiple DNS servers, simply add a new `DNS=` line for each one.

After saving, restart the service:

sudo systemctl restart systemd-networkd

sudo systemctl enable systemd-networkd

Once `systemd-networkd` is enabled, ensure that the `networking` service is not also managing the same network interface. If there are any `auto` or `iface` declarations for this interface in `/etc/network/interfaces`, it is recommended to remove or comment them out so that management is handled by a single service.

Method 3: NetworkManager (`nmcli`; used in desktop environments and some cloud images)

If your system uses NetworkManager (i.e., the `nmcli` command is available), you can configure a static IP via the command line without needing to manually edit configuration files. View current connection names:

nmcli connection show

Assuming the connection name is `Wired connection 1` and the network interface is `ens33`, execute the following:

nmcli con modify "Wired connection 1" \

ipv4.method manual \

ipv4.addresses 192.168.1.100/24 ​​\

ipv4.gateway 192.168.1.1 \

ipv4.dns "8.8.8.8 1.1.1.1"

nmcli con up "Wired connection 1"

`ipv4.method manual` corresponds to static IP mode; `ipv4.addresses` uses CIDR notation, and DNS servers are specified via `ipv4.dns`.

DNS Configuration: Correct Locations for Different Methods

DNS is the part of a static IP configuration most prone to "not taking effect," as `/etc/resolv.conf` may be overwritten or managed by higher-level services.

If using `/etc/network/interfaces`: Add `dns-nameservers 8.8.8.8 1.1.1.1` within the `iface` section. Ensure that `resolvconf` or `openresolv` is installed on the system; otherwise, this line will not be written to `/etc/resolv.conf`.

If using `systemd-networkd`: Specify DNS servers using `DNS=` within the `[Network]` section of the `.network` file; name resolution will then be handled by `systemd-resolved`.

If using `NetworkManager`: Configure DNS via the `ipv4.dns` setting. It is also recommended to set `ipv4.ignore-auto-dns yes` to prevent DNS settings provided via DHCP from overwriting your configuration.

For temporary verification or troubleshooting, you can edit `/etc/resolv.conf` directly and add `nameserver 8.8.8.8`. However, this is only a temporary measure, as the file may be overwritten upon system reboot or when network services are reloaded. Verification and Troubleshooting

Once configuration is complete, perform the following checks in order:

ip a show ens33          # Verify that the IP address has been applied

ip route                 # Confirm the presence of a default gateway

ping -c 3 8.8.8.8        # Verify Layer 3 connectivity

ping -c 3 google.com     # Confirm that DNS resolution is functioning correctly

If the IP address is correct but you cannot access the internet, first check whether the gateway address resides on the same subnet as the IP. If you can reach an IP address but domain name resolution fails, verify that the DNS configuration is located in the correct file for your specific network management system. If an IP address "disappears" or reverts to DHCP after a reboot, it is almost always because multiple network managers are running simultaneously, or the configuration was written to a file that is not being read by the system.

A Stable Static IP Requires a Robust Network Foundation

While a static IP configuration ensures that an address remains constant, the underlying network quality—such as the optimization of return routes and the manageability of packet loss during peak evening hours—is what truly determines the user experience. If the cross-border link itself is unstable, a fixed IP address will not prevent unpredictable latency or packet loss for users.

Jtti’s cloud server solutions provide a solid network foundation for Linux environments, including Debian. Our Hong Kong and U.S. nodes utilize premium CN2 GIA routes with optimized direct connectivity across major carriers, keeping packet loss below 0.5% even during peak evening hours. This ensures that a "fixed" static IP translates into a truly "stable and accessible" connection. Every server comes standard with a dedicated public IP and exclusive bandwidth—ensuring clean IP resources and preventing bandwidth congestion from other users. Furthermore, our lifetime recurring discount policy makes long-term operational costs entirely predictable.

Relevant contents

What Is the Difference Between Cloud Server Snapshots and Custom Images? A Comprehensive Analysis of Backup and Deployment Scenarios Game Servers vs. Cross-Border E-Commerce Servers: A Comprehensive Analysis of Requirements and Selection Guide Scaling Up Cloud Servers in Hong Kong: Upgrade Existing Configurations or Purchase New Instances? Avoiding Pitfalls in Elastic Upgrades for Cloud Servers in Japan: Which Changes Require Verifying Potential Downtime Impacts First? Are security groups for cloud servers the same as firewalls? A clear guide to their respective roles and boundaries. A Holiday Marketing Guide for Small and Micro Enterprises: Capture Incoming Traffic While Keeping Costs Tightly Under Control Comprehensive Guide to Jtti’s 2026 Black Friday VPS Promotion: Flash Sales Starting as Low as $36 for 6 Months—Same Price for Renewals, No Hidden Tricks How to Determine If a VPS Is Oversold: Practical Testing Across Four Key Dimensions and a Guide to Avoiding Pitfalls Finally restocked! Jtti Japan's three direct-connected VPS stocks have been restored, and the first choice for low-latency cross-border website building/games Exposed Database Ports: Why 3306, 6379, and 27017 Are the Most Dangerous Entry Points on the Public Internet
Go back

24/7/365 support.Here for you 24/7/365.

Support