LinuxSir.cn,穿越时空的Linuxsir!

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

debian下修改了 IP怎么使其立即生效

[复制链接]
发表于 2005-10-29 23:59:26 | 显示全部楼层 |阅读模式
IP为手动指定,有时换了一个IP,发现必须重启一下才能生效,怎么使其立即生效呢?谢谢
(我是直接修改interfaces文件中的 IP配置)
发表于 2005-10-30 00:00:47 | 显示全部楼层
/etc/init.d/networking restart
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-10-30 00:16:21 | 显示全部楼层
谢谢,不知道还有没有其他的方法改动IP呢,望指教
回复 支持 反对

使用道具 举报

发表于 2005-10-30 16:06:42 | 显示全部楼层
ifconfig eth0 xxx.xxx.xxx.xxx up
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-10-30 17:50:51 | 显示全部楼层
Post by d00m3d
ifconfig eth0 xxx.xxx.xxx.xxx up



我试过类似的,只是没加后面的UP,发现这样把IP改了,但是子网掩码也跟着变成错误的了

还有这个命令输入之后是不是还要用一楼的方法来激活一次呢?
回复 支持 反对

使用道具 举报

发表于 2005-10-30 19:56:25 | 显示全部楼层
ifconfig eth0 down
ifconfig eth0 xxx.xxx.xxx.xxx  netmask xxx.xxx.xxx.xxx
route add default gw xxx.xxx.xxx.xxx
ifconfig eth0 up
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-10-30 22:39:07 | 显示全部楼层
Post by eTony
ifconfig eth0 down
ifconfig eth0 xxx.xxx.xxx.xxx  netmask xxx.xxx.xxx.xxx
route add default gw xxx.xxx.xxx.xxx
ifconfig eth0 up




弱弱的问一句:
route add default gw xxx.xxx.xxx.xxx
是设置什么的 ??
回复 支持 反对

使用道具 举报

发表于 2005-10-30 22:41:55 | 显示全部楼层
gw = gateway
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-10-30 23:05:35 | 显示全部楼层
Post by linuxcpp
gw = gateway


那上面那句就是设置网关了是吧
回复 支持 反对

使用道具 举报

发表于 2005-10-30 23:19:35 | 显示全部楼层
Correct.
回复 支持 反对

使用道具 举报

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

本版积分规则

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