西木-Lee

 

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貌似需要指定顺序 nameserver
114.114.114.114 nameserver 8.8.8.8

 

posted on 2019-10-25 15:28  西木-Lee  阅读(148)  评论(0编辑  收藏  举报

导航