Ubuntu interfaces file examples

Example 1 – Includes some static routes and manually specified IP’s

auto lo
iface lo inet static
address 103.90.59.9/32

auto ens3
iface ens3 inet static
address 172.2.1.17
network 172.2.1.0
netmask 255.255.254.0
up route add -net 172.2.0.0 netmask 255.255.0.0 gw 172.2.1.1
up route add -net 172.2.0.0 netmask 255.255.0.0 gw 172.2.1.1

iface ens3 inet6 static
address 2405:cc:ee:110::7
netmask 64
autoconf 0
accept_ra 0
gateway 2405:cc:ee:110:ff:ff

auto ens4
iface ens4 inet static
address 172.23.2.12
network 172.23.2.0
netmask 255.255.255.0
gateway 172.23.2.254

source /etc/network/interfaces.d/*.cfg