专注于网站技术与网络营销的博客

赞助商链接

« 光线吞华友 发力最大娱乐传媒电子书的新盈利模式 »

在Ubuntu Linux中设置静态IP

         Ubuntu的7.10版发布之后,安装上了,对于我来说与Ubuntu打交道最多的还是Server版,设置这些都是在没有图形界面下完成.

Ubuntu的网络配置信息是保存在 /etc/network/interfaces 文件中,使用Vim打开配置文件,默认是自动获取IP的配置.如下:

# The primary network interface
auto eth0
iface eth0 inet dhcp

下面我们将其设置成静态IP.

第一步:屏蔽掉自动获取IP的设置
iface eth0 inet dhcp将这一行屏蔽掉
修改之后的内容如下:
# The primary network interface
auto eth0
#iface eth0 inet dhcp

第二步:添加静态IP的信息
# The primary network interface
iface eth0 inet static
address 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.1

第三步:设置DNS
编辑 /etc/resolv.conf,设置dns
nameserver 202.96.134.133
nameserver 202.106.0.20

重启网络:/etc/init.d/networking restart
以上步骤完成之后只要重新启用一下网络就OK了.

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Powered By Z-Blog 1.8 Spirit Build 80710

Copyright 2005 - 2008, 完美生活(专注于网站技术与网络营销的博客). Some Rights Reserved.