Method 1: Using Netplan (Recommended for Server & Terminal)
- Find your interface name by running ip a:Look for your active network card name (such asbash
ip aUse code with caution.ens18oreth0). - Open the Netplan configuration file in
/etc/netplan/:(Note: The exact filename might vary, such asbashls /etc/netplan/ sudo nano /etc/netplan/00-installer-config.yamlUse code with caution.01-netcfg.yamlor50-cloud-init.yaml) - Edit the YAML file using 2 spaces for indentation (do not use tabs):(Replaceyaml
network: version: 2 renderer: networkd ethernets: ens18: dhcp4: false addresses: - 192.168.1.100/24 routes: - to: default via: 192.168.1.1 nameservers: addresses: - 8.8.8.8 - 1.1.1.1Use code with caution.ens18with your interface name, and adjust the IP address, gateway via, and DNS addresses to fit your network). - Apply the changes:You can usebash
sudo netplan applyUse code with caution.sudo netplan tryfirst to safely test the configuration before committing
0 Response to "set up a static IP address in Ubuntu 26.04, you can use the terminal via Netplan Configuration"
Post a Comment