4

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.

1
  • BTW, if you need to control an interface manually (e.g. if up/down), you don't actually have to purge network-manager. You can stop the service as you did above, but you can also set an interface to 'unmanaged' so it will configure everything automatically, but leave your ethernet interface alone. For example: nmcli device set eth0 managed no
    – Jake
    Nov 9, 2016 at 4:17

4 Answers 4

5

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

1

The problem has disappeared, I can now access internet as usual without authentication.

What I think helped was:

  1. dhclient -r to release the dhcp lease

  2. remove all the dhcp lease files from /var/lib/dhcp/

  3. edit /etc/network/interfaces to change the hwaddress line to something random, restart network and repeat several times, then finally restore the cloned mac address and restart network. this was done several times which leads me to think that there is something wrong with a cache somewhere in the network or dhcp server.

  4. I believe it is not related to Ubuntu messing with my settings.

  5. Any comments about this policy of giving us some lame cloned MAC address (meaning very simple number) in order to access the network? Couldn't they just register the network card real MAC and authenticate with that?

    and a very off-topic

  6. I propose an installation which asks you what percentage of resources you want to dedicate to window manager and apps and then installs the requested amount of 'funkiness' and 'pimp-me-up-ness', it's a pity to try to use this computer for scientific computing and have lots of ram dedicated to window positioning or funky animations, and then try to disable this and that and eventually break everything. Finally, it would also be useful to be able to boot with no x-server (runlevel 3) to test many things which gnome otherwise might take over. I could not manage to do that yet.

1
  • to your off-topic comment: have you looked at the xfce shell? there's an ubuntu flavour xubuntu that uses it as default. It's designed for low-resource computers, and installs a minimum of extra guff.
    – drevicko
    May 7, 2014 at 2:55
1

On Kubuntu 15.04 cloned mac address still does not work with Network-Manager gui. It does however work with the command line but NONE of the advice listed above worked for me since it's outdated.

I'll show two ways to do this I discovered from various sources and trial and error.

METHOD I

In this example I will use 'wlan0' as the wireless interface I want to change the mac address for and the sample mac will be 'AA:BB:CC:DD:EE:FF' which you just need to change to suit your needs.

Open up a terminal and then enter the following lines one at a time:

sudo service network-manager stop
sudo ifconfig wlan0 down
sudo ifconfig wlan0 hw ether AA:BB:CC:DD:EE:FF up
sudo service network-manager start

You should be up with the new MAC address.

METHOD II

If you want this to be automated you can use this script and set it to autorun at startup.

First install macchanger.

sudo apt-get install macchanger

Run this in a terminal to see the options for macchanger:

macchanger -h

Now that macchanger is installed lets build the script.

Create a new text file.

Put the following code in the text file:

#!/bin/bash

RED=$(tput setaf 1 && tput bold)
GREEN=$(tput setaf 2 && tput bold)
STAND=$(tput sgr0)
echo $RED -------------------
echo $RED ENTER ROOT PASSWORD
echo $RED -------------------
sudo service network-manager stop
echo
echo $RED ------------------
echo $RED SHUTTING DOWN WIFI
echo $RED ------------------
echo $GREEN
sleep 1
sudo ifconfig wlan0 down
sleep 1
echo $RED --------------------
echo $RED CHANGING MAC ADDRESS
echo $RED --------------------
echo $GREEN
sudo macchanger -e wlan0
sleep 1
echo
echo $RED -------------------------
echo $RED WIFI RESTARTING
echo $RED PLEASE VERIFY THE CHANGES
echo $RED -------------------------
sudo ifconfig wlan0 up
sleep 1
sudo service network-manager start
echo $GREEN
ifconfig wlan0
echo $STAND
sleep 6
exit

Save the file as mymacchanger.sh

Right click the file in your file manager and give it execute permission.

Add this file to your autostart programs or create a launcher and make sure to set the launcher to use a terminal window.

If you are on Kubuntu you can add the following line after #!/bin/bash in the above script to have a terminal launched automatically without needing to create a desktop launcher:

tty -s; if [ $? -ne 0 ]; then konsole -e "$0"; exit; fi 

You can substitute the 'konsole -e' in the line to whatever terminal package you use if you don't have konsole or are on a different ubuntu distribution.

Peace out.

1
  • but when connecting to a wifi internet connection after changing the mac address, it goes back to the permanent.
    – Webeng
    May 23, 2017 at 8:26
1

I had connection issue before when using cloned mac address. I resolved the issue by changing only the last 3 octets. For instance, only change the 'DD:EE:FF' of 'AA:BB:CC:DD:EE:FF'.

The first 3 octets are manufacturer identifier and the rest are randomly generated. Somehow it's not possible for me to change the manufacturer identifier.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .