Here is a procedure that will show you how to assign a fixed ip address on a machine with Debian 11 as the operating system. This procedure will contain the step-by-step how to assign a fixed IP address on your Debian machine.
Assigning a fixed Debian ip
Edit the configuration file of your ip address
To define a fixed ip address on debian you have to edit a configuration file :
Or with the nano editor :
# 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.1.xxx netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.254 #dns-domain example.com dns-nameservers 192.168.1.101
The important elements to edit are :
iface eth0 inet static : set the eth0 network interface to static
address : corresponds to chosen address
gateway : is the network gateway
network : allows to specify in which network this equipment belongs
It is also possible to define fixed IP addresses via a DHCP server. The use of a DHCP (Dynamic Host Configuration Protocol) server is more practical because it centralizes all the configurations of the machines that are present in your network, but in addition to that DHCP servers are able to manage network configurations dynamically for devices that do not require static (fixed) configuration in order to avoid saturation of use of all the IP addresses available in the network.