Look up anything

Look up anything

Configuring a Static IP Address Linux

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo nano /etc/netplan
sudo nano /etc/netplan
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:

 

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# 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
# 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
# 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