linux修改mac地址_如何(以及为什么)在Windows,Linux和Mac上更改您的MAC地址

linux修改mac地址

linux修改mac地址

ethernet-network-interface

A device’s MAC address is assigned by the manufacturer, but it’s not to hard to change—or “spoof”—those addresses when you need to. Here’s how do do it, and why you might want to.

设备的MAC地址是由制造商分配的,但要更改这些地址(或“欺骗”)这些地址并不难。 这是操作方法,以及您可能要这么做的原因。

Each network interface connected to your network—whether it’s your router, wireless device, or network card in your computer—has a unique media access control (MAC) address. These MAC addresses—sometimes referred to as physical or hardware addresses—are assigned in the factory, but you can usually change the addresses in software.

连接到网络的每个网络接口 (无论是路由器,无线设备还是计算机中的网卡)都具有唯一的媒体访问控制(MAC)地址 。 这些MAC地址(有时称为物理地址或硬件地址)是在工厂分配的,但是通常可以在软件中更改地址。

什么MAC地址用于 (What MAC Addresses Are Used For)

At the lowest networking level, network interfaces attached to a network use MAC addresses to communicate with one another. When a browser on your computer needs to grab a web page from a server on the Internet, for example, that request passes down through several layers of the TCP/IP protocol. The web address you type gets translated to the IP address of the server. Your computer sends the request to your router, which then sends it out onto the Internet. At the hardware level of your network card, though, your network card is only looking at other MAC addresses for interfaces on the same network. It knows to send the request to the MAC address of your router’s network interface.

在最低的网络级别上,连接到网络的网络接口使用MAC地址相互通信。 例如,当您计算机上的浏览器需要从Internet上的服务器获取网页时,该请求将通过TCP / IP协议的多个层传递。 您键入的网址将转换为服务器的IP地址。 您的计算机将请求发送到路由器,然后路由器将其发送到Internet。 但是,在网卡的硬件级别上,网卡仅查找同一网络上接口的其他MAC地址。 它知道将请求发送到路由器网络接口的MAC地址。

In addition to their core networking use, MAC addresses are often used for other purposes:

除了其核心网络用途外,MAC地址通常还用于其他目的:

  • Static IP Assignment: Routers allow you to assign static IP addresses to your computers. When a device connects, it always receives a specific IP address if it has a matching MAC address

    静态IP分配 :路由器使您可以为计算机分配静态IP地址 。 设备连接时,如果它具有匹配的MAC地址,则它总是会收到一个特定的IP地址。

  • MAC Address Filtering: Networks can use MAC address filtering, only allowing devices with specific MAC addresses to connect to a network. This isn’t a great security tool because people can spoof their MAC addresses.

    MAC地址过滤 :网络可以使用MAC地址过滤 ,仅允许具有特定MAC地址的设备连接到网络。 这不是一个很好的安全工具,因为人们可以欺骗其MAC地址。

  • MAC Authentication: Some Internet service providers may require authentication with a MAC address and only allow a device with that MAC address to connect to the Internet. You may need to change your router or computer’s MAC address to connect.

    MAC身份验证 :某些Internet服务提供商可能要求使用MAC地址进行身份验证,并且仅允许具有该MAC地址的设备连接到Internet。 您可能需要更改路由器或计算机的MAC地址才能连接。

  • Device Identification: Many airport Wi-Fi networks and other public Wi-Fi networks use a device’s MAC address to identify it. For example, an airport Wi-Fi network might offer a free 30 minutes and then ban your MAC address from receiving more Wi-Fi. Change your MAC address and you could get more Wi-Fi. (Free, limited Wi-Fi may also be tracked using browser cookies or an account system.)

    设备标识 :许多机场Wi-Fi网络和其他公共Wi-Fi网络使用设备的MAC地址进行标识。 例如,机场Wi-Fi网络可能会提供30分钟的免费时间,然后禁止您的MAC地址接收更多Wi-Fi。 更改您的MAC地址,您获得更多的Wi-Fi。 (也可以使用浏览器Cookie或帐户系统跟踪免费的有限Wi-Fi。)

  • Device Tracking: Because they’re unique, MAC addresses can be used to track you. When you walk around, your smartphone scans for nearby Wi-Fi networks and broadcasts its MAC address. A company named Renew London used trash bins in the city of London to track people’s movements around the city based on their MAC addresses. Apple’s iOS 8 will use a random MAC address each time it scans for nearby Wi-Fi networks to prevent this sort of tracking.

    设备跟踪 :由于它们是唯一的,因此可以使用MAC地址来跟踪您。 当您走来走去时,您的智能手机会扫描附近的Wi-Fi网络并广播其MAC地址。 一家名为Renew London的公司使用伦敦市的垃圾桶来根据人们的 MAC地址跟踪人们在城市周围的活动 。 苹果的iOS 8每次扫描附近的Wi-Fi网络时都会使用随机的MAC地址,以防止此类跟踪。

Bear in mind that each network interface has its own MAC address. So, on a typical laptop with both a Wi-Fi radio and a wired Ethernet port, the wireless and wired network interface each have their own unique MAC addresses.

请记住,每个网络接口都有其自己的MAC地址。 因此,在同时具有Wi-Fi无线电和有线以太网端口的典型笔记本电脑上,无线和有线网络接口各自具有自己的唯一MAC地址。

在Windows中更改MAC地址 (Change a MAC Address in Windows)

Most network cards allow you to set a custom MAC address from their configuration panes in the Device Manager, although some network drivers may not support this feature.

尽管某些网络驱动程序可能不支持此功能,但大多数网卡都允许您从“设备管理器”的配置窗格中设置自定义MAC地址。

