Sam Perrin TIL Blog

Set Static IP Ubuntu 18.04

May 08, 2020

Set a static IP on Ubuntu 18.04.

{
sudo bash -c 'cat > /etc/netplan/01-netcfg.yaml <<EOF
network:
  version: 2
  renderer: networkd
  ethernets:
    ens33:
      dhcp4: no
      addresses:
        - 192.168.118.106/24
      gateway4: 192.168.118.2
      nameservers:
          addresses: [192.168.118.2, 1.1.1.1]
EOF'
sudo netplan apply
}

Sam Perrin

Written by Sam Perrin who loves all things Automation related! You should follow him on Twitter