Configuring a Static IP Address Linux

sudo nano /etc/netplan

Where:

  • DEVICE_NAME is the actual device name to be configured.
  • yes/no is an option to enable or disable dhcp4.
  • IP is the IP address for the device.
  • NETMASK is the netmask for the IP address.
  • GATEWAY is the address for your gateway.
  • NAMESERVER is the comma-separated list of DNS nameservers.

Here’s a sample .yaml file:

 

# This is the network config written by 'subiquity'
network:
  ethernets:
    enp0s3:
       dhcp4: no
       addresses: [192.168.1.230/24]
       gateway4: 192.168.1.1
       nameservers:
          addresses: [8.8.4.4,8.8.8.8]
  version: 2

 

Bookmarked Post

Related Posts