First we need to identify what the device's interface name is.
To find this, type the following at the command prompt.
pi@something:~$ ip a
This will show you the various interfaces.
you should see something like , enp5s0:
That is your physical Ethernet interface name.
To configure netplan, open the netplan configuration file.
Netplan Config file :
pi@something:~$ sudo nano /etc/netplan/00-install-config.yaml
Static Configuration :
The blelow config is an example configuration of static ipv4 interface with the interface name being: enp5s0
#====================================================================
network:
version: 2
renderer: networkd
ethernets:
enp5s0:
addresses: [192.168.1.25/24]
gateway4: 192.168.1.1
nameservers:
addresses: [ 8.8.8.8,8.8.4.4]
#====================================================================
DHCP Configuration :
Below is an example of dhcp configuration.
#====================================================================
network:
version: 2
renderer: networkd
ethernets:
enp5s0:
dhcp4: true
gateway4: 192.168.1.1
nameservers:
addresses: [ 8.8.8.8,8.8.4.4]
#====================================================================
To apply netplan configuration, you can issue the following command :
pi@something:~$ sudo netplan apply
to test the new configuration before applying, please issue the following command :
pi@something:~$ sudo netplan --debug apply