1. Knowledge base
  2. Networking
  3. Static IP Configuration on Debian 7

Static IP Configuration on Debian 7

Updated on 17 April 2023 2 min read Snel.com support team

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 7.

Prerequisites

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.

Find the active network interface

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

Configure the network interface

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

Code
IPv4 = 192.168.0.100Netmask = 255.255.255.0 Gateway = 192.168.0.1DNS 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

Code
sudo nano /etc/network/interfaces

Configure eth0

Code
auto eth0iface eth0 inet static address 192.168.0.100 netmask 255.255.255.0 gateway 192.168.0.1 dns-nameservers 89.207.128.252 89.207.130.252

Apply the changes

Code
sudo /etc/init.d/networking restart

Conclusion

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

Was this article helpful?

Spot a mistake in this article? Email us at support@snel.com

This article was last checked on 17 April 2023. · 9,231 views

Your own VPS online within 2 minutes

Windows or Linux, root access and hosted in Rotterdam.

View VPS from € 6.99

Support

Can't figure it out? We are happy to help

You always talk to a real engineer. We typically respond within 15 to 30 minutes, and 24/7/365 for outages.

Call us

+31 88 3 088 099

Create a ticket

Through the client area we immediately see which service it is about.

Email us

Send your question via the contact form, also outside office hours.