Configure Network Settings in Debian
How to setup a static IP address and configure network settings in Debian 11 (Bullseye)
List Network Interfaces
# List Network Interfaces
ip link show
Configure Network Settings
In Debian, the network is configured using the /etc/network/interfaces file. You can edit the file to configure a static IP address, subnet mask and default gateway.
This is what the default /etc/network/interfaces file looks like:
# Edit the /etc/network/interfaces file
nano /etc/network/interfaces
Change the interface from DHCP to static, enter the IP address, subnet mask and default gateway.
# The primary network interface allow-hotplug eth0 iface eth0 static address 192.168.1.26 netmask 255.255.255.0 gateway 192.168.1.1
When you've finished editing the file, it should look something like this:
Restart networking
# Restart networking
/etc/init.d/networking restart
Show network configuration
# Show the current network configuration
ip address show
Bring up the network interface
# Change state of network interface eth0 to up
ifup eth0
Test the network
Test the network settings by pinging the server's IP address
ping 192.168.1.26
Comments