Linux如何修改hosts文件并刷新DNS生效hosts文件
更新時間:2023年07月27日 09:01:19 作者:本本的香菜
這篇文章主要介紹了Linux如何修改hosts文件并刷新DNS生效hosts文件問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
Linux修改hosts文件并刷新DNS生效hosts文件
修改linux中hosts文件,加速github訪問下載:
1、修改hosts文件:/etc/hosts
[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緩存
[root@superroot mydock03]# /etc/init.d/network restart Restarting network (via systemctl): ? ? ? ? ? ? ? ? ? ? ? ?[ ?OK ?]
mac修改hosts刷新DNS使其立即生效
修改 hosts
sudo vi /etc/hosts
刷新DNS
sudo killall -HUP mDNSResponder
我的mac 系統(tǒng)版本 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
總結
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關文章
CentOS系統(tǒng)下快速獲取CPU核心數(shù)與內存大小的完整指南
在Linux服務器管理和性能優(yōu)化中,了解系統(tǒng)的硬件資源是至關重要的,本文將詳細介紹如何在CentOS系統(tǒng)中快速、準確地獲取CPU核心數(shù)和內存大小,感興趣的小伙伴可以了解下2025-07-07
Linux環(huán)境下生成openssl證書注意細節(jié)介紹
大家好,本篇文章主要講的是Linux環(huán)境下生成openssl證書注意細節(jié)介紹,感興趣的同學趕快來看一看吧,對你有幫助的話記得收藏一下,方便下次瀏覽2021-12-12

