什么是hosts


本文作者: jsweibo

本文链接: https://jsweibo.github.io/2020/06/27/%E4%BB%80%E4%B9%88%E6%98%AFhosts/

摘要

本文主要讲述了:

  1. 什么是 hosts
  2. 位置
  3. 备份

正文

什么是 hosts

一个将主机名称映射到对应 IP 的纯文本文件

位置

System Location
Windows 10 $Env:SystemRoot\System32\drivers\etc\
Android 10 /system/etc/

示例:

$Env:SystemRoot\System32\drivers\etc\hosts

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 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 host

# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost

示例:

/system/etc/hosts

1
2
127.0.0.1       localhost
::1 ip6-localhost

参考资料

本文作者: jsweibo

本文链接: https://jsweibo.github.io/2020/06/27/%E4%BB%80%E4%B9%88%E6%98%AFhosts/


本文对你有帮助?请支持我


支付宝
微信