LinuxSir.cn,穿越时空的Linuxsir!

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

如何设置静态ip?

[复制链接]
发表于 2006-3-6 16:53:46 | 显示全部楼层 |阅读模式
我把etc/network/interfaces 修改了,但是不行
iface eth0 inet static
       address 192.168.2.3
       netmask 255.255.255.0
       broadcast 255.255.255.255
       gateway 192.168.2.25

我记得以前可以用明令改的~,想不起来了,安装的时候检测到DHCP就不给我机会配置了:beat
发表于 2006-3-6 19:40:46 | 显示全部楼层
Post by dajun
我把etc/network/interfaces 修改了,但是不行
iface eth0 inet static
       address 192.168.2.3
       netmask 255.255.255.0
       broadcast 255.255.255.255
       gateway 192.168.2.25

我记得以前可以用明令改的~,想不起来了,安装的时候检测到DHCP就不给我机会配置了:beat


根据你的情况应该在/etc/network/interfaces中这样写:
auto eth0
iface eth0 inet static
address 192.168.2.3
netmask 255.255.255.0
gateway 192.168.2.25

如果是手动调整的话就这样:
#ifconfig eth0 down
#ifconfig eth0 192.168.2.3
#ifconfig eht0 up
#route add default gw 192.168.2.25

就可以了。
回复 支持 反对

使用道具 举报

发表于 2006-3-6 19:53:54 | 显示全部楼层
Post by sspook
根据你的情况应该在/etc/network/interfaces中这样写:
auto eth0
iface eth0 inet static
address 192.168.2.3
netmask 255.255.255.0
gateway 192.168.2.25

如果是手动调整的话就这样:
#ifconfig eth0 down
#ifconfig eth0 192.168.2.3
#ifconfig [color="Red"]eht0 up
#route add default gw 192.168.2.25

就可以了。
打错字了。。。

其实一次性 ifconfig eth0 192.168.2.3 up 就可以,不用分两行
回复 支持 反对

使用道具 举报

发表于 2006-3-6 22:27:12 | 显示全部楼层
既然配置文件已经写好了

#ifconfig eth0 up

#/etc/init.d/networking restart

应该都可以吧
回复 支持 反对

使用道具 举报

发表于 2006-3-6 22:37:41 | 显示全部楼层
Post by dajun
我把etc/network/interfaces 修改了,但是不行
iface eth0 inet static
       address 192.168.2.3
       netmask 255.255.255.0
       broadcast 255.255.255.255
       gateway 192.168.2.25

我记得以前可以用明令改的~,想不起来了,安装的时候检测到DHCP就不给我机会配置了:beat


broadcast 192.168.2.255

然后/etc/init.d/network restart
或者
ifdown eth0;ifup eth0
就可以了。
回复 支持 反对

使用道具 举报

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

本版积分规则

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