Network Static IP

Last Edit: 2023.11.07

Debian / Ubuntu


Configure network interface static IP addresses.


  • Logged in as administrative user.

Network Interface

Configure network interfaces by creating a configuration file for each interface in the /etc/network/interfaces.d/ directory.


Use the command ip a for a list of all network interfaces on a system. Note the name of the network interface to configure. For example, eth0 will be used.

sudo nano /etc/network/interfaces.d/eth0

Configure the interface as required by the network.

  • auto / iface: The name of the interface, eth0.
  • address: IP address for the system.
  • netmask: Subnet mask for the network.
  • gateway: IP address of the router on the network.
  • dns-nameservers: Use the router address for the DHCP configured DNS servers, or specify others.
auto eth0
iface eth0 inet static


Apply the network changes by either rebooting the system or restarting the network interface. Reboot if connected via SSH on the modified interface.

sudo reboot
sudo ifdown eth0 && sudo ifup eth0

When using SSH, be sure to modify the SSH configuration on the client before reconnecting to the system.

sudo nano ~/.ssh/config


1 2

  1. Debian. “Debian Documentation.” 2024. ↩︎

  2. Debian. “Debian Network Configuration.” 2023. ↩︎