① 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是否修改成功了。