- A+
所属分类:未分类
黑五期间购买了一台机器,使用的非常好,就是遇到一个问题,就是过一段时间老是IP不通,后来咨询后才知道说是什么:Our DHCP server assign IP address based on MAC address.Please configure IP address statically.#也就是需要自己配置静态地址,
配置文件:/etc/network/interfacer
# 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 eth0 iface eth0 inet static address x.x.114.106 # network x.x.114.96 # netmask 255.255.255.224 # gateway x.x.114.97 # dns-nameservers 8.8.8.8 8.8.4.4 114.114.114.114 iface eth0 inet6 static pre-up modprobe ipv6 address x:x:8000:12::2 # netmask 64 # gateway x:x:8000:12::1 # dns-nameservers 2001:4860:4860::8888 2001:4860:4860::8844
上边带#的ipv4或者ipv6服务商都会提供给你,添加进去就可以了
service networking restart
设置DNS
linux系统的DNS信息是保存在/etc/resolv.conf , 但是在ubuntu中用vim打开这个文件你会发现有如下文字的提示
DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTEN
所以不能直接个性这个文件,这个内容可能会被覆盖
在ubuntu中dns信息是放在/etc/resolvconf/resolv.conf.d/目录下
一般情况下这个目录下有base和head两个文件夹
vim /etc/resolvconf/resolv.conf.d/base
nameserver 8.8.8.8
nameserver 8.8.4.4nameserver 114.114.114.114
保存后执行
resolvconf -u
用以下命令使网络设置生效
service networking restart
sudo /etc/init.d/networking restart

我的QQ群
这是我的QQ群扫一扫