<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DNS &#8211; Bubblog</title>
	<atom:link href="https://blog.yangyuanping.com/tag/dns/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.yangyuanping.com</link>
	<description>nullable reference types</description>
	<lastBuildDate>Fri, 19 Dec 2025 17:23:54 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://blog.yangyuanping.com/wp-content/uploads/2025/11/cropped-patrick_log_logo_251121-2-32x32.png</url>
	<title>DNS &#8211; Bubblog</title>
	<link>https://blog.yangyuanping.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Mac 中刷新 DNS</title>
		<link>https://blog.yangyuanping.com/mac-%e4%b8%ad%e5%88%b7%e6%96%b0-dns/</link>
		
		<dc:creator><![CDATA[peny911]]></dc:creator>
		<pubDate>Wed, 26 Nov 2025 15:40:53 +0000</pubDate>
				<category><![CDATA[Linux Nibbles]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[Mac]]></category>
		<guid isPermaLink="false">https://blog.yangyuanping.com/?p=1039</guid>

					<description><![CDATA[在 Mac（macOS） 中刷新 DNS 缓存没有像 Windows 那样统一的 &#60;code&#62;ip [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>在 <strong>Mac（macOS）</strong> 中刷新 DNS 缓存没有像 Windows 那样统一的 &lt;code&gt;ipconfig /flushdns&lt;/code&gt;，而是<strong>按系统版本使用不同的 &lt;code&gt;dscacheutil&lt;/code&gt; + &lt;code&gt;killall mDNSResponder&lt;/code&gt; 组合命令</strong>。</p>
<hr />
<h2><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 一行通用万能命令（推荐直接用这个）</h2>
<p>在 <strong>终端（Terminal）</strong> 中执行：</p>
<pre><code class="language-bash">sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder</code></pre>
<p>输入你的 <strong>系统登录密码</strong>（不会显示），回车即可完成刷新。</p>
<blockquote>
<p>这个命令适用于：</p>
</blockquote>
<ul>
<li>macOS Ventura (13)</li>
<li>macOS Sonoma (14)</li>
<li>macOS Sequoia (15)</li>
<li>Monterey (12)</li>
<li>Big Sur (11)</li>
<li>Catalina (10.15)</li>
<li>Mojave (10.14)</li>
</ul>
<hr />
<h2><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4cc.png" alt="📌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 各系统版本对应命令（备用参考）</h2>
<table>
<thead>
<tr>
<th>macOS 版本</th>
<th>刷新 DNS 命令</th>
</tr>
</thead>
<tbody>
<tr>
<td>10.10.4 及以后</td>
<td>&lt;code&gt;sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder&lt;/code&gt;</td>
</tr>
<tr>
<td>10.10 – 10.10.3</td>
<td>&lt;code&gt;sudo discoveryutil mdnsflushcache; sudo discoveryutil udnsflushcaches&lt;/code&gt;</td>
</tr>
<tr>
<td>10.7 – 10.9</td>
<td>&lt;code&gt;sudo killall -HUP mDNSResponder&lt;/code&gt;</td>
</tr>
<tr>
<td>10.5 – 10.6</td>
<td>&lt;code&gt;sudo dscacheutil -flushcache&lt;/code&gt;</td>
</tr>
</tbody>
</table>
<hr />
<h2><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 如何判断是否刷新成功？</h2>
<p>macOS 刷新 DNS <strong>默认是没有任何成功提示的</strong>，这是正常现象 <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /><br />
如果你想确认是否真的生效，可以：</p>
<pre><code class="language-bash">ping your-domain.com</code></pre>
<p>或：</p>
<pre><code class="language-bash">nslookup your-domain.com</code></pre>
<hr />
<h2><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 适合你的使用场景（比如你刚刚在折腾这些）</h2>
<p>你最近使用的场景包括：</p>
<ul>
<li><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 花生壳 / 动态域名解析</li>
<li><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 公网 IP + 远程桌面</li>
<li><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 路由器 DDNS 解析切换</li>
<li><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 域名刚刚改解析但访问不生效</li>
</ul>
<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>这时候刷新 DNS 是“必须操作”之一，否则很容易一直命中旧 IP</strong>。</p>
<hr />
<h2><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 进阶：同时刷新 WiFi/网络缓存（更彻底）</h2>
<p>如果你遇到的是那种 <strong>“DNS 已改，但 Mac 仍然连不上”</strong> 的顽固情况，可以：</p>
<pre><code class="language-bash">sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
sudo ifconfig en0 down
sudo ifconfig en0 up</code></pre>
<p>（&lt;code&gt;en0&lt;/code&gt; 是常见的 WiFi 网卡）</p>
<hr />
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
