I have tried two (2) different methods. The first method is the most prevalent on the internet, but it doesn't seem to persist after a reboot. I have looked at many YouTube videos and websites. When I reboot the VM, it goes right back to the DHCP address that it had before.
I want to set my VM with more than one (1) IP address and here's what I have tried.
METHOD 1 (which does NOT work after reboot)
Code: Select all
su
cp /etc/network/interfaces ~/
vi /etc/network/interfaces
Code: Select all
root@debian:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug enp0s3
iface enp0s3 inet dhcp
root@debian:~#
Code: Select all
# The loopback network interface
auto lo
iface lo inet loopback
#The primary network interface
auto enp0s3
iface enp0s3 inet static
address 192.168.1.190/24
iface enp0s3 inet static
address 192.168.1.191/24
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
Code: Select all
systemctl reboot
METHOD 2 (Which DOES work after reboot, but still retains the old, DHCP address, which I want to get rid of. I found this tutorial here: https://shape.host/resources/how-to-con ... -beginners ).
Code: Select all
su
vi /etc/systemd/network/20-wired-static.network
[Match]
Name=enp0s3
[Network]
Address=192.168.1.190/24
Address=192.168.1.191/24
Gateway=192.168.1.1
DNS=8.8.8.8
DNS=8.8.4.4
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
systemctl enable --now systemd-networkd
systemctl reboot
Thank you,
Andy