In the Debian operating system, correctly configuring the IP address and DNS servers is a key step to ensure that the server can communicate correctly within the network. This article will guide you through the process of manually configuring a static IP address and DNS servers in Debian, as well as provide some network testing tips to verify the configuration.

How to Build a Static Dedicated IP

For servers, a static IP address is a common requirement because it ensures the stability of the server’s address. Here are the steps to set up a static dedicated IP in Debian:

1. Edit the Network Configuration File

In the system, this file is located at /etc/network/interfaces. Use the following command to open and edit the file:

vim /etc/network/interfaces

2. Configure the Network Interface

You will see the configuration section for network interfaces in the file. If you’re configuring the first network card, it will usually be eth0. For static IP configuration, you need to specify the inet static field and provide the IP address, subnet mask, and gateway address. Here’s an example configuration:

auto eth0
iface eth0 inet static

Replace the address, netmask, and gateway fields with your own network configuration.

3. Restart the Network Service

After saving and closing the file, you need to restart the network service to apply the new configuration. In Debian 8 system, use the following command:

systemctl restart networking

In Debian 9 system, you should use:

service networking restart

Configure DHCP to Obtain IP Automatically

If you want Debian to automatically obtain an IP address, you can change the network card configuration in the /etc/network/interfaces file to inet dhcp:

auto eth0
iface eth0 inet dhcp

Afterward, restart the network service to make the configuration take effect.

Modify DNS Server

The configuration of DNS servers is equally important as they are responsible for resolving domain names into IP addresses. In Debian, the DNS configuration file is located at /etc/resolv.conf. Please follow the steps below to modify it:

1. Edit the DNS Configuration File

Use a text editor to open the DNS configuration file:

vim /etc/resolv.conf

2. Add or Modify DNS Server Addresses

Add or modify the DNS server addresses in the file. For example:


You can configure multiple DNS server addresses as needed.