Breadcrumbs

Rename Network Interface Name

To rename a network interface permanently on Linux in a simple boot script, do following:

Example: Rename interface "eth1" (NET2) to "ethercat0"

  1.  Connect to the device by SSH (ex. Putty)

  2. Create a script:
    Command: nano /etc/init.d/rename-net2.sh

  3. Script content:
    ifconfig eth1 down
    ip link set eth1 name ethercat0
    ifconfig ethercat0 up

    "ethercat0" is the new name of the interface name

  4. Quit editor and save content. CTRL-X --> Y --> Enter --> Enter

  5. Set the execution rights.
    Command: chmod +x /etc/init.d/rename-net2.sh

  6. Automticly exceuted scrip on boot time
    Command: update-rc.d rename-net2.sh defaults

  7. Flash file system.
    Command: sync

  8. Now on each booting the interface will be rename to "ethercat0"