Static IP Configuration
Debian / Ubuntu
ifupdown
Edit /etc/network/interfaces
:
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
source /etc/network/interfaces.d/*
auto eth0
iface eth0 inet static
address <Your IPv4 address>/32
gateway 100.100.0.0
pointopoint 100.100.0.0
dns-nameservers 23.143.176.176 23.143.176.177
iface eth0 inet6 static
address <Your IPv6 address>/64
gateway fe80::1
And delete /etc/network/interfaces.d/eth0
netplan
Edit /etc/netplan/50-cloud-init.yaml
:
network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses:
- <Your IPv4 address>/32
- <one IPv6 address from your subnet, e.g. 2001:db8:0:3df1::1>/64
routes:
- to: 0.0.0.0/0
via: 100.100.0.0
on-link: true
gateway6: fe80::1
match:
macaddress: YOUR_MAC_ADDRESS
set-name: eth0
Then disable cloud-init network changes by adding file /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
:
network:
config: disabled
Fedora / CentOS / AlmaLinux / Rocky Linux
Edit /etc/cloud/cloud.cfg.d/98-disable-network.cfg
:
network:
config: disabled
Edit /etc/sysconfig/network-scripts/ifcfg-eth0
:
BOOTPROTO=static
DEVICE=eth0
DEFROUTE=yes
HWADDR=<Your MAC address, can be found via `ip l`>
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPADDR=<Your IPv4 address>
NETMASK=255.255.255.255
DNS1=23.143.176.176
DNS2=23.143.176.177
IPV6ADDR=<Your IPv6 address>/64
IPV6INIT=yes
IPV6_DEFAULTGW=fe80::1%eth0
IPV6_DEFAULTDEV=eth0
Edit /etc/sysconfig/network-scripts/route-eth0
:
100.100.0.0/32 dev eth0
default via 100.100.0.0 dev eth0
RouterOS
/ip address add address=<Your IPv4 Address> interface=ether1 network=100.100.0.0
/ip route add distance=1 gateway=100.100.0.0
/ipv6 address add address=<Your IPv6 Address>/64 interface=ether1 advertise=yes
/ipv6 route add gateway=fe80::1%ether1
VyOS
set interfaces ethernet eth0 address <Your IPv4 Address>/32
set protocols static route 100.100.0.0/32 interface eth0
set protocols static route 0.0.0.0/0 next-hop 100.100.0.0
set interfaces ethernet eth0 address <Your IPv6 Address>/64
set protocols static route6 fe80::1/128 interface eth0
set protocols static route6 ::/0 next-hop fe80::1