ubuntu设置ip和dns


1. 配置ip
    ubuntu的网络配置信息放在 /etc/network/interfaces 中,
    
    如果配置动态获取ip,则在上述文件中加入以下内容:
    auto eth0
    iface eth0 inet dhcp
    
    如果配置静态ip,则添加如下内容:
    auto eth0
    iface eth0 inet static
    address 192.168.0.211
    netmask 255.255.255.0
    gateway 192.168.0.1

    需重启下网络服务
    sudo /etc/init.d/networking restart
    
二、配置dns服务器
    ubuntu 的dns服务器信息,放在 /etc/resolv.conf中,
    添加dns服务器地址,如192.168.0.1,则在上述文件中加入
        nameserver 192.168.0.1

    只要按上面的步骤配置完,就能上网了,如果还不行就重启下机器试试。

posted @ 2010-03-09 19:45  TermyZhang  阅读(275)  评论(0编辑  收藏  举报