How to Setup a Static IP Address on Debian Linux

Setting up a static IP address on Debian Linux requires a few steps, but it can provide more stability and control than using DHCP. Here’s a step-by-step guide:

  1. Log in to the server using SSH. You’ll need administrative privileges to configure network settings.
  2. Find the network interfaces available on the server. You can use the “ip addr” command to list the interfaces and their current configuration.
sudo ip addr
  1. Determine the IP address currently assigned to the interface you want to configure. You can find this information in the output of the “ip addr” command.
  2. Edit the /etc/network/interfaces file to set a static IP address for the interface. You can use a text editor such as nano to edit the file. Here’s an example configuration for setting a static IP address:
auto eth0
iface eth0 inet static
    address 192.168.1.100
    netmask 255.255.255.0
    gateway 192.168.1.1

In this example, we set the static IP address for the eth0 interface to 192.168.1.100, with a netmask of 255.255.255.0 and a gateway of 192.168.1.1. Replace these values with the appropriate values for your network.

  1. Save the changes to the /etc/network/interfaces file and exit the text editor.
  2. Restart the networking service to apply the changes. You can use the following command to restart the networking service:
sudo systemctl restart networking

After restarting the networking service, the interface should have the static IP address you configured. You can verify the configuration by running the “ip addr” command again.

In summary, setting up a static IP address on Debian Linux involves editing the /etc/network/interfaces file to configure the interface with a static IP address, netmask, and gateway. After saving the changes and restarting the networking service, the interface should have the new static IP address.

Visited 153 times, 1 visit(s) today

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top