Configure Manual Mac Adress
Under GNU/Linux, the MAC address of a network interface card (NIC) can be changed by following the procedures below.
Configure Manual Mac Address Free
NOTE: MAC addresses used within this article are provided for example only. Substitute according to your requirements.
NOTE: Commands below MUST be executed with root privileges (e.g. prepended with 'sudo '), in order for things to work!
Jan 06, 2011 Manual bindings are just special address pools. There is no limit on the number of manual bindings, but you can only configure one manual binding per host pool. Automatic bindings are IP addresses that have been automatically mapped to the MAC addresses of hosts that are found in the DHCP database.
/etc/init.d/networking stop
ifconfig eth0 hw ether 02:01:02:03:04:08
/etc/init.d/networking start
Execute 'ifconfig eth0
' to confirm.
- To configure manual bindings, you must enter the client-identifier DHCP pool configuration command with the appropriate hexadecimal values identifying the DHCP client. To configure a manual binding, first create a host pool, then specify the IP address of the client and client identifier or hardware address.
- Configuring Microsoft Hyper-V Virtual Machines to use a Static MAC address The Following are the instructions for configuring Microsoft Hyper-V machines to use a static MAC address. By following this procedure many software applications will not expire when virtual machines are moved from one physical host to another.
The above should work on Debian, Ubuntu, and similar distributions. Alternatively, under RHEL/Fedora and possibly other GNU/Linux distributions (incl. CentOS and Scientific Linux), to disable and restart networking, one must stop and start /etc/init.d/network
, instead of /etc/init.d/networking
.
If you have iproute2 utilities installed, you may prefer to use the 'ip
' command, as follows:
/etc/init.d/network stop
ip link set eth0 address 02:01:02:03:04:08
/etc/init.d/network start
To confirm your setting, you may prefer to execute 'ip link ls eth0
' or 'ip addr ls eth0
' instead of 'ifconfig eth0
'.
NOTE: You may not be able do this if using a DSL modem (depending on modem vendor or ISP).
Making Changes Permanent - Surviving a Reboot[edit]
In openSUSE and other SUSE-based systems (SUSE enterprise desktopserver, etc.) you can make changes 'permanent' across reboots by adding an appropriate entry to the /etc/sysconfig/network/ifcfg-ethN file (ifcfg-eth0 for the first Ethernet interface config file, ifcfg-eth1 - for the second, etc.):
All brokered item sales include a 48 hour quality inspection window. /martin-mac-2000-service-manual.html. Buying a brokered item like this is the perfect way to purchase hard to find equipment at a great price.
LLADDR=12:34:56:78:90:ab
In Red Hat Enterprise Linux (RHEL) and other similar systems (Fedora, CentOS, etc.) an easy way to make changes 'permanent' across reboots is to add an appropriate entry to the /etc/sysconfig/network-scripts/ifcfg-ethN file (ifcfg-eth0 for the first Ethernet interface config file, ifcfg-eth1 - for the second, etc.):
MACADDR=12:34:56:78:90:ab
Note: in the file is a value HWADDR - This is not the same thing. Use MACADDR for permanent changes.
from http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-networkscripts-interfaces.html
The HWADDR 'directive is useful for machines with multiple NICs to ensure that the interfaces are assigned the correct device names regardless of the configured load order for each NIC's module. This directive should not be used in conjunction with MACADDR.'..The MACADDR 'directive is used to assign a MAC address to an interface, overriding the one assigned to the physical NIC. This directive should not be used in conjunction with HWADDR.'
Upper and lower case letters are accepted when specifying the MAC address, because the network function converts all letters to upper case.
Mac Address Lookup
You can test changes without restarting the system by executing:
service network restart
(WARNING: doing this will break all existing network connections!)
On Debian, Ubuntu, and similar systems, place the following in the appropriate section of /etc/network/interfaces (within an iface stanza, e.g., right after the gateway line) so that the MAC address is set when the network device is started:
hwaddress ether 02:01:02:03:04:08
On Gentoo you may achieve the same result by adding an entry to the global configuration file /etc/conf.d/net for each Ethernet card. Example for the eth0 device:
mac_eth0='12:34:56:78:90:ab'
You can also use the tool 'GNU MACChanger' to change the MAC address under GNU/Linux.
To change MAC address during boot time with MACChanger, add the following line to your /etc/network/interfaces (example for the eth0 interface):
pre-up macchanger -m 12:34:56:78:90:AB eth0