您的位置:首页 > 其它

修改Ubuntu 静态ip

2013-08-23 07:47 281 查看
1、切换root身份:su root

2、编辑静态ip配置:vim /etc/network/interfaces 默认情况下,ubuntu的ip是动态ip,找到 ‘iface eth0 inet dhcp’并用#注释掉

3、编辑静态ip:

#加入 修改为静态ip

iface eth0 inet static

#要修改的ip

address 192.168.1.201

#修改网关

gateway 192.168.1.1

#修改子网掩码

netmask 255.255.255.0

4、保存退出.

5、重启网络生效:sudo /etc/init.d/networking restart

************************上面的仅仅在局域网内能用,要链接internet还要设置DNS服务器************************

1、修改 resolvconf服务的配置文件: /etc/resolvconf/resolv.conf.d/base :vim /etc/resolvconf/resolv.conf.d/base

2、加入:nameserver 【ip1】 换行 nameserver 【ip2】

3、重启网络生效:sudo /etc/init.d/networking restart

4、验证是否能链接internet:wget www.google.com
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: