Linux change the physical address of the network card (MAC addresses)

Source: Internet
Author: User
Tags linux

Some places are the network address and the interface card Physical address binding, when changing the network card or other computer may not be on the network, the following describes the change of physical address (MAC addresses) method. Divided into temporary changes and long-term changes in two cases, both methods do not actually change the actual network card properties.

Temporary changes

The so-called temporary change, refers to the system after restarting the failure of the short-term change method, simpler.

The physical address settings for the Linux network card are made when the network is set up.

First make sure you are using the root user. Suppose the eth0 is set.

Nic "Off" first

# ifconfig eth0 Down

Replace the physical address and replace the bold part with the MAC address you want to change:

# ifconfig eth0 hw ether AA:BB:CC:DD:EE:FF

Enable eth0.

# ifconfig eth0 up

If you want, add your own commands to join the route.

Long-term changes

This means that the changes can still be retained after the reboot. A text editor configuration file is required.

Debian (Ubuntu is probably also listed here)

Edit/etc/network/interfaces, find the place related to eth0, modify it to form:

Allow-hotplug eth0

Iface eth0 inet DHCP

#iface eth0 inet Static

# address 1.1.1.6

# netmask 255.255.255.0

# Gateway 1.1.1.1

Hwaddress ether 00:aa:bb:cc:dd:ee

The part of the annotation is the static IP's writing, the current annotation is the dynamic IP's formulation. For more information, see Debian Network settings

ArchLinux or Gentoo

Edit/etc/rc.conf (ArchLinux) or/etc/conf.d/net (Gentoo), in the Eth0-configured string, by adding HW ether 00:aa:bb:cc:dd:ee to the front of the IP address. Gentoo and ArchLinux network settings, refer to the release documentation.

Fedora or Redhat

Edit/etc/sysconfig/network-scripts/ifcfg-eth0 (please modify eth0 to your network card number if necessary), add or modify

Hwaddr=aa:bb:cc:dd:ee:ff

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.