2

I would like to change the MAC address on a Fedora 2o webserver, but it seams that ifdown and ifup doesn't work like they used too before systemd were introduced. This is what I would like to do

ifdown eth0
ifconfig eth0 hw ether 00:E0:81:5C:B4:0F
ifconfig eth0 up

The ethernet card is called em1 and using dhcp.

# ifdown em1
usage: ifdown <device name>

Question

How do I do the equivalent of the above on the new ifdown and ifup.

Jasmine Lognnes
  • 2,490
  • 8
  • 31
  • 51

2 Answers2

5

First, you should not be using ifconfig for anything anymore. Use the ip command instead.

Second, the command to change the MAC address is:

ip link set dev ${DEVICE} address ${MACADDR}

Finally, the best way to do this is to make it persistent by adding it to the /etc/sysconfig/network-scripts/ifcfg-DEVICE file.

MACADDR=00:E0:81:5C:B4:0F
Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
2

Try to check man pages for any kind of help in the specific version of your operating system.

or

Try this:

Edit the file as shown below:

vi /etc/sysconfig/network-scripts/ifcfg-em1

Your file look like this,edit the HWADDR value in it.

    UUID="e88f1292-1f87-4576-97aa-bb8b2be34bd3"
    NM_CONTROLLED="yes"
    HWADDR="D8:D3:85:AE:DD:4C"
    BOOTPROTO="static"
    DEVICE="em1"
    ONBOOT="yes"
    IPADDR=192.168.1.2
    NETMASK=255.255.255.0
    BROADCAST=192.168.1.255
    NETWORK=192.168.1.0
    GATEWAY=192.168.1.1

And then restart the network service.

TBI Infotech
  • 1,536
  • 9
  • 15