Configuring a static IP address in Debian ensures your system always uses the same IP, which is essential for servers, network devices, and services like web hosting, file sharing, or SSH access.

Debian provides multiple ways to set a static IP:
- Using the /etc/network/interfaces file (traditional method).
- Using systemd-networkd (modern method).
- Using NetworkManager (for desktop environments).
Let’s go through each method in detail.
1. Check Your Current Network Configuration.
Before setting a static IP, check your current network interface name and details.
ip addr show
or
ip a
Typical interface names could be:
eth0
ens33
enp0s3
wlan0
(for Wi-Fi)
Also, note down:
- Current IP address
- Subnet mask
- Gateway
- DNS servers
2. Setting Static IP Using /etc/network/interfaces
.
This is the classic method used in Debian servers (especially Debian 9/10).
Step 1: Edit the Interfaces File.
Open the configuration file:
sudo nano /etc/network/interfaces
Step 2: Example Configuration.
Replace enp0s3
with your actual interface name.
# Loopback interface
auto lo
iface lo inet loopback
# Primary network interface (static)
auto enp0s3
iface enp0s3 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
Step 3: Restart Networking.
sudo systemctl restart networking
Check new IP:
ip a
3. Setting Static IP Using systemd-networkd
(Debian 11/12 Preferred).
Modern Debian versions use systemd-networkd for network configuration.
Step 1: Create a Network File.
Go to systemd network directory:
sudo nano /etc/systemd/network/20-wired.network
Step 2: Example Static IP Configuration.
[Match]
Name=enp0s3
[Network]
Address=192.168.1.100/24
Gateway=192.168.1.1
DNS=8.8.8.8 8.8.4.4
Step 3: Enable and Restart Services.
sudo systemctl enable systemd-networkd
sudo systemctl restart systemd-networkd
sudo systemctl restart systemd-resolved
Verify:
ip a
systemd-resolve --status
4. Setting Static IP Using NetworkManager (For Desktop Users).
If you are on Debian Desktop (GNOME, KDE, XFCE), you likely have NetworkManager managing connections.
Method 1: GUI.
- Click on the network icon in the system tray.
- Select your network → Settings.
- Go to the IPv4 tab.
- Change method from Automatic (DHCP) to Manual.
- Enter:
- Address:
192.168.1.100
- Netmask:
255.255.255.0
- Gateway:
192.168.1.1
- DNS:
8.8.8.8
- Address:
- Save & reconnect.
Method 2: CLI (nmcli).
nmcli con show
Find your connection name (e.g., Wired connection 1
), then set a static IP:
nmcli con mod "Wired connection 1" ipv4.addresses 192.168.1.100/24
nmcli con mod "Wired connection 1" ipv4.gateway 192.168.1.1
nmcli con mod "Wired connection 1" ipv4.dns "8.8.8.8 8.8.4.4"
nmcli con mod "Wired connection 1" ipv4.method manual
nmcli con up "Wired connection 1"
5. Verify Static IP Configuration.
After applying any method, confirm:
ip addr show
Ping a website to check connectivity:
ping -c 4 google.com
Check DNS resolution:
systemd-resolve --status
6. Tips and Troubleshooting.
- If the interface doesn’t come up, check logs:
journalctl -u networking
- Ensure no two methods (interfaces file, systemd-networkd, NetworkManager) are conflicting. Otherwise it may fail to work.
- For servers, disable NetworkManager if you prefer manual/static configuration:
sudo systemctl stop NetworkManager
sudo systemctl disable NetworkManager
Final Words.
Setting a static IP address in Debian Linux ensures consistent connectivity, especially for servers and remote access.
- Use
/etc/network/interfaces
for older servers. - Use
systemd-networkd
for Debian 11/12 servers. - Use NetworkManager for desktop environments.
With these methods, you can choose what fits best for your system setup.
Leave a Reply