每个 NIC (网络接口卡)( (Network Interface Card))都有一个唯一的 MAC 地址(媒体访问控制(Media Access Control))。这适用于所有类型的网卡,包括以太网(Ethernet)卡和WiFi卡。MAC 地址(MAC Address)是一个六字节数字或 12 位十六进制数字,用于唯一标识网络上的主机。
MAC 地址(MAC address)的一个示例是 1F-2E-3D-4C-5B-6A,它属于OSI 模型的(OSI model)第 2 层(Layer 2)网络协议。在当今的网络中,ARP或地址解析协议(Address Resolution Protocol)将MAC 地址(MAC address)转换为第 3 层(Layer 3)协议地址(protocol address),例如IP 地址(IP address)。MAC 地址(MAC address)也可以称为物理地址(Physical Address)。如果您不知道,请阅读我的帖子,了解如何找到您的 MAC 地址(how to find your MAC address)。
所有MAC地址都被硬编码到网卡(network card)中,并且永远无法更改。但是,您可以使用一些简单的技巧在操作系统本身中(operating system)更改或欺骗 MAC 地址。(change or spoof the MAC address)
那么为什么要更改MAC 地址(MAC address)呢?这有很多原因,主要与绕过调制解调器、路由器或防火墙上设置的某种(router or firewall)MAC 地址(MAC address)过滤器有关。更改MAC 地址可以帮助您通过模拟不受限制的(MAC Address)MAC 地址(MAC Address)或欺骗已授权的MAC(MAC address)地址来绕过某些网络限制。
例如,WiFi 网络(WiFi network)可能只允许授权的计算机连接到网络,并根据MAC 地址(MAC address)过滤(network and filters)掉计算机。如果您能嗅出一个合法的MAC 地址(MAC address),您就可以欺骗您的MAC 地址并获得(MAC address and gain access)对WiFi 网络(WiFi network)的访问权。
另一个例子是,如果您的ISP只允许一定数量的计算机从您家连接到Internet 。如果您有更多计算机需要连接,您可以欺骗授权计算机的(computer and connect)MAC 地址(MAC address)并从其他计算机连接。
更改 Windows MAC 地址
您可以按照以下步骤轻松更改Windows中网卡 的MAC 地址(MAC address)。(network card)
第 1 步(Step 1):单击开始(Start),然后单击控制面板(Control Panel),然后单击网络连接(Network Connections),然后右键单击要更改MAC 地址的(MAC address)网络连接(network connection)并选择属性(Properties)。它通常是Local Area Connection或Wireless Network Connection。
如果您使用的是Windows Vista 、Windows 7 或更高版本,则必须转到控制面板、(Control Panel,)网络和 Internet、(Network and Internet,)网络和共享中心,(Network and Sharing Center,)然后单击 管理网络连接(Manage Network Connections )或更改适配器设置( Change adapter settings)。
然后您可以右键单击适配器并选择Properties。
第 2 步(Step 2):在“常规(General)”或“网络(Networking)”选项卡上,单击“配置(Configure)”按钮。
第 3 步(Step 3):现在单击“高级(Advanced)”选项卡,然后单击“本地管理地址(Locally Administered Address)”属性或“网络地址(Network Address)”属性。
默认情况下,选择不存在(Not Present)值。继续并单击Value 单选按钮并输入(radio button and enter)新的MAC 地址(MAC address)。MAC地址(MAC address)是6对数字和字符的组合,即40-A2-D9-82-9F-F2 。您应该输入不带破折号的MAC 地址。(MAC address)
您可以转到 命令提示符并输入(command prompt and type)IPCONFIG IPCONFIG /ALL以检查MAC 地址(MAC address)是否已更改。继续并重新启动计算机以使更改生效。
这是在Windows中更改MAC 地址(MAC address)的最简单方法。您也可以通过注册表这样做,但它更具技术性,可能大多数人都不需要。
更改 OS X MAC 地址
在OS X上更改MAC 地址(MAC address)肯定不像在Windows上那么容易。首先,您必须使用终端(Terminal)(类似于Windows中的命令提示符)来实际更改MAC 地址(MAC address)。
其次,您需要手动弄清楚适配器的技术名称,然后才能更改设置。我将逐步解释下面的所有内容,但有时会有点复杂。(explain everything)
首先,让我们找出您Mac的当前(Mac)MAC 地址(MAC address)。您可以通过以下两种方式之一执行此操作:通过System Preferences或通过Terminal。打开系统偏好设置(System Preferences),点击网络(Network),然后点击 高级(Advanced)按钮。确保(Make)首先在左侧的列表框中选择适当的接口(WiFi、以太网(Ethernet)等)。
单击硬件(Hardware)选项卡,您将看到第一行是MAC 地址(MAC Address)。我以为您可以简单地从“配置”下拉列表中选择“(Configure)手动(Manually)” ,但这不允许您编辑MAC 地址(MAC address)。
在Terminal中,您可以通过键入以下命令来获取MAC 地址:(MAC address)
ifconfig en0 | grep ether
这将为您提供 en0 接口的MAC 地址(MAC address)。根据您的计算机上有多少接口,您可能需要多次运行此命令,每次将数字加 1。例如,我运行下面的命令,直到我到达一个不存在的界面。
现在您可以简单地将此处列出的MAC地址与您通过(MAC)System Preferences看到的 MAC 地址进行比较。就我而言,我的WiFi MAC 地址(WiFi MAC address)f8:1e:df:d8:9d:8a与en1匹配,因此这是我必须用于下一个命令的接口。
在我们更改MAC 地址之前,如果需要,您可以在(MAC address)终端(Terminal)中使用一个有用的命令生成一个随机MAC 地址(MAC address)。
openssl rand -hex 6 | sed ‘s/\(..\)/\1:/g; s/.$//’
现在您有了新的MAC 地址(MAC address),您可以使用以下命令更改当前地址。将 XX 替换(Replace XX)为您要使用的实际MAC 地址。(MAC address)
sudo ifconfig en0 ether xx:xx:xx:xx:xx:xx
为此,您需要以管理员(Administrator)身份登录,或者您必须在OS X中启用root 帐户(root account)。默认情况下,root 是禁用的,如果可以的话,最好将其禁用。只需以管理员身份登录,您应该就可以正常运行该命令。不过,它会在更改MAC 地址(MAC address)之前询问您的密码。
此外,如果您仍然连接到WiFi 网络(WiFi network),地址也不会改变(t change)。您需要先断开与任何网络的连接,然后运行该命令。令人惊讶的是,在OS X中断开与无线网络(wireless network)的连接一点都不直观。您必须按住Option键,然后单击WiFi 图标(WiFi icon)才能看到断开连接选项(disconnect option)。
所以这里是我运行的所有命令的概要,以获取当前的MAC 地址(MAC address),生成一个随机(random one)的,更新MAC 地址(MAC address),然后验证以确保它确实已更改。
正如我之前提到的,这绝对不像Windows上的过程那么简单,但是如果您只需复制并粘贴上面的命令,您应该可以做到。如果您有任何问题,请随时发表评论。享受!
Change or Spoof a MAC Address in Windows or OS X
Every NIC (Network Interface Card) has a unique MAC address (Media Access Control). This applies to all types of network cards, including Ethernet cards and WiFi cards. The MAC Address is a six-byte number or 12-digit hexadecimal number that is used to uniquely identify a host on a network.
An example of a MAC address is 1F-2E-3D-4C-5B-6A and it falls into the Layer 2 networking protocol of the OSI model. In today’s networks, ARP, or Address Resolution Protocol converts a MAC address to a Layer 3 protocol address, such as an IP address. A MAC address can also be called a Physical Address. Read my post on how to find your MAC address if you don’t know it.
All MAC addresses are hard-coded into a network card and can never be changed. However, you can change or spoof the MAC address in the operating system itself using a few simple tricks.
So why would you want to change your MAC address? Well there are many reasons for this, mostly related to bypassing some kind of MAC address filter set on a modem, router or firewall. Changing the MAC Address can help you bypass certain network restrictions by emulating an unrestricted MAC Address or by spoofing a MAC address that is already authorized.
For example, a WiFi network may allow only authorized computers to connect to the network and filters out computers based on the MAC address. If you can sniff out a legitimate MAC address, you can then spoof your MAC address and gain access to the WiFi network.
Another example is if you have an ISP that allows only a certain number of computers to connect to the Internet from your home. If you have more computers that need to connect, you can spoof the MAC address of an authorized computer and connect from a different computer.
Change Windows MAC Address
You can change the MAC address for the network card in Windows pretty easily following the steps below.
Step 1: Click on Start, then Control Panel, then Network Connections, and right-click on the network connection you want to change the MAC address for and select Properties. It will normally either be Local Area Connection or Wireless Network Connection.
If you are using Windows Vista, Windows 7 or higher, you have to go to Control Panel, then Network and Internet, then Network and Sharing Center, and then click on Manage Network Connections or Change adapter settings.
Then you can right-click on the adapter and choose Properties.
Step 2: On the General or Networking tab, click the Configure button.
Step 3: Now click on the Advanced tab and click on the Locally Administered Address property or the Network Address property.
By default, the Not Present value is selected. Go ahead and click on the Value radio button and enter in a new MAC address. The MAC address is a combination of 6 pairs of numbers and characters, i.e. 40-A2-D9-82-9F-F2. You should enter the MAC address without the dashes.
You can go to the command prompt and type in IPCONFIG /ALL to check that the MAC address has been changed. Go ahead and restart the computer in order for the changes to take effect.
This is the simplest way to change your MAC address in Windows. You can also do so via the registry, but it’s much more technical and probably not required by most people.
Change OS X MAC Address
Changing the MAC address on OS X is definitely not as easy as it is on Windows. Firstly, you have to use Terminal (similar to command prompt in Windows) to actually change the MAC address.
Secondly, you need to manually figure out the technical name of the adapter before you can change the settings. I’ll explain everything below step by step, but it gets a bit complicated at times.
To start, let’s find out the current MAC address for your Mac. You can do this in one of two ways: via System Preferences or via Terminal. Open System Preferences, click on Network and then click on the Advanced button. Make sure to select the appropriate interface first (WiFi, Ethernet, etc) in the listbox on the left.
Click on the Hardware tab and you will see the first line is MAC Address. I thought you could simply choose Manually from the Configure dropdown, but that doesn’t allow you to edit the MAC address.
In Terminal, you can get the MAC address by typing in the following command:
ifconfig en0 | grep ether
This will give you the MAC address for the en0 interface. Depending on how many interfaces you have on your computer, you might need to run this command several times adding 1 to the number each time. For example, I ran the following commands below until I reached an interface that didn’t exist.
Now you can simply compare the MAC addresses listed here with the one you saw via System Preferences. In my case, my WiFi MAC address of f8:1e:df:d8:9d:8a matches with en1, so that is the interface I have to use for the next commands.
Before we change the MAC address, you can use a useful command in Terminal to generate a random MAC address if you need one.
openssl rand -hex 6 | sed ‘s/\(..\)/\1:/g; s/.$//’
Now that you have a new MAC address, you can change the current one using the following command below. Replace XX with the actual MAC address you want to use.
sudo ifconfig en0 ether xx:xx:xx:xx:xx:xx
In order to do this, you need to be logged in as an Administrator or you have to enable the root account in OS X. By default, root is disabled and it’s better to leave it disabled if you can. Just login as an admin and you should be able to run the command just fine. It will ask you for your password, though, before changing the MAC address.
Also, the address won’t change if you are still connected to a WiFi network. You need to first disconnect from any networks and then run the command. Surprisingly, disconnecting from a wireless network in OS X is not intuitive at all. You have to press and hold the Option key and then click on the WiFi icon to see the disconnect option.
So here is a rundown of all the commands I ran in order to get the current MAC address, generate a random one, update the MAC address and then verify to make sure it had actually changed.
As I mentioned earlier, this is definitely not as straightforward as the process is on Windows, but you should be able to do it if you simply copy and paste the commands above. If you have any questions, feel free to post a comment. Enjoy!