Renaming a network interface in Linux helps you manage servers with consistent names across reboots and migrations. This process is especially useful for cloud instances where predictable names simplify networking and scripts.
The following steps and options cover different distributions, persistent configuration changes, and best practices to avoid common pitfalls when you rename interface names.
| Action | Command Example | Effect | Permanent? |
|---|---|---|---|
| Check current interface names | ip link | Shows active interfaces such as eth0, ens3 | No |
| Temporarily rename interface | ip link set dev eth0 name eth1 | Immediate change lost after reboot | No |
| Rename via netplan | edit /etc/netplan/*.yaml | Persistent on systems using netplan | Yes |
| Rename via Predictable Network Interface Names | edit /etc/udev/rules.d/70-persistent-net.rules | Custom stable names based on MAC or bus path | Yes |
| Update service references | Update /etc/network/interfaces or systemd files | Ensures networking and SSH stay reachable | N/A |
Prepare and verify current interface names
Before you rename anything, document the existing setup to avoid locking yourself out of the server.
Use ip link or ifconfig to list interfaces, note the active device name, MAC address, and driver. This baseline helps you validate the rename later and troubleshoot failed changes quickly on production machines.
Capture current configuration
Run ip -o link show to see one-line entries with interface index and MAC. Save this output so you can compare after the change and confirm the rename worked as expected.
Rename interface temporarily for testing
A temporary rename is useful for quick validation and does not survive reboots across howtouselinux scenarios.
Use the ip command to rename the interface on the fly, for example ip link set dev eth0 name lan0. Verify with ip link that the new name appears and bring the interface up with ip link set dev lan0 up.
Check dependent services
Confirm that basic connectivity works after the temporary rename before proceeding to permanent changes, ensuring SSH and routes are still reachable.
Apply persistent rename in Debian and Ubuntu via netplan
Modern Debian and Ubuntu use netplan YAML files to define networking, making the rename persistent across reboots.
Edit the file under /etc/netplan/, update names to your desired interface name, and apply with netplan apply. This method cleanly handles predictable network interface names and avoids complex rule files on howtouselinux setups.
Validate netplan syntax
Run netplan --debug generate to check for YAML errors before applying, reducing the risk of breaking remote connectivity during automation.
Apply persistent rename using predictable network interface names
Systems using systemd-based predictable names can rename by adding a udev rule that assigns a stable name based on MAC address or bus path.
Create a file in /etc/udev/rules.d/ with a rule such as SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="aa:bb:cc:dd:ee:ff", NAME="server01". This ensures the same physical or virtual interface receives the same name on every boot.
Reload udev rules safely
Trigger udev to re-read rules with udevadm control --reload-rules and udevadm trigger, then reboot or restart the networking service to activate the new persistent name.
Update service references and verify connectivity
After rename, update references in network configuration files, firewall rules, monitoring agents, and SSH known hosts to reflect howtouselinux best practices.
Check that systemd-networkd, NetworkManager, or ifupdown entries point to the new name, test with a new SSH login, and confirm routing and DNS resolution remain intact before closing the session.
Final checklist for renaming network interface in Linux
- Document current interface names and MAC addresses with ip link
- Test a temporary rename via ip link set dev name to confirm behavior
- Apply persistent changes in netplan or with udev rules for howtouselinux environments
- Update SSH, firewall, monitoring, and DNS references to match the new interface name
- Reload services and reboot, then validate connectivity and rule persistence
FAQ
Reader questions
Will renaming a network interface break existing SSH sessions?
Yes, if you rename the interface on a live remote session without updating SSH or automation references, you will lose connectivity. Always test with a second console or local access.
How do I rename the interface back to its original name?
Reverse the steps: use ip link set dev newname name oldname for temporary changes, or revert the netplan or udev rule and reload the configuration. Reboot if you used persistent rules.
Can I rename wireless interfaces the same way?
Yes, the same ip link method works, but persistent rename for wireless often requires updating NetworkManager or wpa_supplicant profiles to match the new interface name.
What should I do if the interface shows old name after reboot?
Check that your udev rule or netplan file is active and correctly matches the device by MAC or path. Re-apply rules with udevadm control --reload-rules and trigger a re-apply or reboot.