ubuntu shell下设置网卡ip地址,网关,dns的方法

一般ubuntu server在安装的时候,都会在ui中让你输入vip地址和网关dns等信息。

一般搬迁服务器的时候,都会重新配置服务器的ip信息。那么,在shell下怎么修改呢。今天,正好给宠物导航搬迁服务器,顺便整理记录一下。

打开/etc/network/interfaces,如果没有配置过ip,比如安装过程中跳过,则会看到

auth lo
iface lo inet loopback

如果,已经配置过,会看到类似如下的eth0 或 eth1配置

#from iu1u.com
auth eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.254
dns-nameservers 202.106.0.20

修改其中的信息为自己的,修改dns还要同时修改/etc/resolv.conf文件里面的dns地址。

然后重启机器,或者执行命令sudo /etc/init.d/networking restart,刷新网络接口信息即可。

Posted in 未分类 at 04月 27th, 2009. Trackback URI: trackback
Tags: ,

One Response to “ubuntu shell下设置网卡ip地址,网关,dns的方法”

  1. 07月 12th, 2009 at 07:43 #99读书人

    您好,想与贵博客建立友情链接。
    贵博客的链接已做好,希望能通过您的审核!
    网站名称:99读书人
    网站地址:www.zan01.cn/

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
请输入图片中的字符以验证你并非垃圾机器人. 点击图片收听验证码的语音版.
点击这里收听此验证码的语音版本