The Linux kernel keeps track of network devices in the form of interfaces. Each interface is assigned a unique name, such as eth0, eth1, eth2, tr0, tr1, tr2, and so forth. The interface name is initially assigned by the device driver and kernel but may be overridden using ifrename.
The ifrename utility can be used to rename a network interface. The -i option specifies the old interface name, and -n sets the new name. To rename wlan0 to eth1, for example:
# ifrename -i wlan0 -n eth1
If you now check the interface information for the interface – wlan0, you would get below errro.
# ifconfig wlan0 wlan0: error fetching interface information: Device not found
ifrename Command Examples
1. To set the configuration file:
# ifrename -c /path/config
2. To probe kernel modules before renaming interface:
# ifrename -p
3. To rename specific interface:
# ifrename -i eth1
4. To specify the new name:
# ifrename -i eth1 -n eth8
5. To enable takeover support:
# ifrename -t
6. To enable udev output mode:
# ifrename -u
7. To dry-run mode:
# ifrename -D
8. To set to verbose mode:
# ifrename -V