Linux修改hosts文件并刷新DNS生效hosts文件
修改linux中hosts文件,加速github访问下载:
1、修改hosts文件:/etc/hosts
1 2 3 4 5 6 7 | [root@superroot mydock03] # vim /etc/hosts 127.0.0.1 ? localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 ? ? ? ? localhost localhost.localdomain localhost6 localhost6.localdomain6 # github 140.82.113.3?? ?http: //github .com 185.199.108.153?? ?http: //assets-cdn .github.com 199.232.69.194?? ?http: //github .global.ssl.fastly.net |
2、刷新DNS缓存
1 2 | [root@superroot mydock03] # /etc/init.d/network restart Restarting network (via systemctl): [ OK ] |
mac修改hosts刷新DNS使其立即生效
修改 hosts
1 | sudo vi /etc/hosts |
刷新DNS
1 | sudo killall -HUP mDNSResponder |
我的mac 系统版本 12.2.1
各版本命令仅供参考
- Mac OS X 10.7 – 10.8:sudo killall -HUP mDNSResponder
- Mac OS X 10.5 – 10.6:dscacheutil -flushcache
- Mac OS X 10.4:lookupd -flushcache
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持IT俱乐部。