d
An igniting portfolio theme designed
to help you leave quite a mark.
Back to Top

Change your Linux/Ubuntu IP to Static

Ubuntu 16.04 LTS

Edit the file /etc/network/interfaces, and configure the following:

auto enp0s3
iface enp0s3 inet static
address 192.168.1.2**
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1

After this procedure it is necessary to restart the network:

sudo ifdown enp0s3; sudo ifup enp0s3
18.04 LTS

Edit the file /etc/netplan/50-cloud-init.yaml, and configure the following:

network:
    ethernets:
        enp0s3:
            addresses: [192.168.1.2**/24]
            dhcp4: no
            gateway4: 192.168.1.1
            optional: true
            nameservers:
                addresses: [192.168.1.1]
    version: 2

After this procedure you need to apply the new setting:

sudo netplan apply

 

Credits: https://www.carrondo.net

Review and tested by: Cristiano Costa

Post a Comment