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 (Arch, netctl):

/etc/netctl/enp5s0.profile

Example:

Description='Main ethernet connection'
Connection=ethernet
Interface=enp5s0
IP=static
Address=('192.168.1.98/24')
Gateway=('192.168.1.254')
DNS=('192.168.1.1 8.8.8.8')
DNSDomain=('mpd.local')

Leave a Reply

Don't like what I say? Leave!