Skip to content

Setting the IP address in Debian

Note

Network interfaces in Debian are stored and configured through the configuration file /etc /networks/interfaces.

How to configure DHCP

Attention

Active DHCP services on external Ethernet interfaces are forbidden by the Terms and Conditions of services and the use of the site.

auto eth0
iface eth0 inet dhcp

How to set up a static IP address

The example of configuring a static IP address for an interface named eth0:

```bash
auto eth0
iface eth0 inet static
address 192.168.0.7
netmask 255.255.255.0
gateway 192.168.0.254
dns-nameservers 8.8.8.8 8.8.4.4
```

Attention

To work correctly for the dns-nameserver, you need to install the package resolvconf.

Use of configuration

After changing the configuration file, you need to reload the interface:

sudo bash -c "ifdown eth0 && ifup eth0"

You can check the network settings through the following command:

ip addr show