编辑“/etc/network/interfaces”文件()
sudo vim /etc/network/interfaces
在此配置文件中找到“iface eth0 inet static”行,在其后面加上“hwaddress ether AA:BB:CC:DD:EE:FF”,如何没有这一行,则自己手动完整添加
hwaddress ether AA:BB:CC:DD:EE:FF
vim /etc/network/interfaces.d/eth0 # 修改配置文件
增加下面的内容 (实际内容可按需修改)
#auto eth0 # 注释 #iface eth0 inet dhcp # 网卡自动获取IP 注释 auto eth0 iface eth0 inet static address 192.168.1.10 # IP 地址, 下面部分地址需要填写为同网段的地址 network 192.168.1.0 netmask 255.255.255.0 # 一般保持不变 broadcast 192.168.1.255 gateway 192.168.1.1 # 网关路由器地址 dns-nameservers 192.168.1.1 # 一般也填网关路由器地址 hwaddress ether 54:52:00:62:28:55