Static IP

Debian/Ubuntu based:

/etc/network/interfaces

Example:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
	address 192.168.1.98
	netmask 255.255.255.0
	broadcast 192.168.1.255
	gateway 192.168.1.1
	network 192.168.1.0
	dns-search mpd.local
	dns-nameservers 192.168.1.1 8.8.8.8

RedHat based:

/etc/sysconfig/network-scripts/ifcfg-eth0

Example:

DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
TYPE=ethernet
IPADDR=192.168.1.98
NETMASK=255.255.255.0
BROADCAST=192.168.1.255
NETWORK=192.168.1.0
GATEWAY=192.168.1.1
PEERDNS=yes
DNS1=192.168.1.1
DNS2=8.8.8.8

systemd-networkd:

/etc/systemd/network/10-enp5s0.network
[Match]
Name=enp5s0
[Network]
Address=192.168.1.98/24
Gateway=192.168.1.254
DNS=192.168.1.1

Leave a Reply

My notes for future me