0

In Ubuntu, I have two ethernet interfaces eth1 and eth3 that I want to call "foo0" and "foo1", respectively. Basically, I want something like "ip link alias DEVICE SECONDNAME". Is there a way to do this without mucking in the kernel?

Paul Hoffman
  • 2,214
  • 5
  • 19
  • 23
  • Just to clarify, I would like something like "ip link alias eth1 foo0" in the example above. – Paul Hoffman Sep 28 '11 at 18:36
  • Why? It doesn't make sense, does it? Edit `/etc/udev/rules.d/70-persistent-net.rules` to give them a different name. This is not an alias, it is a renaming. – mailq Sep 28 '11 at 20:01
  • Adding a duplicate line in 70-persistent-net.rules doesn't work: only the last rule for the device is used. – Paul Hoffman Sep 29 '11 at 20:38
  • I didn't say that you are allowed to **add** a line. I said you should **edit** a line! – mailq Sep 29 '11 at 20:41

1 Answers1

2

In Ubuntu you can change the name of interfaces in /etc/udev/rules.d/70-persistent-net.rules. That would be far and away the simplest solution.

If there is a real need for the interface to be aliased as foo0 rather than be renamed then you can do something dirty with bridge-tools.

sudo apt-get install bridge-utils

then edit your /etc/network/interfaces file to be something like..

auto eth0
iface eth0 inet manual


auto foo0 
iface foo0 inet static     
address 192.168.10.10     
netmask 255.255.255.0     
vlan-raw-device eth0     
bridge_ports vlan10
paulos
  • 1,694
  • 10
  • 12
  • Here is a guide to rename the interface: https://askubuntu.com/questions/767786/changing-network-interfaces-name-ubuntu-16-04#801310 – 7heViking Apr 20 '18 at 10:13