How to Configure Static IP Address on Ubuntu Server 24.04

To configure a static IP address on your Ubuntu Server 24.04, follow the steps below:

Step 1 : First, ensure your system is up to date and install the net-tools package, which includes the ifconfig command:

Step 2 : Check the list of Ethernet interfaces to identify the one you want to configure:

Step 3 : Open the netplan configuration file for editing:

Step 4 : Add the following configuration snippet to assign a static IP address to your chosen Ethernet interface (replace "ensX" with your actual interface name and adjust the IP address, netmask, gateway, and DNS servers as needed):

Step 5 : Apply the changes to the netplan configuration:

Step 6 : Verify that the static IP address is configured correctly by pinging a reliable external host, such as Google:

Congratulations! You have successfully configured a static IP address on your Ubuntu Server 24.04.