How to change dhcp/static IP on Ubuntu 18.04

For DHCP edit file /etc/netplan/50-cloud-init.yaml and change to:

network:
    ethernets:
        eth0:
            addresses: []
            dhcp4: true
            optional: true
    version: 2


For a static IP edit file /etc/netplan/50-cloud-init.yaml and change to:

network:
    ethernets:
        eth0:
            addresses:
            - 192.168.1.2/24
            gateway4: 192.168.1.1
            nameservers:
                addresses:
                - 1.1.1.1
                search:
                - domain.local
            optional: true
    version: 2

$ sudo netplan apply
$ sudo netplan try

That's it

Comentários

Postagens mais visitadas deste blog

Cisco router password recovery