ubuntu/centos设置IP/DNS

  •  Ubuntu设置IP/DNS

 编辑  /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback


#ipv4

auto eth0
iface eth0 inet static
address 10.139.60.87
netmask 255.255.255.0
gateway 10.139.60.1
dns-nameservers 10.1.8.171
dns-nameservers 114.114.114.114 
dns-nameservers 10.138.60.47 

重启网络(有时需要重启电脑reboot)

/etc/init.d/networking restart
  •  Centos 设置DNS
编辑 /etc/resolv.conf 

# 添加或修改nameserver即可
nameserver 114.114.114.114
nameserver 8.8.8.8
原文地址:https://www.cnblogs.com/lixyu/p/11738283.html