LinuxSir.cn,穿越时空的Linuxsir!

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

ifconfig不能把接口down掉,只有 ifup, ifdown 才行?

[复制链接]
发表于 2008-12-6 13:14:20 | 显示全部楼层 |阅读模式
[root@localhost ~]# ifconfig eth1 down
[root@localhost ~]#
[root@localhost ~]# ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 00:E0:4C:B2:20:60  
          inet addr:192.168.1.101  Bcast:192.168.1.255  Mask:255.255.255.0
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:1969 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2187 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1407415 (1.3 MiB)  TX bytes:416898 (407.1 KiB)
          Interrupt:177 Base address:0x4000

使用 ifconfig eth1 down 后为什么不能把接口给down掉?

而使用ifup和ifdown却没问题

[root@localhost ~]# ifdown eth1
[root@localhost ~]# ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 00:E0:4C:B2:20:60  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:1969 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2187 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1407415 (1.3 MiB)  TX bytes:416898 (407.1 KiB)
          Interrupt:177 Base address:0x4000

[root@localhost ~]# ifup eth1

正在决定 eth1 的 IP 信息...完成。
[root@localhost ~]#

我命令用错了吗???
发表于 2008-12-7 11:17:11 | 显示全部楼层
你的理解是不对的。

按我的理解,使用ifconfig  ... up|down和 ifup|ifdown 是不同形式的开启/关闭。
ifconifg ... down应该是只关闭驱动,不删除配置信息。
例如:

ifconfig eth1 down
这时你用ifconfig命令(不带任何参数),就不会列出eth1了。

如果想启动eth1:
ifup eth1
就会报错。
应该用ifconfig eth1 up来启动了。
回复 支持 反对

使用道具 举报

发表于 2008-12-7 13:06:36 | 显示全部楼层
恩,ifconfig ... up|down 命令使用后,会让这个网卡接口不能继续使用,但是不删除配置信息。
比如:ifconfig eth1 down
再使用 ifconfig 就不会显示出 eth1 这个接口。
回复 支持 反对

使用道具 举报

发表于 2008-12-7 13:47:52 | 显示全部楼层
down   This  flag causes the driver for this interface to be shut down.
up     This flag causes the interface to be activated.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-12-8 22:06:25 | 显示全部楼层
我好像还是没理解
我首先用 ifup eth1 这条命令把这个接口up一下,而且结果也成功了
那么这个时候,我的系统中肯定有这块网卡的驱动吧?
那么如果 ifconfig eth1 down 是删除驱动的话,应给就是把eth1的驱动给关闭了啊?
但是失败了

难道说如果由ifup命令执行的网卡只能有ifdown来关闭嘛?
另外,我的eth1是使用DHCP的,ifconfig eth1 down对DHCP的接口没有用

真的有点疑惑哦。。。
回复 支持 反对

使用道具 举报

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

本版积分规则

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