首页 > 其他 > 详细

unbuntu14.04 server修改静态IP

时间:2015-04-03 11:41:27      阅读:175      评论:0      收藏:0      [点我收藏+]

1. 找到文件并作如下修改:

vim /etc/network/interfaces

修改如下部分:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto p2p1
iface p2p1 inet static
address 192.168.1.244
gateway 192.168.1.1
netmask 255.255.255.0

2. 修改dns解析

因为以前是dhcp解析,所以会自动分配dns服务器地址

而一旦设置为静态ip后就没有自动获取到的dns服务器了

要自己设置一个

vim /etc/resolv.conf
nameserver 202.96.128.86
nameserver 192.168.1.1
nameserver 220.170.64.68

3.改完上面,如果重启的话,还是会变为原来的样子,所以要让其永久改变,因此,执行:

 vim /etc/resolvconf/resolv.conf.d/base
 
 nameserver 192.168.1.1
 nameserver 220.170.64.68

3. 重启网卡:

/etc/init.d/networking restart

如有问题,可以随时提问。

unbuntu14.04 server修改静态IP

原文:http://my.oschina.net/ydsakyclguozi/blog/395528

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!