① linux下怎么绑定 网卡的 MAC地址即如何修改
长期更改即为绑定,真实mac是写在网卡芯片里的,无法更改。
临时更改
ifconfig eth0 down
ifconfig eth0 hw ether mac地址
ifconfig eth0 up
长期更改
/etc/sysconfig/network-scripts/ifcfg-eth0中加入下面一句话:
MACADDR=mac地址
② linux修改MAC地址文件是什么
ifconfig
③ linux修改mac地址命令
1.临时性的修改:
①依次输入以下命令:
/sbin/ifconfig eth0 down/sbin/ifconfig eth0 hw ether 00:0C:29:36:97:20/sbin/ifconfig eth0 upservice network restart
2.永久性的修改:
方法①:
并把类似于1中的②脚本保存在/etc/rc.local中:这一步是起作用的关键步骤
脚本如下:
/sbin/ifconfig eth0 down/sbin/ifconfig eth0 hw ether 00:0C:29:36:97:20/sbin/ifconfig eth0 upservice network restart
方法②:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
添加
MACADDR=00:0C:29:36:97:20
注释掉原来的HWADDR
保存退出。
方法③:
直接编辑 /etc/network/interfaces 文件,在 iface eth0 inet static 后面添加一行:
编辑interfaces文件
如下所示:
重启网卡
注:MAC地址由udev在系统启动时探测网卡并加载,可在以下两个文件中反映出来
/sys/class/net/eth0/address 《Linux就该这么学》 一起学习linx
/etc/udev/rules.d/70-persistent-net.rules —-修改无效,根据硬件自动生成的文件
不过,用ifconfig修改了mac后,
/sys/class/net/eth0/address 的值随即跟着变了;但 /etc/udev/rules.d/70-persistent-net.rules 却没有变,只有在udev探测到硬件发生变化时才会修改这个文件。
④ 如何在linux中绑定一个ip地址192.168.0.49,mac地址00:00:39:b2:32:91
1、新建一个静态的mac-->ip对应表文件:ip-mac,将要绑定的IP和MAC地下写入此文件,格式为
ip
mac。
[root@ftpsvr
~]#
echo
'192.168.1.1
00:00:00:00:00:00
'
>
/etc/ip-mac
[root@ftpsvr
~]#
more
/etc/ip-mac
192.168.1.1
00:00:00:00:00:00
2、设置开机自动绑定
[root@ftpsvr
~]#
echo
'arp
-f
/etc/ip-mac
'
>>
/etc/rc.d/rc.local
3、手动执行一下绑定
[root@ftpsvr
~]#
arp
-f
/etc/ip-mac
4、确认绑定是否成功
[root@ftpsvr
~]#
arp
⑤ linux修改Mac地址
1、临时性的修改:
依次输入以下命令:
/sbin/ifconfig eth0 down
/sbin/ifconfig eth0 hw ether 00:0C:29:36:97:20
/sbin/ifconfig eth0 up
service network restart
2、永久性的修改:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
添加MACADDR=00:0C:29:36:97:20
注释掉原来的HWADDR
:wq 保存退出。
有危害,如果永久激活步骤错误则会造成无法联网的问题。
误区
#ifconfig eth0 down /*禁掉eth0网卡,这里以eth0网卡为例*/
#ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE/*修改eth0网卡的MAC地址*/
#ifconfig eth0 up /*重新启动eth0网卡*/
然后重新启动主机。
结论:按照这种方法修改MAC地址,重新启动主机系统后,MAC地址会自动还原。
⑥ 怎样修改linux mac地址
方法一:
1.关闭网卡设备
ifconfig eth0 down
2.修改MAC地址
ifconfig eth0 hw ether MAC地址
⑦ Linux中MAC地址问题
linux想修改系统中的MAC地址(例如改为0004a2d2e212),操作方法是:用#ifconfig
eth0
down
先把网卡禁用,否则会报告系统忙,无法更改;然后再用ifconfig
eth0
hw
ether
0004a2d2e212即可。
(此方法只适用即时的,重启后会恢复为默认的网卡MAC地址)
如果你想永久修改系统中的MAC地址,即让linux重启后也是修改后的MAC地址,可以这样操作:在/etc/rc.d/rc.local中加入以下三行(也可在/etc/init.d/network中添加以下三行)
ifconfig
eth0
down
ifconfig
eth0
hw
ether
0004a2d2e212
ifconfig
eth0
up
★、查看Linux中MAC地址是否改好
方法:可以这样操作:重启电脑,在终端下,输入IPconfig/all命令,于是Physical
Address就会显示一个地址,你检查一下即可得知MAC是否修改成功了。