亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
123下一頁
最近訪問板塊 發(fā)新帖
查看: 9041 | 回復(fù): 27
打印 上一主題 下一主題

如何修改mac地址讓它一直生效? [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2006-05-30 09:47 |只看該作者 |倒序瀏覽
在論壇上看到大家關(guān)于如何修改mac地址:
sbin/ifconfig eth0 down
sbin/ifconfig eth0 hw ether 00 11 22 33 44 55
sbin/ifconfig eth0 up
通過ifconfig可以看到修改已經(jīng)生效,可是重啟機(jī)器后又恢復(fù)成了原來得mac.
不知道大家有什么好的方法?

論壇徽章:
0
2 [報告]
發(fā)表于 2006-05-30 10:32 |只看該作者
寫個 script,在開機(jī)后自動初始化一些你想要開機(jī)后自動完成的東西
參考 /etc/rc.local

論壇徽章:
0
3 [報告]
發(fā)表于 2006-05-30 10:56 |只看該作者
rc.local中是否可以調(diào)整其先后順序讓mac執(zhí)行于應(yīng)用程序之前?

論壇徽章:
0
4 [報告]
發(fā)表于 2006-05-30 11:14 |只看該作者
可以,修改 /etc/rc.sysinit 即可,把你想要的東西插到里面

論壇徽章:
0
5 [報告]
發(fā)表于 2006-05-30 13:29 |只看該作者
原帖由 sunmoonsea 于 2006-5-30 09:47 發(fā)表
在論壇上看到大家關(guān)于如何修改mac地址:
sbin/ifconfig eth0 down
sbin/ifconfig eth0 hw ether 00 11 22 33 44 55
sbin/ifconfig eth0 up
通過ifconfig可以看到修改已經(jīng)生效,可是重啟機(jī)器后又恢復(fù)成了原來得m ...


若是你是使用 RHEL 這類版本的話,請考慮先看一下 /etc/sysconfig/network-scripts/ifup 看一下:


  1. # this isn't the same as the MAC in the configuration filename.  It is
  2. # available as a configuration option in the config file, forcing the kernel
  3. # to think an ethernet card has a different MAC address than it really has.
  4. if [ -n "${MACADDR}" ]; then
  5.    ip link set dev ${DEVICE} address ${MACADDR}
  6. fi
  7. if [ -n "${MTU}" ]; then
  8.    ip link set dev ${DEVICE} mtu ${MTU}
  9. fi
復(fù)制代碼


可以發(fā)現(xiàn)到目前都是流行使用 ip 程式,已經(jīng)逐漸不使用 ifconfig 程式了。

而你網(wǎng)路卡配置 /etc/sysconfig/network-scripts/ifcfg-eth0 應(yīng)該就會使用像是:


  1. DEVICE=eth0
  2. IPADDR=192.168.1.1
  3. NETMASK=255.255.255.0
  4. MACADDR=00:11:22:33:44:55
復(fù)制代碼


其中 MACADDR 應(yīng)該就是你預(yù)期要改的的項目。把預(yù)期的網(wǎng)路卡卡號放進(jìn)去就可以。

改好執(zhí)行 /etc/init.d/network stop ; /etc/init.d/network start

若是您是使用 SUSE Linux 的話,SuSE 本身就已經(jīng)給您一個很明確清楚的樣板檔案,檔案名稱為 /etc/sysconfig/network/ifcfg.template,該檔案里面有提到配置說明。

比方你目前使用中的網(wǎng)路卡的 mac addr 是  00:11:22:33:44:55,那您的系統(tǒng)應(yīng)該就會有 /etc/sysconfig/network/ifcfg-eth-id-00:11:22:33:44:55 檔案,該檔案內(nèi)容會像是:


  1. IPADDR=192.168.1.1
  2. NETMASK=255.255.255.0
復(fù)制代碼


你要換網(wǎng)路卡卡號的話,就是多 LLADDR 該敘述。

  1. IPADDR=192.168.1.1
  2. NETMASK=255.255.255.0
  3. LLADDR=00:48:54:11:22:33
復(fù)制代碼


改好后執(zhí)行 rcnetwork stop ; rcnetwork start 應(yīng)該就可以了 (用 ifup/ifdown 也可以)。

另外補(bǔ)充的是,使用 ip 程式配置網(wǎng)路介面 mac 組態(tài)的話,該配置設(shè)定實際底層會是:

  1. ip link set eth0 address 00:48:54:11:22:33
復(fù)制代碼


提供給你參考。

==

論壇徽章:
0
6 [報告]
發(fā)表于 2006-05-30 14:19 |只看該作者
頂一下,很專業(yè)

論壇徽章:
0
7 [報告]
發(fā)表于 2006-05-30 15:43 |只看該作者
# remap, if the device is bound with a MAC address and not the right device num
# bail out, if the MAC does not fit
if [ -n "${HWADDR}" ]; then
    FOUNDMACADDR=`get_hwaddr ${REALDEVICE}`
    if [ "${FOUNDMACADDR}" != "${HWADDR}" ]; then
        curdev=`ip -o link | awk -F ':' -vIGNORECASE=1 '/$HWADDR/ { print $2 }'`        rename_device "${REALDEVICE}" "${HWADDR}" "${curdev}" || {
            echo $"Device ${DEVICE} has different MAC address than expected, ignoring."
            exit 1
        }
    fi
[root@mail1 network-scripts]# service network restart
Shutting down interface eth0:  Device eth0 has different MAC address than expected, ignoring.
                                                           [FAILED]
Shutting down interface eth1:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Setting network parameters:                                [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:                                [  OK  ]
Bringing up interface eth1:                                [  OK  ]

論壇徽章:
0
8 [報告]
發(fā)表于 2006-05-30 15:53 |只看該作者
To platinum :按照你說得,將腳本插入到/etc/rc.d/rc.sysinit中后,重啟后腳本自動執(zhí)行,mac實現(xiàn)了自動修改.
To kenduest  : 我按照你說得方法在/etc/sysconfig/network-scripts/腳本中更改了mac,重啟network服務(wù)后生效了,可是reboot后網(wǎng)卡依然是原來得mac.
我直接使用ip程式進(jìn)行mac得修改,效果還是一樣.


剛才看kenduest說得ifup腳本中有一段關(guān)于腳本系統(tǒng)時與realdevice得mac得比較,讓我覺得如果在這里是不是可以做一下修改.

每次重啟時,系統(tǒng)在讀mac得時候并不是取得etc/sysconfig/network-scripts/ifcfg-eth0腳本中得mac地址

[ 本帖最后由 sunmoonsea 于 2006-5-30 15:56 編輯 ]

論壇徽章:
0
9 [報告]
發(fā)表于 2006-05-30 16:14 |只看該作者
1. 請貼出你的 ifcfg-eth0 檔案設(shè)定

2. 請貼出 ifconfig eth0 顯示結(jié)果

==

論壇徽章:
0
10 [報告]
發(fā)表于 2006-05-30 16:34 |只看該作者
[root@mail1 network-scripts]# more ifcfg-eth0
# Advanced Micro Devices [AMD]|79c970 [PCnet32 LANCE]
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.16.4
NETMASK=255.255.255.0
GATEWAY=192.168.16.1
HWADDR=00:11:22:33:44:55
[root@mail1 network-scripts]#
[root@mail1 network-scripts]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:0C:29:3D:E2:28
          inet addr:192.168.16.4  Bcast:192.168.16.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1176 errors:0 dropped:0 overruns:0 frame:0
          TX packets:142 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:243888 (238.1 Kb)  TX bytes:17065 (16.6 Kb)
          Interrupt:10 Base address:0x1400

我想將mac改成:00:11:22:33:44:55,使用命令修改后,重啟后有變回了原來得mac,計算機(jī)啟動時,是從哪里讀取得mac地址哪?

[ 本帖最后由 sunmoonsea 于 2006-5-30 16:44 編輯 ]
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP