For a clean installation for Ubuntu Server 24.04 through VirtualBox and to define a static ip was created and edited the /etc/netplan/01-netcfg.yaml
file as follows
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: no
addresses: [192.168.1.41/24]
routes:
- to: default
via: 192.168.1.1
nameservers:
addresses: [<DNS1>, <DNS2>]
When the following commands are executed
sudo netplan generate
sudo netplan apply
All works fine and when the ip a
command is executed appears something as follows:
inet 192.168.1.41/24 ... scope global enp0sN
inet 192.168.1.34/24 ... scope global secondary dynamic enp0s3
The first ip is the desired static ip already configured but observe that appears a secondary ip and even being dynamic. It is not desired to avoid collisions of ips within the same LAN
Question I
- How to remove the secondary ip dynamic through
netplan
itself? Is possible?
By command the following works:
sudo ip addr del 192.168.1.34/24 dev enp0s3
It confirmed again with the ip a
command but if the server is restarted appears again the same secondary dynamic ip
Question II
- How to make the
ip addr del ...
command settings permanently? Even after reboot