First, open the Device Manager. On Windows 8 and 10, press Windows+X, and then click “Device Manager” on the Power User menu. On Windows 7, press the Windows key, type “Device Manager” to search for it, and then click the “Device Manager” entry. The Device Manager app will look the same no matter which version of Windows you’re using.

首先,打开设备管理器。 在Windows 8和10上,按Windows + X,然后在“高级用户”菜单上单击“设备管理器”。 在Windows 7上,按Windows键,键入“设备管理器”进行搜索,然后单击“设备管理器”条目。 无论您使用哪个Windows版本,设备管理器应用程序的外观都相同。

In Device Manager, under the “Network adapters” section, right-click the network interface you want to modify, and then select “Properties” from the context menu.

在设备管理器的“网络适配器”部分下,右键单击要修改的网络接口,然后从上下文菜单中选择“属性”。

In the properties window, on the “Advanced” tab and select the “Network Address” entry in the “Property” list. If you don’t see this option, then your network driver doesn’t support this feature.

在属性窗口中的“高级”选项卡上,然后在“属性”列表中选择“网络地址”条目。 如果看不到此选项,则说明您的网络驱动程序不支持此功能。

Enable the Value option and type your desired MAC address without any separating characters—don’t use dashes or colons. Click “OK” when you’re done.

启用“值”选项,并键入所需的MAC地址,且不要包含任何分隔符-请勿使用破折号或冒号。 完成后,单击“确定”。

在Linux中更改MAC地址 (Change a MAC Address in Linux)

Modern Linux distributions like Ubuntu typically use Network Manager, which provides a graphical way to spoof a MAC address.

像Ubuntu这样的现代Linux发行版通常使用网络管理器,它提供了一种欺骗MAC地址的图形方式。

For example, in Ubuntu you’d click the network icon on the top panel, click “Edit Connections,” select the network connection you want to modify, and then click “Edit.” On the Ethernet tab, you’d enter a new MAC address in the “Cloned MAC address” field, and then save your changes.

例如,在Ubuntu中,您将单击顶部面板上的网络图标,单击“编辑连接”,选择要修改的网络连接,然后单击“编辑”。 在“以太网”选项卡上,您将在“克隆的MAC地址”字段中输入新的MAC地址,然后保存所做的更改。

change-ubuntu-linux-mac-address-with-network-manager

You can also do this the old-fashioned way. This involves taking the network interface down, running a command to change its MAC address, and then bringing it back up. Be sure to replace “eth0” with the name of the network interface you want to modify and enter the MAC address of your choice:

您也可以使用老式的方法。 这涉及关闭网络接口,运行命令以更改其MAC地址,然后将其恢复。 确保将“ eth0”替换为您要修改的网络接口的名称,然后输入您选择的MAC地址:

sudo ifconfig eth0 down

sudo ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx

sudo ifconfig eth0 up
change-mac-address-from-ubuntu-command-line

You’ll have to modify the appropriate configuration file under /etc/network/interfaces.d/ or the /etc/network/interfaces file itself if you want this change to always take effect at boot time. If you don’t, your MAC address will be reset when you restart.

如果要使此更改始终在引导时生效,则必须修改/etc/network/interfaces.d/下的适当配置文件或/etc/network/interfaces文件本身。 如果不这样做,则重新启动时将重置您的MAC地址。

在Mac OS X中更改MAC地址 (Change a MAC Address in Mac OS X)

Mac OS X’s System Preferences pane displays each network interface’s MAC address, but doesn’t allow you to change it. For that, you need the Terminal.

Mac OS X的“系统偏好设置”窗格显示每个网络接口的MAC地址,但不允许您对其进行更改。 为此,您需要终端。

Open a Terminal window (press Command + Space, type “Terminal,” and then press Enter.) Run the following command, replacing en0 with your network interface’s name and filling in your own MAC address:

打开一个“终端”窗口( 按Command + Space ,输入“ Terminal”,然后按Enter。)运行以下命令,用网络接口名称替换en0并填写您自己的MAC地址:

sudo ifconfig en0 xx:xx:xx:xx:xx:xx

The network interface will generally be either en0 or en1 , depending on whether you want to configure a Mac’s Wi-Fi or Ethernet interface. Run the ifconfig command to see a list of interfaces if you’re not sure of the appropriate network interface’s name.

网络接口通常为en0en1 ,具体取决于您要配置Mac的Wi-Fi还是以太网接口。 如果不确定合适的网络接口名称,请运行ifconfig命令以查看接口列表。

change-mac-address-on-mac-os-x

As on Linux, this change is temporary and will be reset when you next reboot. You’ll need to use a script that automatically runs this command on boot if you’d like to permanently change your Mac address.

与在Linux上一样,此更改是临时的,下次重新启动时将重置。 如果您想永久更改Mac地址,则需要使用在启动时自动运行此命令的脚本。



You can verify your change took effect by running a command that shows your network connection details and checking what MAC address your network interface reports afterwards. On Windows, run the ipconfig /all command in a Command Prompt window. On Linux or Mac OS X, run the ifconfig command. And if you need to change the MAC address on your router, you’ll find this option in your router’s web interface.

您可以通过运行显示网络连接详细信息的命令并检查网络接口随后报告的MAC地址来验证更改是否生效。 在Windows上,在“命令提示符”窗口中运行ipconfig /all命令。 在Linux或Mac OS X上,运行ifconfig命令。 而且,如果您需要更改路由器上的MAC地址,则可以在路由器的网络界面中找到此选项。

翻译自: https://www.howtogeek.com/192173/how-and-why-to-change-your-mac-address-on-windows-linux-and-mac/

linux修改mac地址

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值