Skip to main content

Set static IP on Ubuntu Server

Step 1: Check the current state

After editing the NIC, the NIC IP is 132.0.0.190.

NIC information for an Ubuntu VM on FPT Cloud Portal

  1. Open Console and sign in to the instance.
  2. Run ifconfig to view the current IP address.

Output of ifconfig command in the Ubuntu VM Console

Step 2: Open the network configuration file

Open the file 00-installer-config.yaml with:

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

File 00-installer-config.yaml open in the vi editor

Press i to enter Insert mode.

Step 3: Update the configuration values

Edit the IP address, gateway, and DNS to match the new configuration.

Editing IP parameters in the netplan configuration file

Press Esc, type :wq, then press Enter to save and exit.

Saving the configuration file with  in vi

Step 4: Apply the changes

Run the following command to apply the new network configuration:

sudo netplan apply

Output of sudo netplan apply command

Step 5: Verify the new IP address

Run ifconfig again to confirm the IP address has been updated.

ifconfig output showing the new static IP after applying configuration

Confirming connectivity with the new static IP address