Ubuntu Server 16.04修改IP、DNS、hosts
来源:互联网 发布:嘉兴行知小学入学条件 编辑:程序博客网 时间:2024/06/05 03:25
转自:http://www.cnblogs.com/pcat/p/6098157.html
1. Ubuntu Server 16.04修改IP
sudo vi /etc/network/interfaces
回显:
# The loopback network interfaceauto loiface lo inet loopback# The primary network interfaceauto eth0iface eth0 inet static address 192.168.0.88 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.1 # dns-* options are implemented by the resolvconf package, if instatlled dns-nameservers 192.168.0.1 dns-search pcat
把address后的ip修改为自己想设定的ip后,保存退出。
之后,重启网络:
sudo /etc/init.d/networking restart
ps,ubuntu还有别的重启方式(但不一定有效)
sudo service network restart
desktop版可以这样重启:
sudo service network-manager restart
如果只是修改了某个网卡(例如eth0)的信息,也可以通过重启网卡的方式使其修改生效。
sudo ifdown eth0sudo ifup eth0
最后,我在自己机子上试了重启网络或者网卡后,ifconfig里显示的还是旧ip,而且新旧两个ip都可以ping通,只有重启机子后才会显示新的ip。
2. Ubuntu Server 16.04修改DNS
sudo vi /etc/resolvconf/resolv.conf.d/base
修改内容:
search localdomain #如果本Server为DNS服务器,可以加上这一句,如果不是,可以不加nameserver 8.8.8.8 #希望修改成的DNSnameserver 114.114.114.114 #希望修改成的DNS
保存退出,重启网络:
sudo /etc/init.d/networking restart
查看当前DNS:
cat /etc/resolv.conf
3. Ubuntu Server 16.04修改hosts
查看hostname:
cat /etc/hostname
记住其hostname,修改hosts:
sudo vi /etc/hosts
前两行修改为:
#第1行默认这个
127.0.0.1 localhost#第2行为你修改的ip 你刚才查看的hostname192.168.11.52 pcat
保存退出。
阅读全文
0 0
- Ubuntu Server 16.04修改IP、DNS、hosts
- Ubuntu Server修改IP/DNS
- ubuntu server修改IP和DNS
- 简述Ubuntu Server修改IP/DNS
- 简述Ubuntu Server修改IP/DNS
- Ubuntu 修改IP MAC DNS
- ubuntu修改IP MAC DNS
- linux IP的设置 修改DNS 解析 hosts生效
- ubuntu修改静态IP、设置dns地址
- ubuntu server IP 及DNS设置
- ubuntu server 12.04固定ip、dns
- ubuntu-server-12.04.2配置IP、DNS
- Ubuntu Server设置IP地址、网关、DNS
- ubuntu server IP 及DNS设置
- ubuntu server IP 及DNS设置
- Ubuntu Server 14.04 配置固定IP、DNS
- Ubuntu 修改hosts
- ubuntu修改hosts文件
- Android性能优化之利用LeakCanary检测内存泄漏及解决办法
- tp5中使用原生sql查询总结
- React Intl多国语言运行详解
- CSS-品字布局
- House Robber
- Ubuntu Server 16.04修改IP、DNS、hosts
- 简单的C#爬虫
- 记录一下
- 好资源需要免费分享
- typeof
- 全方位绕过软WAF攻略
- 第一次做项目的小心得
- 让maven使用国内镜像和archetypeCatalog
- spring bean的声明周期