There are a lot of reasons you might want to manually set your MAC address for your network card. I won’t ask you what your reason is.
有很多原因可能需要您手动设置网卡的MAC地址。 我不会问你你的原因是什么。
To change this setting, we’ll need to edit the /etc/network/interfaces file. You can choose to use a different editor if you’d like.
要更改此设置,我们需要编辑/ etc / network / interfaces文件。 您可以根据需要选择使用其他编辑器。
sudo gedit /etc/network/interfaces
sudo gedit / etc / network / interfaces
You should see the line for your network interface, which is usually eth0. If you have dhcp enabled, it will look like this:
您应该看到网络接口的行,通常为eth0。 如果启用了dhcp,它将如下所示:
auto eth0iface eth0 inet dhcp
自动eth0iface eth0 inet dhcp
Just add another line below it to make it look something like this:
只需在它下面添加另一行,使其看起来像这样:
auto eth0iface eth0 inet dhcp hwaddress ether 01:02:03:04:05:06
自动eth0iface eth0 inet dhcp hwaddress ether 01:02:03:04:05:06
Obviously you would want to choose something else for the MAC address, but it needs to be in the same format.
显然,您可能想为MAC地址选择其他内容,但是它必须采用相同的格式。
sudo /etc/init.d/networking restart
sudo /etc/init.d/networking重新启动
You will need to restart networking or reboot to take effect.
您将需要重新启动网络或重新启动才能生效。
翻译自: https://www.howtogeek.com/howto/ubuntu/change-your-network-card-mac-address-on-ubuntu/