Changing MAC using ifconfig causes connectivity lost

I am using Suse 10 sp2. By running ifconfig I am changing the mac address. Everything is happening successfully, but this is adapter losing the network connection. Even when I give a static IP. I am not able to ping any other IP.

I’ve seen this problem on many other forums but haven’t found any concrete solution yet. Any suggestions ?


Are you running SUSE Linux Enterprise Desktop?

If so, you might get better support at the Novell forums. (Although this looks like a distro-agnostic type of networking question).

Everything is happening successfully, but this is adapter losing the network connection. Even when I give a static IP. I am not able to ping any other IP.

I don’t quite understand you here. Are you using dhcp or static ip addresses? Can you post the command sequences you’ve tried (along with any relevant output)?

Hi, I am using SLES 10 SP2

Assume eth0 has the MAC MACX
Command Sequence -
**service network stop
ifconfig eth0 down
ifconfig eth0 hw ether MACY
ifconfig eth0 up **

Now moving the file /etc/sysconfig/network/eth-id-MACX to /etc/sysconfig/network/eth-id-MACY

( eth0 is set to get the IP from DHCP )

service network start

eth0 gets no IP from DHCP
if I give a static IP by - **ifconfig eth0 netmask **

Now I try to ping

From icmp_seq=1 Destination host unreachable.

Now if I run all above commands again and set the MAC back to MACX
and follow same IP assignment process. It starts working. Even when I give a new static IP it works.

Are you the sysadmin? If not, perhaps you should ask your sysadmin if they have a security feature on the switch where ports are associated with particular MAC addresses which must be registered beforehand with the switch. This is so that people cannot plug a different device on the port.

No there is no MAC associations, its like an open network environment. I’ve seen this problem discussed on other linux forums also but haven’t found a concerete solution yet.

A similar discussion on Fedora Forums -

F7 MAC address spoofing -

Without knowing more about your router, its not clear about what may be happening. (It does look like MAC filtering or similar is at play here). Are you sure that the ethernet driver for your network card supports this operation, as mentioned in man ifconfig?

Does ifconfig command confirm the new MAC address after invoking the change?

Try sending some ICMP ping packets out from your system to a known working host on another network (or subnet) after you have changed its MAC address. This will force the router to update its ARP tables, associating your new MAC address with your IP address.

Worth a try - some routers can take up to 30 minutes or so to update.


@deano_ferrari: I am running SLES 10 SP2 on a hyper-v Virtual Machine and using a legacy network adapter. Shutting down the machine and changing mac from VM settings and booting again works fine. But I have to make it work without rebooting the machine. And yes, ifconfig commands confirms the MAC change.

@Andy: I tried but didnt work. Its not even getting any IP from dhcp while restarting network service after moving the file /etc/sysconfig/network/eth-id-MACX to /etc/sysconfig/network/eth-id-MACY
(where MACY is new mac assigned)

Perhaps your DHCP server won’t give out IP addresses to non-registered MAC addresses?

@ken_yap : Shutting down the virtual machine and changing mac (a new MAC) from VM settings and booting again works fine. It gets a new IP address from DHCP. There is no restriction on DHCP. Even when giving a static IP doesn’t help in the communication to work.

When you set a static address, do you also configure the nameservers and gateway? It’s your responsibility to provide this information which DHCP used to provide.

Yea I specified the default gateway but still pinging an IP on the same subnet we don’t need to specify the gateway (router).

I just noticed by sniffing arp packets on the other windows machine that Linux machine is sending arp packets with the “new MAC”, and windows machine is sending arp reply addressing to new MAC, but Linux machine is not understanding that this packet is destined to itself.

Maybe you have one of those NICs where it really is hardwired to listen only on the MAC that’s configured in the EEPROM. Or the driver didn’t do the reconfiguration of the MAC correctly.

So how can I cross check that drivers reconfigured the MAC successfully or not ? I am running SuSE on hyper-v VM, so allowing MAC spoofing there logically allows to listen to packets for new MAC. So thats sure NIC is not hardwired to old mac.

Honestly, no idea. Haven’t encountered a setup like yours. Does MAC changing work on the real machine?