To rename a network interface permanently on Linux in a simple boot script, do following:
Example: Rename interface "eth1" (NET2) to "ethercat0"
-
Connect to the device by SSH (ex. Putty)
-
Create a script:
Command: nano /etc/init.d/rename-net2.sh -
Script content:
ifconfig eth1 down
ip link set eth1 name ethercat0
ifconfig ethercat0 up"ethercat0" is the new name of the interface name
-
Quit editor and save content. CTRL-X --> Y --> Enter --> Enter
-
Set the execution rights.
Command: chmod +x /etc/init.d/rename-net2.sh -
Automticly exceuted scrip on boot time
Command: update-rc.d rename-net2.sh defaults -
Flash file system.
Command: sync -
Now on each booting the interface will be rename to "ethercat0"