如何在Windows中使用ipconfig / flushdns命令清除DNS并重置TCP / IP

DNS is used to translate between a human-readable name like poftut.com and IP address like 45.79.1333.118. DNS can use both UDP and TCP protocols but generally, UDP protocol is preferred. In this tutorial, we will learn how to flush, clear the DNS cache with ipconfig /flushdns command. This tutorial can be applied to the All Windows Operating system versions like Windows XP, Windows 7, Windows 8, Windows 10, Windows Server 2003, Windows Server 2008, Windows Server 2012, Windows Server 2016, Windows Server 2019 without a problem. This will not require special privileges like Administrator.

DNS用于在易于poftut.com名称(例如poftut.com和IP地址(例如45.79.1333.118之间进行转换。 DNS可以同时使用UDP和TCP协议,但通常首选UDP协议。 在本教程中,我们将学习如何使用ipconfig /flushdns命令刷新,清除DNS缓存。 本教程可以毫无问题地应用于所有Windows操作系统版本,例如Windows XP,Windows 7,Windows 8,Windows 10,Windows Server 2003,Windows Server 2008,Windows Server 2012,Windows Server 2016,Windows Server 2019。 这将不需要管理员等特殊特权。

什么是DNS缓存? (What Is DNS Cache?)

For every domain name, DNS will query the DNS Server normally. But this may create a bottleneck in busy times. In order to prevent this bottleneck, DNS services use a cache mechanism. Learned DNS records are stored in a cache for some time. If during this period a DNS is queried cache returns if exists.

对于每个域名,DNS都会正常查询DNS服务器。 但这可能会在繁忙时期造成瓶颈。 为了防止出现此瓶颈,DNS服务使用缓存机制。 学习到的DNS记录会在缓存中存储一​​段时间。 如果在此期间查询DNS,则如果存在则返回缓存。

打印并列出当前的DNS缓存条目 (Print and List Current DNS Cache Entries)

We can print or list currently cached DNS entries with the /displaydns option of ipconfig command.

我们可以使用ipconfig命令的/displaydns选项打印或列出当前缓存的DNS条目。

> ipconfig /displaydns
Print and List Current DNS Cache Entries
Print and List Current DNS Cache Entries
打印并列出当前的DNS缓存条目

As we can see from screenshot domain names are stored in DNS cache with related information. There is the following information

从屏幕截图中可以看到,域名与相关信息一起存储在DNS缓存中。 有以下信息

  • Record Name specifies the name of the DNS record

    记录名称指定DNS记录的名称
  • Record Type specifies the type of DNS entry

    记录类型指定DNS条目的类型
  • Time To Live provides the validity time of the DNS entry

    生存时间提供DNS条目的有效时间
  • Data Length

    资料长度
  • Section

    部分

使用ipconfig / flushdns命令刷新DNS条目(Flush DNS Entries with ipconfig /flushdns Command)

In order to clear this DNS cache, we will use ipconfig command with /flushdns parameter. This will remove all DNS entries except localhost because it is a local system DNS record.

为了清除此DNS缓存,我们将使用带/flushdns参数的ipconfig命令。 这将删除除localhost以外的所有DNS条目,因为它是本地系统DNS记录。

> ipconfig /flushdns
Flush DNS
Flush DNS
刷新DNS

We can see that flush is completed successfully from the screenshot.

从屏幕截图中我们可以看到刷新成功完成。

LEARN MORE  What is Network Address Translation (NAT)?
了解更多什么是网络地址转换(NAT)?

从运行框中清除DNS缓存 (Flush DNS Cache From Run Box)

In the previous example, we have used a command line which is named cmd.exe. We can also run ipconfig /flushdns command from Run like below. This will open a command line and run the command to clear and delete all DNS cache entries. Then the command line will be closed automatically.

在前面的示例中,我们使用了名为cmd.exe的命令行。 我们也可以像下面这样从Run运行ipconfig /flushdns命令。 这将打开命令行并运行命令以清除和删除所有DNS缓存条目。 然后命令行将自动关闭。

Run Command
Run Command
运行命令

检查DNS缓存条目是否刷新(Check DNS Cache Entries Whether Flushed)

We can check whether flush is effective with the ipconfig /displaydns command again like below.

我们可以再次使用ipconfig /displaydns命令检查刷新是否有效,如下所示。

> ipconfig /displaydns
Check DNS Cache Entries Whether Flushed
Check DNS Cache Entries Whether Flushed
检查DNS缓存条目是否刷新

As we can see other DNS entries are deleted successfully. There are only localhost and arpa DNS entries which are static.

如我们所见,其他DNS条目已成功删除。 只有localhostarpa DNS条目是静态的。

使用Clear-DnsClientCache PowerShell命令清除DNS缓存 (Flush DNS Cache with Clear-DnsClientCache PowerShell Command)

PowerShell provides very same of the traditional MS-DOS commands. We can use all of the MS-DOS commands in PowerShell too. We can flush the DNS cache records with the ipconfig /flushdns command like below. First, we will open PowerShell from the start menu by writing powershell like below.

PowerShell提供了与传统MS-DOS命令完全相同的功能。 我们也可以在PowerShell中使用所有MS-DOS命令。 我们可以使用ipconfig /flushdns命令刷新DNS缓存记录,如下所示。 首先,我们将通过如下所示编写powershell从开始菜单中打开PowerShell。

Open PowerShell
Open PowerShell
打开PowerShell

Then we will type the command like below.

然后,我们将如下所示键入命令。

PS> ipconfig /flushdns
Flush DNS with PowerShell
Flush DNS with PowerShell
使用PowerShell刷新DNS

使用PowerShell Clear-DnsClientCache Cmdlet刷新DNS (Flush DNS with PowerShell Clear-DnsClientCache Cmdlet)

Powershell provides a new way to clear DNS client cache or flush DNS with the Clear-DnsClientCache cmdlet. We will just execute the command below.

Powershell提供了一种新的方式来清除DNS客户端缓存或使用Clear-DnsClientCache cmdlet刷新DNS。 我们将只执行以下命令。

PS> Clear-DnsClientCache

翻译自: https://www.poftut.com/how-to-flush-dns-and-reset-tcp-ip-with-ipconfig-flushdns-command-in-windows/

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值