MacOS 通过Terminal更改DNS

# 其实就是用到networksetup命令
# 设置DNS
sudo networksetup -setdnsservers <workservices> x.x.x.x
# 注:x.x.x.x就是要更改的DNS地址,可以加空格跟多个
#  <workservices>是要修改的网络接口,需要替换,不知道可以运行下列命令
networksetup -listallnetworkservices
# 查看当前设置的DNS
networksetup -getdnsservers <workservices>
# 清空当前DNS(自动获取)
sudo networksetup -setdnsservers <workservices> empty
# 顺便把几个DNS地址转了:
#
# Google DNS IPv4地址:
# 8.8.8.8 (google-public-dns-a.google.com)
# 8.8.4.4 (google-public-dns-b.google.com)
# Google DNS IPv6地址:
# 2001:4860:4860::8888
# 2001:4860:4860::8844
# OpenDNS IPv4地址:
# 208.67.222.222 (Resolver1.OpenDNS.com)
# 208.67.220.220 (Resolver2.OpenDNS.com)
# 208.67.222.220 (Resolver3.OpenDNS.com)
# 208.67.220.222 (Resolver4.OpenDNS.com)
# OpenDNS IPv6地址:
# 2620:0:ccc::2
# 2620:0:ccd::2
#

还没有评论,快来抢沙发!

发表评论

  • 😉
  • 😐
  • 😡
  • 😈
  • 🙂
  • 😯
  • 🙁
  • 🙄
  • 😛
  • 😳
  • 😮
  • emoji-mrgree
  • 😆
  • 💡
  • 😀
  • 👿
  • 😥
  • 😎
  • ➡
  • 😕
  • ❓
  • ❗
  • 83 queries in 0.385 seconds