How to set a static IP address on Ubuntu 22.04 (LTS)

ubuntuThis article will describe how to configure a static IP address with Ubuntu server.


00-installer-config.yaml

Start by using your preferred editor to edit the 00-installer-config.yaml file.

$ sudo vi /etc/netplan/00-installer-config.yaml

Change the dhcp4: true line and replace it with the following, using your IP address settings:

addresses:
    - 192.168.1.11/24
  nameservers:
      addresses: [8.8.8.8, 8.8.4.4]
  routes:
    - to: default
      via: 192.168.1.1

Note that these settings use Google DNS servers, and the routes via IP address setting is your gateway server.

To apply this change, run the following command:

$ sudo netplan apply

 

Thanks for visiting,
Steven