To set up a static IP address on a Debian Linux 10/11 system, follow these steps:
sudo nano /etc/network/interfaces
eth0 for a wired Ethernet connection or wlan0 for a wireless connection. The interface should be defined as follows:auto <interface> iface <interface> inet dhcp
Change the dhcp part of the configuration to static so that the interface is configured with a static IP address.
Below the iface line, add the following lines to specify the static IP address, subnet mask, and default gateway:
address <static IP address>
netmask <subnet mask>
gateway <default gateway>
For example, if you want to set the IP address to 192.168.1.100, the subnet mask to 255.255.255.0, and the default gateway to 192.168.1.1, the configuration would look like this:
auto <interface>
iface <interface> inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
Save the file and exit the text editor.
Restart the network interface by typing the following command:
sudo ifdown <interface> && sudo ifup <interface>
ip addr show <interface>
The output should display the static IP address that you specified in the configuration file.