I have put together a quick and easy way to change your network interface. We will be using netplan which is the default these days. We will accomplish this by adding the file below and apply the changes.
/etc/netplan/50-cloud-init.yaml
Find the target devices mac/hw address using the lshw command:
lshw -C network
You'll see some output which looks like:
*-network description: Ethernet interface physical id: 2 logical name: eth0 serial: c4:65:16:17:40:a3 size: 1Gbit/s capacity: 1Gbit/s capabilities: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=bcmgenet driverversion=5.8.0-1015-raspi duplex=full ip=192.168.0.112 link=yes multicast=yes port=MII speed=1Gbit/s
You will then take the serial. Example:
c4:65:16:17:40:a3
Create the 50-cloud-init.yaml file:
sudo touch /etc/netplan/50-cloud-init.yaml
Open the file:
sudo vi /etc/netplan/50-cloud-init.yaml
Paste the code below: Note the set-name option.
network:
version: 2
ethernets:
eth0:
dhcp4: true
match:
macaddress: <YOUR MAC ID HERE> #add the serial that you copied here
set-name: eth0 #change to the network name you desire
Save and Exit the file:
:wq!
Run the command to apply:
sudo netplan apply /etc/netplan/50-cloud-init.yaml
Now run the command below to see changes:
ifconfig