LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1847|回复: 10

请问如何在Linux中修改网卡MAC地址?

[复制链接]
发表于 2005-10-3 23:28:22 | 显示全部楼层 |阅读模式
如题

今天安装了SUSE9.3,但是因为学校上网是IP捆绑MAC的,自己的机器不是申请IP时候的那个MAC了,不知道在Linux下是怎么修改MAC地址的?
还请各位指点!
多谢!
发表于 2005-10-4 02:09:18 | 显示全部楼层
Under Linux, the MAC address of a Network Interface Card (NIC) can be changed by doing the following: (You must be root in order for this to work)

    /etc/init.d/networking stop
    ifconfig eth0 hw ether 00:01:02:03:04:08
    /etc/init.d/networking start

That's all there is to it.

In Redhat and other similar systems (Fedora, etc) an easy way to make it "permanent" across reboots is to just add a variable like this to your ifcfg-eth0 or similar file:

    MACADDR=12:34:56:78:90:ab

(upper or lower case on the MAC address are fine, because the network function does a "toupper" on it)

and service network restart for prompt results.
回复 支持 反对

使用道具 举报

发表于 2005-10-4 14:49:12 | 显示全部楼层
基本上都是先这样先改变MAC地址
ifconfig eth0 down
  ifconfig eth0 hw ether 11:11:11:11:11:11
  ifconfig eth0 up
然后再次执行网络部分的初始化代码
红帽子是这样/etc/init.d/network  start
这一步其它发行版不太一样
回复 支持 反对

使用道具 举报

发表于 2005-10-4 15:13:11 | 显示全部楼层
通过ifconfig指令
可以看看man设置的非常详细
回复 支持 反对

使用道具 举报

发表于 2005-10-4 15:48:31 | 显示全部楼层
我在想,如果设定mac和别人的mac一样的时候会怎样???
回复 支持 反对

使用道具 举报

发表于 2005-10-4 21:56:12 | 显示全部楼层
Post by daha

红帽子是这样/etc/init.d/network  start
这一步其它发行版不太一样

红帽子是这样吗
FC4是这样的吧
像二楼说的在FC4中是
/etc/init.d/networking stop
ifconfig eth0 hw ether 00:01:02:03:04:08
/etc/init.d/networking start

不过networking要改为network
红帽中可以在在/etc/sysconfig/nework-scripts/ifcfg-ethx文件中加入如下代码:
MACADDR=00:11:33:44:55#(your modified macaddress)
用service network restart即可
回复 支持 反对

使用道具 举报

发表于 2005-10-4 22:02:05 | 显示全部楼层
Post by wenwst
我在想,如果设定mac和别人的mac一样的时候会怎样???

在网络一般是以ip来作为标识的,所以mac相同并不会有问题。但是,如果碰到有些防火墙、路由器、三层交换机等等,可以设置检测mac地址的,那么相同的mac地址可能会有问题,但要看具体情况而定。建议到安全版或网络版去看看。
回复 支持 反对

使用道具 举报

发表于 2005-10-4 23:01:13 | 显示全部楼层
哦,知道了
还有一个问题,我的学校的校园网的帐号个mac是绑定的,如果我把我的 mac 修改的和别人的mac一样,那么我是不是可以用别人的号上网?
回复 支持 反对

使用道具 举报

发表于 2005-10-5 08:37:59 | 显示全部楼层
我们这里用的是锐捷的客户端,也是绑定MAC的,
我以前在RedHat 9里时,试过了,可以改了室友的MAC然后用室友的号上网
我在FC4里改了MAC,可以认证,认证成功.但是不可以上网,上网打不开网页
正想请教这个问题呢
请大侠们指教了
回复 支持 反对

使用道具 举报

发表于 2005-10-5 15:49:36 | 显示全部楼层
但是如果现在我用了宿舍别人的mac时,我可以同时和别人一起上网嗎?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表