set up a static IP address in Ubuntu 26.04, you can use the terminal via Netplan Configuration

 Method 1: Using Netplan (Recommended for Server & Terminal)

  1. Find your interface name by running ip a:
    bash
    ip a
    
    Use code with caution.
    Look for your active network card name (such as ens18 or eth0).
  2. Open the Netplan configuration file in /etc/netplan/:
    bash
    ls /etc/netplan/
    sudo nano /etc/netplan/00-installer-config.yaml
    
    Use code with caution.
    (Note: The exact filename might vary, such as 01-netcfg.yaml or 50-cloud-init.yaml)
  3. Edit the YAML file using 2 spaces for indentation (do not use tabs):
    yaml
    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.1
    
    Use code with caution.
    (Replace ens18 with your interface name, and adjust the IP address, gateway via, and DNS addresses to fit your network).
  4. Apply the changes:
    bash
    sudo netplan apply
    
    Use code with caution.
    You can use sudo netplan try first 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