James Crook, web geek ++

How to set a static IP address in Debian

03 Feb 2012

In order to connect VOIP phones to my Dreamplug PBX I need to make my device have a static IP on the local network.

By default the device will be given an IP automatically. Type 'ifconfig' to see the current setup. Pay attention to the important information as some of this will need to be replicated correctly once we are managing these settings ourselves.

My Dreamplug is running Debian. To configure a static IP in Debian you edit the file /etc/networking/interfaces

There is a line that will say:

Iface eth0 inet dhcp

This means the device is getting its IP automatically from a DHCP server. This needs to be changed to the settings below, using the values you found from ifconfig for everything except the IP address (the 'address' line). Set the 'address' line to your preferred static IP.

iface eth0 inet static
address 192.168.141.162
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.141.255
gateway 192.168.141.150

To apply this configuration restart the networking service by typing:

ifdown eth0 && ifup eth0

If you're connected over SSH you'll get disconnected because of the IP change, so reconnect using the new IP and you should be up and running.

Categories: 

Add new comment