佳木斯湛栽影视文化发展公司

主頁(yè) > 知識(shí)庫(kù) > Centos系統(tǒng)下查看和修改網(wǎng)卡Mac地址(附ifconfig命令格式)

Centos系統(tǒng)下查看和修改網(wǎng)卡Mac地址(附ifconfig命令格式)

熱門(mén)標(biāo)簽:免費(fèi)建站 Win7旗艦版 服務(wù)外包 百度競(jìng)價(jià)排名 Linux服務(wù)器 網(wǎng)站建設(shè) 智能手機(jī) 硅谷的囚徒呼叫中心

  本文將為大家詳細(xì)的介紹centos系統(tǒng)修改網(wǎng)卡Mac地址的方法,具體內(nèi)容如下:

  在文件/etc/sysconfig/network-scripts/ifcfg-eth0 中增加一行類似如下

  MACADDR=00:04:AC:33:1C:3B

  答:MAC地址是網(wǎng)卡的物理地址,其實(shí)在Linux下也可更改MAC地址:

  1)閉網(wǎng)卡設(shè)備

  /sbin/ifconfig eth0 down

  2)修改MAC地址

  /sbin/ifconfig eth0 hw ether MAC地址

  3)重啟網(wǎng)卡

  /sbin/ifconfig eth0 up

  Red Hat Linux下如何修改網(wǎng)卡MAC地址

  OS版本:Red Hat Enterprise Linux AS4

  核心:Kernel 2.6.9-42

  網(wǎng)上有很多關(guān)于linux下修改MAC地址的方法,大多依葫蘆畫(huà)瓢,似乎都沒(méi)驗(yàn)證過(guò),達(dá)不到修改的目的。

  經(jīng)過(guò)我的詳細(xì)測(cè)試,最終成功解決了這個(gè)問(wèn)題。

  誤區(qū)一:

  #ifconfig eth0 down /*禁掉eth0網(wǎng)卡,這里以eth0網(wǎng)卡為例*/

  #ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE /*修改eth0網(wǎng)卡的MAC地址*/

  #ifconfig eth0 up /*重新啟動(dòng)eth0網(wǎng)卡*/

  然后重新啟動(dòng)主機(jī)。

  結(jié)論:按照這種方法修改MAC地址,重新啟動(dòng)主機(jī)系統(tǒng)后,MAC地址會(huì)自動(dòng)還原。

  誤區(qū)二:

  #ifconfig eth0 down

  #cd /etc/sysconfig/network-scripts

  #vi ifcfg-eth0

  修改其中的"HWADDR=xx:xx:xx:xx:xx:xx"

  #ifconfig eth0 up

  #service network start

  結(jié)論:按照這種方法修改MAC地址后將無(wú)法啟用網(wǎng)絡(luò),會(huì)出現(xiàn)如下提示:

  “Bringing up interface eth0: Device eth0 has different MAC address than expected,ignoring.”

  那么,在linux環(huán)境下如何保證修改后的MAC地址永久保存呢?正確的步驟如下:

  #ifconfig eth0 down

  #cd /etc/sysconfig/network-scripts

  #vi ifcfg-eth0

  修改其中的"HWADDR=xx:xx:xx:xx:xx:xx"為"MACADDR=xx:xx:xx:xx:xx:xx"

  #ifconfig eth0 up

  #service network start

  關(guān)鍵詞:HWADDR和MACADDR是有區(qū)別的。

  最后附ifconfig命令格式:

  ifconfig --help
  Usage:
  ifconfig [-a] [-v] [-s] interface> [[AF>] address>]
  [add address>[/prefixlen>]]
  [del address>[/prefixlen>]]
  [[-]broadcast [address>]]  [[-]pointopoint [address>]]
  [netmask address>]  [dstaddr address>]  [tunnel address>]
  [outfill NN>] [keepalive NN>]
  [hw HW> address>]  [metric NN>]  [mtu NN>]
  [[-]trailers]  [[-]arp]  [[-]allmulti]
  [multicast]  [[-]promisc]
  [mem_start NN>]  [io_addr NN>]  [irq NN>]  [media type>]
  [txqueuelen NN>]
  [[-]dynamic]
  [up|down] ...
  HW>=Hardware Type.
  List of possible hardware types:
    loop (Local Loopback) slip (Serial Line IP) cslip (VJ Serial Line IP)
    slip6 (6-bit Serial Line IP) cslip6 (VJ 6-bit Serial Line IP) adaptive (Adaptive Serial Line IP)
    strip (Metricom Starmode IP) ash (Ash) ether (Ethernet)
    tr (16/4 Mbps Token Ring) tr (16/4 Mbps Token Ring (New)) ax25 (AMPR AX.25)
    netrom (AMPR NET/ROM) rose (AMPR ROSE) tunnel (IPIP Tunnel)
    ppp (Point-to-Point Protocol) hdlc ((Cisco)-HDLC) lapb (LAPB)
    arcnet (ARCnet) dlci (Frame Relay DLCI) frad (Frame Relay Access Device)
    sit (IPv6-in-IPv4) fddi (Fiber Distributed Data Interface) hippi (HIPPI)
    irda (IrLAP) ec (Econet) x25 (generic X.25)
    infiniband (InfiniBand)
  AF>=Address family. Default: inet
  List of possible address families:
    unix (UNIX Domain) inet (DARPA Internet) inet6 (IPv6)
    ax25 (AMPR AX.25) netrom (AMPR NET/ROM) rose (AMPR ROSE)
    ipx (Novell IPX) ddp (Appletalk DDP) ec (Econet)
    ash (Ash) x25 (CCITT X.25)
希望上文可以幫助到大家,需要的用戶快來(lái)看看吧,想了解更多精彩教程請(qǐng)繼續(xù)關(guān)注腳本之家!

標(biāo)簽:武威 玉樹(shù) 克拉瑪依 棗莊 商丘 天水 石家莊 許昌

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Centos系統(tǒng)下查看和修改網(wǎng)卡Mac地址(附ifconfig命令格式)》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    商洛市| 宜章县| 文成县| 大荔县| 长治市| 武川县| 威远县| 郑州市| 惠东县| 沂南县| 资溪县| 崇明县| 沙田区| 平原县| 安溪县| 南丹县| 海林市| 城步| 沿河| 扬中市| 红原县| 达孜县| 台南市| 峨山| 佛学| 平利县| 澄江县| 色达县| 沾益县| 乌兰县| 牟定县| 漳州市| 黄浦区| 姚安县| 南阳市| 阳泉市| 含山县| 会理县| 宝坻区| 磴口县| 宣城市|