How to set ip address static on ubuntu server 22.04
Setting up a static IP address on Ubuntu Server 22.04 is an essential step for creating a reliable and stable network environment. Unlike dynamic IPs assigned by DHCP, a static IP ensures your server keeps the same address even after rebooting. In this guide, you’ll learn how to configure a static IP using Netplan, the default network management tool in Ubuntu 22.04. We’ll cover how to identify your network interface, edit the YAML configuration file, and apply the new IP settings safely. You’ll also learn how to verify connectivity, test DNS resolution, and troubleshoot common issues. Setting a static IP is especially important for servers running services like GLPI, Zabbix, or Apache. Follow this step-by-step tutorial to make your Ubuntu Server network stable and ready for production use.
Step 1: Check IP SSH
Step 2: SSH create file:
sudo nano /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
Add
network: {config: disabled}
Save (Ctrl+O, Enter, Ctrl+X).
Step 3: Remove file config old cloud-init
sudo rm /etc/cloud/cloud.cfg.d/90-installer-network.cfg
Step 4: Edit file netplan/yaml
network: version: 2 ethernets: ens18: dhcp4: no addresses: – 192.168.16.160/24 gateway4: 192.168.16.1 nameservers: addresses: – 8.8.8.8 – 8.8.4.4
Save file sudo netplan apply sudo reboot
Step 5 (option) Set time (IF Vietnam)
sudo timedatectl set-timezone Asia/Ho_Chi_Minh