LKBEN11035: Howto configure a static ip address on a debian system


Symptom

You want to configure a static ip address

Cause

none

Solution

You configure the interfaces with /etc/network/interfaces. This file can be edited with a normal editor. I normally use vim to do the job.

The contents of the file looks like this:

 


# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp


 

To configure a static ip address you edit the file to look like the following. In this case, you configured the static

ip 192.168.123.8 with a netmask 255.255.255.0 (class C network) and the default gateway is 192.168.123.254


 

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 192.168.123.8
netmask 255.255.255.0
gateway 192.168.123.254

Disclaimer:

The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!

About the Author

Author: Wim Peeters - Keskon GmbH & Co. KG

Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.