Static IP configuration on Debian 8

Estimated reading time: 1 min

Introduction

There are two methods to assign network configuration to a device on the net. DHCP or static assignment. DHCP is normally set as default. Static configurations usually need IP addresses as well as DNS resolvers plus routing. In this tutorial, we will cover static IP configuration on Debian 8.

Prerequisites

  • Cloud VPS or Dedicated Server with Debian 8 installed.
  • You must be logged in via SSH as sudo or root user. This tutorial assumes that you are logged in as a sudo user.

Step 1: Log in using SSH

You must be logged in via SSH as sudo or root user. Please read this article for instructions if you don’t know how to connect.

Step 2: Find the active network interface

clear && echo $(ip -o -4 route get 8.8.8.8 | sed -nr 's/.*dev ([^\ ]+).*/\1/p')

Step 3: Configure the network interface

In our example, our network interface is eth0 with the following network details:

IPv4 = 193.33.61.85
Netmask = 255.255.255.0 
Gateway = 193.33.61.1
DNS 89.207.128.252, 89.207.130.252

Our article will use network interface eth0 and the server details described above. Your server details will not be the same as our article and your network interface name can be different then we use in our article. Use the network interface name you get from step 2.

Edit your network configuration file

sudo nano /etc/network/interfaces

Configure eth0

auto eth0
iface eth0 inet static
 address 193.33.61.85
 netmask 255.255.255.0
 gateway 193.33.61.1
 dns-nameservers 89.207.128.252 89.207.130.252

Apply the changes

sudo systemctl restart networking.service

Conclusion

Congratulations, you have now configured a static IPv4 for your Debian 8 operating system.

Was this article helpful?
Dislike 2
Views: 17786

Reader Interactions

Leave a Reply

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