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
總結(jié)
以上為個人經(jīng)驗(yàn),希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
Centos7學(xué)習(xí)之添加用戶和用戶組的方法
本篇文章主要介紹了Centos7學(xué)習(xí)之添加用戶和用戶組的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-09-09淺談Linux下免密碼切換到root用戶當(dāng)注意的問題
下面小編就為大家?guī)硪黄獪\談Linux下免密碼切換到root用戶當(dāng)注意的問題。小編覺得挺不錯的?,F(xiàn)在就分享給大家。也給大家做個參考。一起跟隨小編過來看看吧2016-12-12淺談三種配置linux環(huán)境變量的方法(以java為例)
下面小編就為大家?guī)硪黄獪\談三種配置linux環(huán)境變量的方法(以java為例)。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-12-12