Need example netplan yaml for static ip [closed]
I want to migrate my network configuration to netplan. I have been using ifup/down and the /etc/network/interfaces file to configure my static IPs, but this has been deprecated and support will be withdrawn in the 17.10 release.
However
sudo netplan ifupdown-migrate
returns
enp0s3: method static is not supported
So how do I convert this /etc/network/interfaces
stanza?
auto enp0s3
iface enp0s3 inet static
address 192.168.0.123
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 8.8.8.8 8.8.4.4
- What does the complete file look like?
- How should it be named and placed?
Thank you.
After looking through the man page I came up with this:
network:
version: 2
ethernets:
enp0s3:
addresses: [192.168.0.140/24]
gateway4: 192.168.0.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]
It is named
/etc/netplan/01-systemd-networkd-eth.yaml
And it works.
This command was a great help:
netplan --debug generate
which pointed me to syntactical errors.
Breaking news. Just found this: https://insights.ubuntu.com/2017/07/05/quick-and-easy-network-configuration-with-netplan/