修改 hosts
2024-10-20 16:13:53
不会牛逼操作
-1. 位置、格式
所有系统都差不多,都是 啥啥/etc/hosts
这样的 .
具体去查即可 .
格式:
ip + 域名
域名不能含有通配符
hosts 可以绕过 dns 解析,直接访问 cdn 节点
0. 注释
#
后面的一行都是注释,有点像 Python .
或许注释只能放在每行开头?存疑
没有多行注释
1. 禁止访问
127.0.0.1 + 网址
或者 0.0.0.0 + 网址
.
可以防颓
2. 加速访问
首先搞到你要加速的网站的 ip 地址(可以 ipaddress),然后
ip + 域名
即可 .
3. 刷新
注意做完操作时候还要刷新网络:
- Windows:
ipconfig /flushdns
- Linux:
sudo /etc/init.d/networking restart
注意项总结
- 域名不能含有通配符
- 注释只能单行写
- 操作完刷新网络
- 如果有用杀毒软件的话杀软可能会只读
hosts
文件,把杀软关了就好了 .
附录 - Windows 下的 hosts
最后附一个 Windows 的初始 hosts
文件
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client hiost
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
妈呀全是注释
最新文章
- Greenplum 源码安装教程 —— 以 CentOS 平台为例
- ireport5.6+jasperreport6.3开发(四)--以javabean为基准的报表开发(ireport)
- Html/Css(新手入门第二篇)
- sql compact 使用EF无法更新的问题?
- html下select追加元素,IE下错误
- Keepass 2.x 的一些新发现
- 虚拟机 Linux 系统增加换页空间
- Learning Lua Programming (3) iMac下搭建Lua脚本最好的编码环境(代码补全,编译运行)
- android开发注意点
- int *p[4]与int (*q)[4]的区别
- J.U.C JMM. pipeline.指令重排序,happen-before
- struts文件异常Included file cannot be found
- 在思科路由器上配置AAA实验(Cisco PT)
- C#操作DbConnection类
- Linux的cron与%
- bash shell 编程练习
- DBeaver连接Oracle11g数据库
- Cocos2d-x学习笔记(二)AppDelegate类详解
- C#默认以管理员身份运行程序实现代码
- adb(Android Debug Bridge)(一)
热门文章
- js运算符、 流程控制 、函数、内置对象、BOM与DOM操作
- Springmvc基础及应用
- Nanodet模型部署(ncnn,openvino)/YOLOX部署(TensorRT)
- 从零开始学YC-Framework之鉴权
- sklearn练习1 回归
- ExtJS 布局-Border 布局(Border layout)
- 第三章、DNS域名解析服务
- 静态代理、动态代理与Mybatis的理解
- Spring Data JPA系列2:SpringBoot集成JPA详细教程,快速在项目中熟练使用JPA
- Vue.js CLI4 Vue.config.js标准配置 (最全注释)