Ubuntu – NetworkManager problem with ‘cloned MAC address’

ifconfignetwork-manager

My problem is that at univ. each desktop computer is given a 'fake'/'cloned' MAC address which is recognised by our network and let us in without further authentication/VPN and the likes (don't ask why – stoped asking that myself. unfortunately i am the only one with linux here, the windows have cisco nac agent).

Therefore when creating a wired connection over ethernet (using NetworkManager – this is for Ubuntu 12.04 and 13.04), we are supposed to fill the box 'cloned MAC address' with the said fake MAC address given to us (MTU size is 'auto'). Using this method no VPN is necessary so no VPN is configured, just a plain ethernet connection.

However this does not work. It keeps trying to connect and never manages with all the notifications coming.
When I leave the 'cloned MAC address' box empty then it connects fine, I see the connect icon OK but I am unable to access the internet (either via command line with wget or firefox) because i am not authenticated (i think they have a proxy or something, wget www.ibm.com respondes with "proxysg1…Authorization failed')

So what I did was to edit /etc/network/interfaces to become:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
# clone mac address so we can get in net as instructed by IT
hwaddress ether XX:XX:XX:XX:XX:XX

Then I realised (new to Ubuntu,old to linux) that this is not enough and I had to remove network-manager alltogether in order to start using ifup/down etc. Which I did.

% apt-get purge network-manager
% ifup eth0
no problem there, dhcp is called and we get ip with no errors and then starts the ssh server.

% ifconfig
results are below:
eth0      Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX  
          inet addr:10.10.80.125  Bcast:10.10.80.255  Mask:255.255.255.0
          inet6 addr: fe80::200:aff:fe00:40/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2529 errors:0 dropped:0 overruns:0 frame:0
          TX packets:419 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:263993 (263.9 KB)  TX bytes:58880 (58.8 KB)
          Interrupt:16 Memory:d2200000-d2220000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:178 errors:0 dropped:0 overruns:0 frame:0
          TX packets:178 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:14420 (14.4 KB)  TX bytes:14420 (14.4 KB)

Where XX:XX:XX:XX:XX:XX is the cloned MAC address given to us by IT – so all OK i assume.

At this stage I can surely connect remotely to my machine (from computer in same room, desktop ethernet) but sometimes it works and then it breaks: usual problem, I can not access any internet (wget or firefox) without being asked to be authenticated. At this stage I re-install ubuntu 12.04 and manage to have it working for a while again until after installing a few packages using apt-get.

So I upgrated to Ubuntu 13.04

at installation time from boot-cd, there was the above problem with accessing the repositories (for checking latest versions). Again it used NetworkManager which can simply not function with 'cloned MAC address' unless I am doing something wrong. At some stage after booting up with the installation cd, before installing, I switched to the console. Stopped the network manager (/etc/init.d/networking stop) and then did the old ifup thing and it worked! BUT unfortunately the whole installation crashed – something I noticed when in gnome and doing a /etc/init.d/networking restart – the window manager disappears.

In any event I proceeded with the installation of 13.04 but the installed system had the same problem (i.e. NetowrkManager 'cloned MAC address' could not connect me to the network). So again I removed the NetworkManager in the installed system and did all the steps above and it worked!

Then after installing a few packages (latest were: ubuntu-tweak, gconf-editor, okular, xpdf) using apt-get (only) the problem re-appeared – I am not authenticated BUT ifconfig has the same correct output, /etc/network/interfaces has the same contents and it all happened in mid-session no logout nor reboot. I did several ifdown/ifup/ifconfig they all show the same correct output but can't be authenticated to get to the internet BUT strangely I can ssh into the desktop from other computers in the same network/room. Oh and I did check and NetworkManager was not reinstalled without me knowing (i think).

Apart from the issue of NetworkManager can't handle the 'cloned MAC address' or me doing something wrong with it. The biggest problem is that after removing NetworkManager and had it working with ifup scripts, something (maybe apt-get post install script? maybe ubuntu-tweak which I use for only configuring gnome desktop) broke the thing.

The questions:

  1. What can I do to be 100% certain that nothing interferes with my connections apart from the traditional, old style method of ifup when using Ubuntu 13.04. E.g. will apt-get at some stage when installing something cause something to break with my network?

  2. Can anyone suggest why NetworkManager with cloned Mac address do not work but ifup works as said above (after removing NetworkManager).

  3. Can anyone suggest why when NetworkManager is either installed and running or not, /etc/init.d/networking restart kills the window manager, leaves xterms on but can't write anything in them (maybe focus is elsewhere)?

  4. I am that much to switch to Suse if it wasn't for the super-duper easy-peasy hero of softwares, love of my life: apt-get – any suggestions?

Thanks friends,

I appreciate any help, hints or words of comfort.

Best Answer

I'm on Ubuntu 12.04.2 kernel 3.5 with the same issue as you. NetworkManager is unable to make the cloned mac address "stick" to the ethernet port (I haven't tried it with wlan). I am able to run:

ifconfig eth0 down
ifconfig eth0 hw ether XX:XX:XX:XX:XX:XX
ifconfig eth0 up

without uninstalling NetworkManager. Once I run these commands, the ethernet adapter will stick with the new, spoofed mac address, but once I disconnect ethernet, sleep the computer, or reboot, NetworkManager reverts it back to the original one.

So basically, my workaround is to run these commands before connecting to the network, and it's good enough for me. It would be REALLY nice if NetworkManager behaved as it was supposed to though.

I've filed a bug report here: https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1116421

Related Question