Change the physical address of the NIC in Linux. MacAddress

Source: Internet
Author: User
Article title: change the physical address MacAddress of the NIC in Linux. Linux is a technology channel of the IT lab in China. Some basic categories, such as desktop applications, Linux system management, kernel research, embedded systems, and open-source systems, are used to bind network addresses to the physical addresses of NICs, if you change the network adapter or other computers, you may not be able to access the network. The following describes how to change the physical Address (MAC Address. Temporary changes and long-term changes do not actually change the true attributes of the NIC.
 
Temporary changes
 
Temporary changes refer to short-term changes that expire after the system is restarted.
 
The physical address of the Linux Nic is set during network settings.
 
First, make sure you are using the root user. Set eth0.
 
Enable Nic "off"
 
# Ifconfig eth0 down
 
Change the physical address, and change the bold part to the MAC address you want to change:
 
# Ifconfig eth0 hw ether AA: BB: CC: DD: EE: FF
 
Enable eth0.
 
# Ifconfig eth0 up
 
If necessary, add the command to add the route.
 
Note:
 
If you want to set other information such as IP addresses, you must keep the hw ether physical address behind the device name (such as eth0.
 
Long-term changes
 
The changes can be retained after restart. A text editor configuration file is required.
 
Debian (Ubuntu may also be listed here)
 
Edit/etc/network/interfaces, locate the eth0-related location, and modify it to the following figure:
 
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 comments are static IP addresses, but not static IP addresses. For more information, see Debian network settings.
 
Archlinux or Gentoo
 
Edit/etc/rc. conf (Archlinux) or/etc/conf. d/net (Gentoo), in the eth0 configuration string, add hw ether 00: AA: BB: CC: DD: EE to the front of the IP address. for network settings of Gentoo and Archlinux, see the relevant documentation of the release.
 
Fedora or Redhat
 
Edit/etc/sysconfig/network-scripts/ifcfg-eth0 (modify eth0 to your Nic ID if necessary), add or modify
 
HWADDR = AA: BB: CC: DD: EE: FF
 
You can.
 
Related Article

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.