I have a VirtualBox VM running Debian (bookworm) that I'm having trouble setting a static IP address for, and at the same time prevent it from requesting a DHCP address..
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)
I want to change this:
to this:
When the VM comes back up, the same DHCP address that was assigned before (192.168.1.171) is still there and active. I can't ping the new address nor can I SSH to the new address. I'm stumped. I hope someone can spot what I'm doing wrong.
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 ).
I welcome your input as to which method is "correct" and/or what I am doing wrong. Also, how do I eliminate the NIC from requesting (and receiving) a DHCP address?
Thank you,
Andy
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:
sucp /etc/network/interfaces ~/vi /etc/network/interfaces
Code:
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 interfaceauto loiface lo inet loopback# The primary network interfaceallow-hotplug enp0s3iface enp0s3 inet dhcproot@debian:~#
Code:
# The loopback network interfaceauto loiface lo inet loopback#The primary network interfaceauto enp0s3iface enp0s3 inet staticaddress 192.168.1.190/24iface enp0s3 inet staticaddress 192.168.1.191/24gateway 192.168.1.1dns-nameservers 8.8.8.8 8.8.4.4
Code:
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:
suvi /etc/systemd/network/20-wired-static.network[Match]Name=enp0s3[Network]Address=192.168.1.190/24Address=192.168.1.191/24Gateway=192.168.1.1DNS=8.8.8.8DNS=8.8.4.4echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.confsystemctl enable --now systemd-networkdsystemctl reboot
Thank you,
Andy
Statistics: Posted by Andy — 2024-06-24 16:32 — Replies 11 — Views 139