Mastodon Mastodon - Configure static IP address on Debian systems
 logo
  • Home 
  • Tags 
  • Blog posts 
  1. Home
  2. Blog posts
  3. Configure static IP address on Debian systems

Configure static IP address on Debian systems

Posted on October 29, 2021  (Last modified on July 11, 2024) • 1 min read • 188 words
Linux   Linux: Debian   Solved   Network  
Linux   Linux: Debian   Solved   Network  
Share via

I have now two home servers in two locations, and they should be “identical”. Both have a static IP address, which is surprisingly hard to configure, since there are actually four different ways in doing it:

  • netplan (Ubuntu only it seems)
  • ifup/down
  • NetworkManager
  • systemd-networkd

I am using the last one, systemd-networkd. This is how it’s done:

  1. uninstall network-manager: apt-get remove network-manager
  2. make sure the only configured interface in /etc/network/interfaces is lo
  3. create /etc/systemd/network/10-static.network (contents below)
  4. enable (do not start!) systemd-resolved: systemctl enable systemd-resolved
  5. enable (do not start!) systemd-networkd: systemctl enable systemd-networkd
  6. convert /etc/resolv.conf to a symlink: ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
# FILE: /etc/systemd/network/10-static.network

[Match]
Name=enp*                   # match the name of your hardware eth interface

[Network]
Address=192.168.10.10/24    # your IP including netmask
Gateway=192.168.10.1        # your default gateway
DNS=8.8.8.8                 # your dns server
Domains=mi.casa             # your domain search paths

If you plan to run a DNS server on the same host, do this:

  1. Use DNS=192.168.10.10 in the file 10-static.network (point to the same host)
  2. Add DNSStubListener=no to the file /etc/systemd/resolved.conf

… otherwise you’ll run into port troubles, cause both systemd-resolved and your DNS server want to own port 53.

Now REBOOT.

 Home Assistant behind proxy
AWS - auto-join Windows clients to a managed AD 
In case you want to follow me

Here are some links. The further to the right, the less active.

           
(c) Axel Bock | Powered by Hinode.
Link copied to clipboard
Code copied to clipboard