Quantcast
Channel: Ubuntu Forums - Virtualisation
Viewing all articles
Browse latest Browse all 4211

[ubuntu] How to assign a permanent static IP address in 18.04

$
0
0
I am running an Ubuntu 18.04 server in Hyper-V on Windows 2012 R2. I am familiar with assigning static IPs in Mint 18.3 via the GUI tools, but not using only the CLI. I tried creating a 99_config.yaml file in the netplan directory that contains the following:
Code:

  network:
      version:  2
      ethernets:
          eth0:
              dhcp4:  false
              dhcp6:  false
              addresses:  [192.168.20.20/24]
              gateway4:    192.168.20.1

If I try to include lines for renderer or nameservers, I would get error messages when I ran the netplan apply command. The above does work and sets the IP address. The problem is that it doesn't always work automatically when I reboot and uses DHCP for an address. This messes up my client PCs using the MySQL server on my Ubuntu server.

What should I be doing to fix this? Thank you.

Viewing all articles
Browse latest Browse all 4211

Trending Articles