[Ubuntu] 如何设置静态 IP 和 DNS
编辑 /etc/network/interfaces 来设置 IP 和 DNS 解析服务器:
# interfaces() file used by ifup() and ifdown()
auto lo
iface lo inet loopback auto eth0
iface eth0 inet static
address 192.168.1.6
gateway 192.168.1.1
netmask 255.255.255.0
dns-nameservers 192.168.1.1
#network 192.168.1.0
#broadcast 192.168.1.255
多个 DNS 解析服务器之间使用空格分隔:
dns-nameservers 192.168.1.1 8.8.8.8
使修改立即生效:
sudo ifdown eth0 && sudo ifup eth0
若未能即时生效,可尝试将 /etc/resolv.conf 设置为 /run/resolvconf/resolv.conf 的软连接:
ln -s /run/resolvconf/resolv.conf /etc/resolv.conf
如果只是临时更改 DNS 服务器,编辑 /etc/resolv.conf,添加以下内容:
nameserver 8.8.8.8
resolv.conf 是个动态文件,每次开机会被重新覆盖,因此要添加永久性DNS,采用第一种方式为佳,第一种方式每次开机后会将 dns-nameservers 值写入 resolv.conf 文件中。
[Ubuntu] 如何设置静态 IP 和 DNS的更多相关文章
- Ubuntu中设置静态IP和DNS
在Ubuntu中设置静态IP共两步:1>设置IP:2>设置DNS1>设置IP 编辑 /etc/network/interface文件: sudo vi /etc/n ...
- Ubuntu中设置静态IP和DNS(转载)
原文地址:http://blog.sina.com.cn/s/blog_669421480102v3bb.html VMware 中使用网络,对虚拟机设置静态IP:在Ubuntu中设置静态IP共两步: ...
- CentOS7修改设置静态IP和DNS
当前位置: 主页 > CentOS入门 > 系统配置 > CentOS7修改设置静态IP和DNS 时间:2016-02-22 00:55来源:blog.csdn.net 作者:get ...
- CentOS7 修改设置静态IP和DNS
最近因为学习Puppet,用虚拟机装了个CentOS,使用的NAT的网络模式,为了防止再次启动系统的时候网络IP发生变化,因此设置静态IP和DNS. 由于CentOS是最小化安装,没有ifconfig ...
- linux设置静态IP和DNS以及改网卡名
ubuntu Ubuntu如果是desktop版,由于desktop版安装了NetworkManager,修改完interfaces文档中的内容,不会生效,需要先修改/etc/NetworkManag ...
- 【Ubuntu】设置静态ip地址
一.Ubuntu16.04设置静态IP1.获取网卡的名字 ip route show 2.获取网卡的名字 vim /etc/network/interfaces auto ens33 iface ...
- Ubuntu18.10设置静态IP、DNS、卸载无用软件
设置静态IP root@xueji:~# vim /etc/network/interfaces # interfaces() ) and ifdown() auto lo iface lo inet ...
- ubuntu下设置静态ip
直接修改系统配置文件ubuntu的网络配置文件是:/etc/network/interfacesubuntu命令行修改网络配置方法前面auto eth?,让网卡开机自动挂载. 为网卡配置静态IP地址 ...
- Centos6.2设置静态ip和dns
参考了如下文章:https://gist.github.com/fernandoaleman/2172388http://www.lifelinux.com/how-to-configure-stat ...
随机推荐
- mock数据和代码生成
git clone https://gitee.com/fleam/CodeGeneration.git
- QMDP-Net: Deep Learning for Planning under Partial Observability
一篇用deep neural network做POMDP的论文
- Python之从numpy.array保存图片
1.用scipy import scipy scipy.misc.imsave('test.jpg', img) 2.用PIL from PIL import Image im = Image.fro ...
- [转]jQuery选择器 (详解)
1).基本 #id 根据给定的ID匹配一个元素.例如:$("#id")element 根据给定的元素名匹配所有元素.例如:$("div").class 根据给定 ...
- e566. 关闭的时候关闭程序
By default, when the close button on a frame is clicked, nothing happens. This example shows how to ...
- asp 读文件 比较ip
<% Dim UserIPAddress Set UserIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR" ...
- SciTE配置信息
超强文本编辑器SciTE配置方法详细实例 转载 2006年12月28日 17:07:00 标签: 文本编辑 / 文档 / 语言 / html / python / api 32800 关于scite文 ...
- Python内部机制。
type ,object ,__class__ ,__bases__ ,__metaclass__ , -------------------------不明白的地方----------------- ...
- 【阿里云】WindowsServer2012 搭建FTP站点 图文记录
配置说明: 服务商:阿里云 系统: WindowsServer2012 一:配置FTP服务器 1.进入操作系统,直接从启动栏打开服务器管理器,选择添加功能和角色 2.选择服务器 3.勾选FTP服务器选 ...
- SpringCloud 集锦
一.SpringCloud和Dubbo SpringCloud整合了一套较为完整的微服务解决方案框架,而Dubbo只是解决了微服务的几个方面的问题. content Dubbo SpringCloud ...