Windows:域名文件和域名缓存刷新

发布时间 2023-12-21 16:46:24作者: eiSouthBoy

域名文件

文件的路径:C:\Windows\System32\drivers\etc\hosts,可以根据需要在此文件中手动添加静态域名和IP的映射关系

# 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


域名缓存刷新

由于历史访问过的域名对应的ip会被保存缓存中,下一次访问相同的域名直接从缓存中获取对应的ip,这样可以较快访问速度。但域名和ip的映射关系改变了,客户端通过之前的ip访问出错,这时候需要刷新缓存,重新获取域名对应的相关信息。

多重dns缓存的优先级别:浏览器缓存 > 操作系统缓存 > 网关设备缓存 > DNS服务器

刷新dns缓存命令:ipconfig /flushdns