Skip to content

Instantly share code, notes, and snippets.

@WymanY
Last active April 28, 2021 15:15
Show Gist options
  • Save WymanY/d007bbcdd28a6536dba280fcf19a3115 to your computer and use it in GitHub Desktop.
Save WymanY/d007bbcdd28a6536dba280fcf19a3115 to your computer and use it in GitHub Desktop.
[mac dns]dns 设置相关 #dns
#查看所有的 网络端口
networksetup -listallnetworkservices
#设置dns 的相关文档
https://superuser.com/questions/86184/change-dns-server-from-terminal-or-script-on-mac-os-x
#将DNS置为空
sudo networksetup -setdnsservers "Apple USB Ethernet Adapter" empty
#修改完DNS 后清除缓存
sudo killall -HUP mDNSResponder
#https://superuser.com/questions/1035461/setting-proxy-settings-to-auto-proxy-detection-using-the-command-line-in-macos
#mac 清除掉设置自动发现网络代理
networksetup -setproxyautodiscovery Wi-Fi off
networksetup -setproxyautodiscovery Ethernet on
#mac 命令行设置代理。
#https://gist.github.com/jordelver/3073101
#https://superuser.com/questions/316502/how-to-change-proxy-setting-using-command-line-in-mac-os
networksetup -setwebproxy "Wi-fi" 127.0.0.1 8080
#查看当前的位置
curl https://ifconfig.co/country
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment