Systemd: Setup a static IP Address


an very often requested issue. I will show this on Debian Jessie

We assume we want to set a static IP Address for eth0

Create new file /etc/systemd/network/ Name is not importend, just the prefix network.

# You can also use wildcards. Maybe you want enable dhcp
# an all eth* NICs
# static IP
# netmask

Move your previously used /etc/network/interfaces to /etc/network/ The file is no longer needed (for eth0). If some other NICs defined there leave it and just remove all entries regarding to eth0.

root@debdeb:~# mv /etc/network/interfaces /etc/network/

and enable systemd-networkd unit

root@debdeb:~# systemctl enable systemd-networkd.service

Define DNS Server. You can add the DNS Server either in the Network section of the NIC adapter config (see above) or in /etc/systemd/resolved.conf
Create a symlink

root@debdeb:~# mv /etc/resolv.conf /etc/
root@debdeb:~# ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

and enable systemd resolver

root@debdeb:~# systemctl enable systemd-resolved.service


Advertisment to support

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.