标签:
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
如有问题,可以随时提问。
标签:
原文地址:http://my.oschina.net/ydsakyclguozi/blog/395528