Skip to content

Instantly share code, notes, and snippets.

@lotusirous
Created December 8, 2018 06:17
Show Gist options
  • Save lotusirous/53c022903312d47dedad43ff2028e5af to your computer and use it in GitHub Desktop.
Save lotusirous/53c022903312d47dedad43ff2028e5af to your computer and use it in GitHub Desktop.
Change IP in Ubuntu Server 18.04

Change IP in Ubuntu server 18.04

The configuration files are stored in 50-cloud-init.yaml (If it does not exist, using command sudo netplan generate to generate it)

network:
    ethernets:
        eno1:
            addresses: []
            dhcp4: true
            optional: true
        enp4s0f1: # change the interface which you are working on
            addresses: [192.168.100.45/24] # /24 is netmask
            gateway4: 192.168.100.1
            dhcp4: no # use static ip
            nameservers:
                addresses: [8.8.8.8]
    version: 2

Apply the configuration

sudo netplan apply 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment