0

Hoping someone can help me, what I'm wanting to do is change the order of my interfaces on Ubuntu 12.04LTS. We're running our Ubuntu server on a VMWare box with three virtual interfaces.

I've read through all the links on How to control the up order of network interfaces? but it doesn't seem to offer what we're looking for.

We have a slight issue in that a piece of software we are running uses the first interface it finds as it's control interface. We actually need it to use the third one. We've checked with the vendor and they've confirmed we can't configure the software to specify which interface. That is a rant for a different time though.

At current an ifconfig looks something like this:

eth0      Link encap:Ethernet  HWaddr 00:0c:29:b5:dd:c1  
          inet addr:192.168.10.117  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feb5:ddc1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:1368 (1.3 KB)

eth1      Link encap:Ethernet  HWaddr 00:0c:29:b5:dd:cb  
          inet addr:192.168.20.117  Bcast:192.168.20.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feb5:ddcb/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:660 (660.0 B)  TX bytes:468 (468.0 B)

eth2      Link encap:Ethernet  HWaddr 00:0c:29:b5:dd:d5  
          inet addr:192.168.30.117  Bcast:192.168.30.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feb5:ddd5/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:9 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:540 (540.0 B)  TX bytes:468 (468.0 B)

We ideally want what is now eth2 with a MAC of 00:0c:29:b5:dd:d5 to be eth0. When we change /etc/network/interfaces accordingly we get a change, but not right:

eth0      Link encap:Ethernet  HWaddr 00:0c:29:b5:dd:c1  
          inet addr:192.168.30.117  Bcast:192.168.30.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feb5:ddc1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5 errors:0 dropped:0 overruns:0 frame:0
          TX packets:25 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:526 (526.0 B)  TX bytes:1666 (1.6 KB)

eth1      Link encap:Ethernet  HWaddr 00:0c:29:b5:dd:cb  
          inet addr:192.168.20.117  Bcast:192.168.20.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feb5:ddcb/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:17 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1246 (1.2 KB)  TX bytes:706 (706.0 B)

eth2      Link encap:Ethernet  HWaddr 00:0c:29:b5:dd:d5  
          inet addr:192.168.10.117  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feb5:ddd5/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:946 (946.0 B)  TX bytes:946 (946.0 B)

Can anyone think of a way to change the order of the interfaces?

We're confident it could be done through VMWare but in an ideal world it would be great if it could be done without rebooting the server.

I could be asking the wrong question here, or asking it the wrong way. Any pointers would be hugely appreciated!

  • Have a look at http://askubuntu.com/questions/217635/how-to-rename-an-ethernet-interface – muru Aug 26 '14 at 21:33
  • 2
    @muru you are a gentleman, thanks, exactly what I was looking for. Shall write it up if it comes in useful for anyone else. – Gyp the Cat Aug 26 '14 at 21:48

1 Answers1

1

As suggested by in the comments I obviously hadn't searched enough... :)

In my example above:

nano /etc/udev/rules.d/70-persistent-net.rules

Enter something along the following, complete with the right MACs in the right place:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:b5:dd:d5", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:b5:dd:cb", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:b5:dd:c1", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

Give your server a reboot and you should see something like the following:

eth0      Link encap:Ethernet  HWaddr 00:0c:29:b5:dd:d5  
          inet addr:192.168.30.117  Bcast:192.168.30.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feb5:ddd5/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:21 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1260 (1.2 KB)  TX bytes:468 (468.0 B)

eth1      Link encap:Ethernet  HWaddr 00:0c:29:b5:dd:cb  
          inet addr:192.168.20.117  Bcast:192.168.20.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feb5:ddcb/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:21 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1260 (1.2 KB)  TX bytes:468 (468.0 B)

eth2      Link encap:Ethernet  HWaddr 00:0c:29:b5:dd:c1  
          inet addr:192.168.10.117  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feb5:ddc1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:1728 (1.7 KB)