Post

Networking

Change Hostname

1
hostnamectl set-hostname newhostname

Change IP Address in Ubuntu 20.04 LTS

  1. Create a new file /etc/netplan/01-netcfg.yaml
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    network:
      version: 2
      renderer: networkd
      ethernets:
     ens3:
       dhcp4: no
       addresses:
         - 192.168.121.221/24
       gateway4: 192.168.121.1
       nameservers:
           addresses: [8.8.8.8, 1.1.1.1]
    
  2. Apply changes
    1
    
    netplay apply
    

Change IP Address in Ubuntu 22.04 LTS

gateway4 has been depricated in ubuntu 22.04 release and routes is used instead!

  1. Create a new file /etc/netplan/00-installer-config.yaml
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    network:
      ethernets:
     enp5s0:
       dhcp4: false
       addresses: [192.168.1.37/24]
       routes:
         - to: default
           via: 192.168.1.1
       nameservers:
         addresses: [8.8.8.8,192.168.1.1]
      version: 2
    

    1.1 Create /etc/netplan/00-installer-config-wifi.yaml

    1
    2
    3
    4
    5
    6
    7
    8
    
    network:
      version: 2
      wifis:
     wlp9s0:
       access-points:
         SSID:
           password: 'PASS'
       dhcp4: true
    
  2. Apply changes
    1
    
    netplay apply
    

Get hardware info

1
sudo lshw -short

Check open ports and apps useing them

1
sudo ss -tulwnp | grep LISTEN
This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.