免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1759 | 回复: 0
打印 上一主题 下一主题

ubuntu server 设置静态ip . [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-11-17 15:02 |只看该作者 |倒序浏览
ubuntu server 设置静态ip .






修改这个网络配置文件,默认一般是自动获得ip的。

sudo vi /etc/network/interfaces

文件内容:
  1. view plaincopy to clipboardprint?
  2. 01.auto lo  
  3. 02.iface lo inet loopback  
  4. 03.  
  5. 04.mapping hotplug  
  6. 05.script grep  
  7. 06.map eth0  
  8. 07.  
  9. 08.auto eth0  
  10. 09.iface eth0 inet static  
  11. 10.address 192.168.1.101  
  12. 11.netmask 255.255.255.0  
  13. 12.network 192.168.1.0  
  14. 13.broadcast 192.168.1.255  
  15. 14.gateway 192.168.1.1  
  16. auto lo
  17. iface lo inet loopback

  18. mapping hotplug
  19. script grep
  20. map eth0

  21. auto eth0
  22. iface eth0 inet static
  23. address 192.168.1.101
  24. netmask 255.255.255.0
  25. network 192.168.1.0
  26. broadcast 192.168.1.255
  27. gateway 192.168.1.1
复制代码
如果还要上网的话,要修改dns文件:

sudo vi /etc/resolv.conf


文件内容:
  1. view plaincopy to clipboardprint?
  2. 01.nameserver 192.168.1.1              <-------------这行是新增的  
  3. 02.nameserver xxx.xx.xx.xxx                <-------------这行是原来的dns服务器  
  4. nameserver 192.168.1.1              <-------------这行是新增的
  5. nameserver xxx.xx.xx.xxx                <-------------这行是原来的dns服务器
复制代码
重启网络模块:

sudo /etc/init.d/networking restart




ok,现在应该可以正常使用设定的ip地址了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP