Wiki‎ > ‎

MAC address

posted Jul 26, 2016, 1:03 AM by Dong Xu   [ updated Jul 26, 2016, 1:09 AM ]

Start/stop network interface


SUSE11 ifup, ifdown, ifstatus

SUSE12: wicked

systemctl status network
systemctl start network
wicked ifup eth0 wicked ifup wlan0


To change the hostname on a SUSE system you need to change the following files:

  • /etc/HOSTNAME
  • /etc/hosts
  1. In YaST, navigate to Network Devices, then Network Settings, and then press the Enter key.
  2. In Network Settings, use the arrow keys to navigate to Hostname/DNS and use the TAB key and Shift + TAB key combination to cycle through the available options.
    a. Select and set the hostname and domain name to preferred values.
    b. Navigate to Change Hostname via DHCP and press the Spacebar to uncheck this option.


Change MAC address

Method 1: iproute2

First, you can check your current MAC address with the command:

# ip link show interface

where interface is the name of your network interface.

The section that interests us at the moment is the one that has "link/ether" followed by a 6-byte number. It will probably look something like this:

link/ether 00:1d:98:5a:d1:3a

The first step to spoofing the MAC address is to bring the network interface down. It can be accomplished with the command:

# ip link set dev interface down

Next, we actually spoof our MAC. Any hexadecimal value will do, but some networks may be configured to refuse to assign IP addresses to a client whose MAC does not match up with any of known vendors. Therefore, unless you control the network(s) you are connecting to, use MAC prefix of any real vendor (basically, the first three bytes), and use random values for next three bytes. For more information please read Wikipedia:Organizationally unique identifier.

To change the MAC, we need to run the command:

# ip link set dev interface address XX:XX:XX:XX:XX:XX

Where any 6-byte value will suffice for XX:XX:XX:XX:XX:XX.

The final step is to bring the network interface back up. This can be accomplished by running the command:

# ip link set dev interface up


You can create a tap device fairly easily, either with tunctl (from uml-utilities, at least on Debian):

# tunctl -t eth0
Set 'eth0' persistent and owned by uid 0
# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr a6:9b:fe:d8:d9:5e  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Or with ip:

# ip tuntap add dev eth0 mode tap
# ip link ls dev eth0
7: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 500
    link/ether 0e:55:9b:6f:57:6c brd ff:ff:ff:ff:ff:ff

prefer the second method, as ip is preferred network tool on Linux, and you likely already have it installed.

both of these are creating the tap device with a random local MAC, you can set the MAC to a fixed value in any of the normal ways.

ip link set dev eth0 address 01:23:45:67:89:ab

Create a virtual network interface

How can I create a virtual interface similar to the following ifconfig command?

$ sudo ifconfig eth1 hw ether 00:01:02:aa:bb:cc SIOCSIFHWADDR: No such device

This does not work. I want to set the MAC addresses to test my DHCP server's configuration.

How would I do that with the iproute2 suite using the ip link command?

$ sudo ip link add type veth This works, but it randomly assigns a MAC address.
ip link add type veth addr 00:01:02:aa:bb:cc


ip link set dev veth0 addr 00:01:02:aa:bb:cc

Virtual Bridge and Dummy Network

Setting up a dummy interface

If you want to create network interfaces, but lack a physical NIC to back it, you can use the dummy link type. You can read more about them here: iproute2 Wikipedia page.

Creating eth10

To make this interface you'd first need to make sure that you have the dummy kernel module loaded. You can do this like so:

$ sudo lsmod | grep dummy
$ sudo modprobe dummy
$ sudo lsmod | grep dummy
dummy                  12960  0 

With the driver now loaded you can create what ever dummy network interfaces you like:

$ sudo ip link set name eth10 dev dummy0

And confirm it:

$ ip link show eth10
6: eth10: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default 
    link/ether c6:ad:af:42:80:45 brd ff:ff:ff:ff:ff:ff

Changing the MAC

You can then change the MAC address if you like:

$ sudo ifconfig eth10 hw ether 00:22:22:ff:ff:ff
$ ip link show eth10
6: eth10: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default 
    link/ether 00:22:22:ff:ff:ff brd ff:ff:ff:ff:ff:ff

Creating an alias

You can then create aliases on top of eth10.

$ sudo ip addr add brd + dev eth10 label eth10:0

And confirm them like so:

$ ifconfig -a eth10
eth10: flags=130<BROADCAST,NOARP>  mtu 1500
        ether 00:22:22:ff:ff:ff  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

$ ifconfig -a eth10:0
eth10:0: flags=130<BROADCAST,NOARP>  mtu 1500
        inet  netmask  broadcast
        ether 00:22:22:ff:ff:ff  txqueuelen 0  (Ethernet)

Or using ip:

$ ip a | grep -w inet
    inet scope host lo
    inet brd scope global wlp3s0
    inet brd scope global virbr0
    inet brd scope global eth10:0

Removing all this?

If you want to unwind all this you can run these commands to do so:

$ sudo ip addr del brd + dev eth10 label eth10:0
$ sudo ip link delete eth10 type dummy
$ sudo rmmod dummy



To delete the new interface:

ip link del eth0

Change the MAC address of an Ethernet interface temporarily

Check MAC addresses:

$ ifconfig -a | awk '/HWaddr/ {print "Interface: " $1 "\t MAC: " $NF}'
Interface: eth0	 MAC: 08:00:27:2c:a4:69
Interface: eth1	 MAC: 08:00:27:9a:21:24

Shut down desired Ethernet interface (eth0 in this example):

$ sudo ifconfig eth0 down

Specify new MAC address:

$ sudo ifconfig eth0 hw ether 08:00:00:00:00:01

Activate modified Ethernet interface:

# ifconfig eth0 up

Verify changed MAC address:

$ ifconfig -a | awk '/HWaddr/ {print "Interface: " $1 "\t MAC: " $NF}'
Interface: eth0	 MAC: 08:00:00:00:00:01
Interface: eth1	 MAC: 08:00:27:9a:21:24

Change the MAC address of an Ethernet interface permanently

To permanently change MAC address of an Ethernet interface you need to edit /etc/network/interfaces configuration file and use hwaddress directive:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# Network interfaces
allow-hotplug eth0
iface eth0 inet dhcp
  hwaddress ether 08:00:00:00:00:01

allow-hotplug eth1
iface eth1 inet dhcp

Reboot or reconfigure network interfaces by hand:

$ sudo service networking restart


Device mapping on some of our Linux machines are controlled by the file /etc/iftab.

On our Ubuntu test machine this file, /etc/iftab, is not present and the network devices assignment is controlled by files located in the /etc/udev/rules.d directory.

The file, 70-persistent-net.rules, contains the names of the device files:

It appears to us that each time the networking is reconfigured (for example, if one switches from a wireless adaptor to a wired adaptor) and then rebooted, this rule file gets updated and new network device names are assigned. On this particular machine, which is regularly switched from a wireless connection to a wired connection, the most recent ethernet assignments had incremented to eth76.

netstat -r
Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface * U 0 0 0 eth76 link-local * U 0 0 0 eth76 default UG 0 0 0 eth76

eth0 and eth1 swap on reboot

Create udev rules - /etc/udev/rules.d/70-network.rules

SUBSYSTEM=="net", ATTR{address}=="ab:cd:ef:12:34:56", NAME="eth0"
SUBSYSTEM=="net", ATTR{address}=="65:43:21:fe:dc:ba", NAME="eth1"

I solved this with iftab (see man iftab) once and for all when rc.conf module ordering failed me a few times and udev rules failed me a few times on a box without a keyboard.

eth0    mac     00:00:11:11:22:22
eth1    mac     33:33:44:44:55:55

# Persistent network interface naming
/usr/sbin/ifrename -c /etc/iftab

How to rename Ethernet devices through udev

Renaming Ethernet devices is done through udev.
  1. Identify the hardware MAC address of the Ethernet device:
    ifconfig CURRENT_DEVICE_NAME | grep HWaddr
    The output after "HWaddr" is the physical hardware address. Sample output:
    eth0 Link encap:Ethernet HWaddr 00:1A:4B:B7:31:13
  2. Open /etc/udev/rules.d/30-net_persistent_names.rules for editing. The names of the Ethernet devices are listed in this file.
  3. Locate and identify the line with the NIC from step 1. It may look like this:
    SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:1a:4b:b7:31:13", IMPORT="/lib/udev/rename_netiface %k eth0
  4. From the step above, the text after "IMPORT="/lib/udev/rename_netiface %k" is the name of the Ethernet device. Change this as needed. In this example, the interface eth0 will be renamed to eth5:
    SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:1a:4b:b7:31:13", IMPORT="/lib/udev/rename_netiface %k eth5"
  5. Save the file.
  6. Reboot to test changes.


 % lmutil lmhostid and it returns b083fed5855e as one of the values, the license should work. % lmutil lmhostid -hostname
returns "HOSTNAME=meta"
then meta is a good hostname to use.
Your current license
SERVER meta b083fed5855e 27000


Run "lmutil lmhostid" and "lmutil lmhostid -hostname" in all
three environments and see what comes out. Some hostids may vanish,
and sometimes
% ping meta
is not defined (which could be a problem). Suggest you add 'localhost' to /etc/hosts, and give it IPadrress Then edit the license manually and change meta to localhost.
localhost should work everywhere as a hostname, and using a hostid that persists everywhere should be okay.

FLEXlm license manager looks for the network card labeled "eth0" on Linux (or "en0"

on Macintosh). If there is no card labeled eth0/en0 the license manager will return an error.

There should be a way to remap your network cards so that a specific one will always appear as eth0. The exact instructions may vary depending on the operating system.

On some systems, the following should work:

1. Edit your "70-persistent-net.rules" file as follows:

> sudo gedit /etc/udev/rules.d/70-persistent-net.rules

2. Locate the current mapping of the network card (e.g. "eth1") and change this to "eth0":


3. Restart the computer.

If not, you may need to search the Internet or any documentation for your operating system to find out the details on this remapping.

Once the network card is mapped to eth0 you should be able to activate the software normally.


You cannot seem to start the license manager on MAC

When you try to start the license service on MAC, you are certain you have the license in the correct loaction and it is using the correct MAC and server name, but you cannot start the service. 

The messages on the startup of the service may contain:

(lmgrd) Unknown Hostname (HOSTNAME) specified in the license file is not available in the local network database 

EXITING DUE TO SIGNAL 33 Exit reason 1


There could be a problem with the HOSTNAME file on the MAC machine and as a result, the server cannot recognize the hostname and start properly.


Basically, we add the local IP address to the local machine and the name of the machine

Edit the HOSTNAME file on the MAC and restart the service. These steps assume you are using the default /usr/local/flexnetserver/ folder for the license manager install AND you have copied the license file to this SAME location.

Verify/edit Hostname file:
  1. Type cd /etc/hosts
  2. Enter the IP address of the local machine
  3. Move the cursor over to the second row and enter the hostname 

Start the services:
  1. Type sudo ./lmgrd –c your_license.lic

Check Service Status:
  1. Type sudo ./lmutil lmstat –a –c your_license.lic

See Also:

How to set up a license server on MAC