ok, my file is located at /etc/netplan/50-cloud-init.yaml
I changed the IP address as a static IP address as following:
network:
version: 2
renderer: netwokrd
ethernets:
dhcp4: no
dhcp6: no
addresses: [10.0.2.100/24]
gateway4: 10.0.2.1
nameservers:
addresses: [10.0.2.100]
Then, I typed sudo netplan apply, and there was not any error message.
BUT, when I typed ifconfig, it still remail past IP address on enp0s3.
Do you guys know why this happen?
Best Answer
Netplan is fussy about how .yaml files are formatted. Don't try to "pretty-fy" them.
Is
50-cloud-init.yaml
the only .yaml file in/etc/netplan
?So edit your .yaml file to look like this...
then do:
and recheck your
ifconfig
output.Note: if it was me, I'd let NetworkManager manage this interface, and set the static address information into the "Wired Connection" profile.
then do: