Ubuntu 20.04 LTS & Netplan
Page content
Assume you got a fresh Machine with DHCP …
Ubuntu with DHCP Config
cat /etc/netplan/01-netcfg.yaml
# This is the network config written by 'subiquity'
network:
ethernets:
ens192:
dhcp4: true
version: 2
and you’d like to switch to Static IP, ask google how todo it an give try:
Static IP with Netplan
# This is the network config written by 'subiquity'
network:
version: 2
ethernets:
ens192:
addresses:
- 1.2.3.4/24
gateway4: 1.1.1.1
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
search:
- world.net
then reboot … and the machine is gone. ok, not really gone, but from IP perspective definitly. it just reboots and come back without default gateway :(
(vm)console, login, try again … and google got some help again.
Static IP with Netplan (Ubuntu 22.04 LTS and above)
# This is the network config written by 'subiquity'
network:
version: 2
ethernets:
ens192:
addresses:
- 1.2.3.4/24
routes:
- to: default
via: 1.2.3.1
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
search:
- world.net
another reboot and Ubuntu (and me) are happy again … ;)
Any Comments ?
sha256: aa45e25d8e241bfc69747f9f0b99d469666d01ef26b0ea2a7cddb311457854bd