2

I'm running an application on an Ubuntu 14.04 EC2 instance that expects network interfaces to follow a specific naming convention.

Is it possible to rename the default network interface from 'eth1' to something different (e.g. 'mgt0')?

1

You'd need to create /etc/udev/rules.d/76-persistent-net-generator.rules

FIRST read /etc/udev/rules.d/README!

You'll need the MAC address of your interfaces (I've left them as zeros 00:00:00:00:00:00).

In the example below, I've renamed eth0 to WAN and eth1 to LAN

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:00:00:00:00", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="WAN"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:00:00:00:00", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="LAN"

As you reboot you'll see in syslog that the interfaces were renamed:

 Aug 24 04:35:53 fw kernel: [   21.338119] sis900 0000:00:04.0 LAN: renamed from eth0
 Aug 24 04:35:53 fw kernel: [   21.476415] 8139too 0000:00:08.0 WAN: renamed from eth1
4
  • Thanks, I understand that I can use this method to rename an interface under normal circumstances -- running this inside EC2 seems to be the problem. I believe the interface is being renamed properly, however, after a reboot my EC2 instance becomes unreachable. Presumably, Amazon relies on the existence of an 'eth0' interface to perform instance setup (e.g. assigning an IP address). I was hoping that someone could speak to this.
    – jwheels
    Aug 24 '16 at 21:44
  • When you rename the interface and go to your AWS console and select the renamed interface and select an action like "Manage Private ip Addresses"... What interface name does the console show? eth1, or the new name? Also, is this your primary network interface (per AWS).
    – wineguy
    Aug 24 '16 at 21:55
  • I'm trying this on my primary network interface (eth0). After the rename, the console still shows 'eth0' when I click actions-> manage private ip addresses. Also notable: this interface is no longer listed as a 'Primary Network Interface' on the network interfaces tab, and 1/2 status checks are failing on the instance.
    – jwheels
    Aug 24 '16 at 22:05
  • Fixed - I also needed to correct my entries in /etc/network/interfaces.d/ to reflect the new name
    – jwheels
    Aug 25 '16 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.