LKBEN11113: Howto configure a static IP Address on a debian GNU Linux System
LKB | Created: 02/04/2020 | Version: 0 | Language: EN | Rating: 0 | Outdated: False | Marked for deletion: False
Author: Wim Peeters - Keskon GmbH & Co. KG
Symptom
You need to change from DHCP to static IP addressing for some reason
Cause
Static IP addressing is often used on server systems
Solution
To configure a static IP (an IP that will never change) in debian you must edit the file
/etc/networking/interfaces and put the following:
CODE
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
auto lo
iface lo inet loopback
# The first network card - this entry was created during the Debian installation
# (network, broadcast and gateway are optional)
auto eth0
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
This information can even take DNS information too!
e.g.
allow-hotplug eth0
iface eth0 inet static
address 192.168.10.11
netmask 255.255.255.0
broadcast 192.168.11.255
gateway 192.168.10.1
dns-domain lan
dns-nameservers 192.168.10.6
The reconfiguration of the network CANNOT be done with a dpkg-reconfigure command! This is only supported during installation.
To reconfigure the only thing to do is edit /etc/network/interfaces with a text editor, once
saved /etc/networking/interfaces you can restart networking with /etc/init.d/networking restart.
/etc/init.d/networking stop
/etc/init.d/networking start
/etc/init.d/networking restart
The network configuration package ifupdown delivers the basic networking functionality. The resolvconf package is used to supplement ifupdown to support reconfiguration of network address resolution by automating the writing of /etc/resolv.conf.
About the Author
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 in different European countries and different European languages. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform where he is one of the most important contributors and the main developer.