How to use the new ifdown and ifup?

Jasmine Lognnes asked:

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.

My answer:


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

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.