當前位置:首頁 » 操作系統 » linuxmac地址修改

linuxmac地址修改

發布時間: 2023-01-11 20:44:23

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

  • :wq

  • 保存退出。

    方法③:

    直接編輯 /etc/network/interfaces 文件,在 iface eth0 inet static 後面添加一行:

  • pre-up ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx(要改成的MAC)


  • 編輯interfaces文件

  • sudo nano /etc/network/interfaces


  • 如下所示:

  • face eth0 inet staticpre-up ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx(要改成的MAC)address 192.168.1.10netmask 255.255.255.0gateway 192.168.1.1

  • 重啟網卡

  • sudo /etc/init.d/networking restart

  • 註: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修改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 保存退出。

有危害,如果永久激活步驟錯誤則會造成無法聯網的問題。

(2)linuxmac地址修改擴展閱讀:

誤區

#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地址問題

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

❹ 怎樣修改linux mac地址

方法一:
1.關閉網卡設備
ifconfig eth0 down
2.修改MAC地址
ifconfig eth0 hw ether MAC地址

❺ 如何修改linux虛擬機的mac地址

1.用命令行臨時解決:
#sudo
ifconfig
eth0
down
#sudo
ifconfig
eth0
hw
ether
AA:BB:CC:DD:EE:FF
#sudo
ifconfig
eth0
up
2.啟動自行修改
#sudo
vi
/etc/network/interfaces
在eth0的配置中加入如下
hwaddress
ether
AA:BB:CC:DD:EE:FF

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

❼ Linux中如何更改MAC地址

我們為什麼要更改MAC地址,也許你不希望你的實際MAC地址(物理地址)暴露在公共網路上。另一種情況是,網路管理員可能在網路設備中阻止了一個特定的MAC地址。

環境

Centos 7.7 Minimal

GNU MAC changer 1.7.0

查詢網卡和MAC地址

[root@localhost ~]# ip link show1: lo:mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:002: ens33: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000

    link/ether 00:0c:29:48:4c:9a brd ff:ff:ff:ff:ff:ff

網卡名稱是ens33,MAC地址是00:0c:29:48:4c:9a。請記下自己的MAC地址,稍後做完實驗恢復到原來的MAC地址。

使用macchanger工具更改MAC地址

Macchanger可以查看、修改MAC地址。

安裝macchanger

[root@localhost ~]# git clone https://github.com/alobbs/macchanger

[root@localhost ~]# yum -y install autoconf automake gcc gcc-c++ texinfo

如何使用macchanger

使用下面的 命令 生成一個隨機的mac地址為ens33網卡:

[root@localhost ~]# macchanger -r ens33

Current MAC:  00:0c:29:48:4c:9a (VMware, Inc.)

Permanent MAC: 00:0c:29:48:4c:9a (VMware, Inc.)

New MAC:      a2:97:a2:55:53:be (unknown)

查看一下ens33的MAC地址是否改變了

[root@localhost ~]# ip link show ens332: ens33: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000

    link/ether a2:97:a2:55:53:be brd ff:ff:ff:ff:ff:ff

可以更改成一個自己指定的mac地址,使用下面的 命令 更改:

[root@localhost ~]# macchanger --mac=XX:XX:XX:XX:XX:XX

如果想要恢復到真實的MAC地址,請使用下面的命令:

[root@localhost ~]# macchanger -p ens33

Current MAC:  a2:97:a2:55:53:be (unknown)

Permanent MAC: 00:0c:29:48:4c:9a (VMware, Inc.)

New MAC:      00:0c:29:48:4c:9a (VMware, Inc.)

總結

我們為什麼要更改MAC地址,也許你不希望你的實際MAC地址(物理地址)暴露在公共網路上。另一種情況是,網路管理員可能在網路設備中阻止了一個特定的MAC地址。

❽ linux系統怎麼修改網卡物理地址

使用Win7MAC地址修改工具
1,只適用於windows7系統的網卡MAC地址修改。XP的可以用,但沒做什麼測試。
2,部分windows7下的無線網卡地址無法修改,理論上也可以使用本軟體修改。
3,修改MAC地址前,請先在開始菜單-運行,輸入cmd打開控制台,輸入getmac獲取原來網卡MAC並記下來,用於以後可以改回來。
4,軟體使用方法很簡單,只需在下拉列表選擇所要修改的網卡,然後在文本框裡面輸入一個新的MAC地址,比如EF2d32BC6525(注意不要加橫杠),然後點擊修改按鈕即可修改。

❾ linux修改Mac地址

有三種方法: 方法一: 1.關閉網卡設備 ifconfig eth0 down 2.修改MAC地址 ifconfig eth0 hw ether MAC地址 3.重啟網卡 ifconfig eth0 up 方法二: 以上方法一修改後linux重啟後MAC又恢復為原來的,為了下次啟動時修改後的MAC仍有效,我們可以修改文件file:/etc/rc.d/rc.sysinit(RedFlag Linux為這個文件,其他版本的linux應該不同)的內容,在該文件末尾加以下內容: ifconfig eth0 down ifconfig eth0 hw ether MAC地址 ifconfig eth0 up 方法三: 很簡單的,只是在./etc/sysconfig/network-scripts/ifcfg-eth0中加入下面一句話: MACADDR=00:AA:BB:CC:DD:EE

❿ linux修改Mac地址

有三種方法:
方法一:
1.關閉網卡設備
ifconfig eth0 down
2.修改MAC地址
ifconfig eth0 hw ether MAC地址
3.重啟網卡
ifconfig eth0 up

方法二:
以上方法一修改後linux重啟後MAC又恢復為原來的,為了下次啟動時修改後的MAC仍有效,我們可以修改文件file:/etc/rc.d/rc.sysinit(RedFlag Linux為這個文件,其他版本的linux應該不同)的內容,在該文件末尾加以下內容:
ifconfig eth0 down
ifconfig eth0 hw ether MAC地址
ifconfig eth0 up

方法三:
很簡單的,只是在./etc/sysconfig/network-scripts/ifcfg-eth0中加入下面一句話:
MACADDR=00:AA:BB:CC:DD:EE
系統學習Linux,詳情參考《Linux就該這么學》。

熱點內容
安卓市場手機版從哪裡下載 發布:2025-05-15 20:17:28 瀏覽:813
幼兒速演算法 發布:2025-05-15 20:15:08 瀏覽:86
best把槍密碼多少 發布:2025-05-15 20:13:42 瀏覽:547
android安裝程序 發布:2025-05-15 20:13:20 瀏覽:559
c語言跳出死循環 發布:2025-05-15 20:06:04 瀏覽:824
a19處理器相當於安卓哪個水平 發布:2025-05-15 20:05:29 瀏覽:639
榮耀9i安卓強行關機按哪個鍵 發布:2025-05-15 20:00:32 瀏覽:750
密碼鎖寫什麼最好 發布:2025-05-15 19:05:31 瀏覽:782
5的源碼是 發布:2025-05-15 19:04:07 瀏覽:719
c語言創建的源文件 發布:2025-05-15 18:54:08 瀏覽:611