"Enter"a basıp içeriğe geçin

Set a static IP on Ubuntu with netplan

 

 

 

 

 

 

If you can not set static IP during or after ubuntu 17.10 installation, follow the steps below.

  1. We first learn interface object name;
lshw -class network

Or

ls /sys/class/net

For object name example > enp0s3

2. Open the configuration file;

sudo vi /etc/netplan/01-netcfg.yaml (or *.yaml)
OR (with nano editor)
sudo nano /etc/netplan/01-netcfg.yaml (or *.yaml)

edit;

network: 
	version: 2 
	renderer: networkd
	ethernets:
		enp0s3: #object name
			dhcp4: no # dhcp v4 disable
			dhcp6: no # dhcp v6 disable
			addresses: [10.0.0.11/24] # client IP address
			gateway4: 10.0.0.1 # gateway adrdess
			nameservers:
				addresses: [8.8.8.8,8.8.4.4] #name servers

it is important to empty and tab in .yaml files!!!

3. update network configuration with netplan;

sudo netplan apply

if we only want dhcp server;

edit .yaml file;

network: 
	version: 2 
	renderer: networkd
	ethernets:
		enp0s3: #object name
			dhcp4: yes # dhcp v4 enable
			dhcp6: yes # dhcp v6 enable (if you want)

if you encounter an error, for details;

sudo netplan --debug generate

 

 

Question Key 1) Ubuntu Server 17.10 dows not accept static IP! ( Ubuntu 17.10 Statik IP ayarı , Ubuntu 17.10 DHCP IP ayarı)