<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
	<id>https://md5.pw/index.php?action=history&amp;feed=atom&amp;title=%E4%BD%BF%E7%94%A8nftables%E9%A2%84%E9%98%B2%E8%A2%AB%E7%AB%AF%E5%8F%A3%E6%89%AB%E6%8F%8F</id>
	<title>使用nftables预防被端口扫描 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://md5.pw/index.php?action=history&amp;feed=atom&amp;title=%E4%BD%BF%E7%94%A8nftables%E9%A2%84%E9%98%B2%E8%A2%AB%E7%AB%AF%E5%8F%A3%E6%89%AB%E6%8F%8F"/>
	<link rel="alternate" type="text/html" href="https://md5.pw/index.php?title=%E4%BD%BF%E7%94%A8nftables%E9%A2%84%E9%98%B2%E8%A2%AB%E7%AB%AF%E5%8F%A3%E6%89%AB%E6%8F%8F&amp;action=history"/>
	<updated>2026-04-05T14:30:15Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://md5.pw/index.php?title=%E4%BD%BF%E7%94%A8nftables%E9%A2%84%E9%98%B2%E8%A2%AB%E7%AB%AF%E5%8F%A3%E6%89%AB%E6%8F%8F&amp;diff=1422&amp;oldid=prev</id>
		<title>Air：​添加分类目录</title>
		<link rel="alternate" type="text/html" href="https://md5.pw/index.php?title=%E4%BD%BF%E7%94%A8nftables%E9%A2%84%E9%98%B2%E8%A2%AB%E7%AB%AF%E5%8F%A3%E6%89%AB%E6%8F%8F&amp;diff=1422&amp;oldid=prev"/>
		<updated>2026-02-18T15:08:19Z</updated>

		<summary type="html">&lt;p&gt;添加分类目录&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2026年2月18日 (三) 08:08的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l114&quot;&gt;第114行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第114行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;nft list set inet prevent_scanning tmp_blacklist_ipv6&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;nft list set inet prevent_scanning tmp_blacklist_ipv6&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:500 常见应用指南 — Application Guides]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff:1.41:old-1418:rev-1422:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Air</name></author>
	</entry>
	<entry>
		<id>https://md5.pw/index.php?title=%E4%BD%BF%E7%94%A8nftables%E9%A2%84%E9%98%B2%E8%A2%AB%E7%AB%AF%E5%8F%A3%E6%89%AB%E6%8F%8F&amp;diff=1418&amp;oldid=prev</id>
		<title>Koud Wind：​/* 3. 配置 */</title>
		<link rel="alternate" type="text/html" href="https://md5.pw/index.php?title=%E4%BD%BF%E7%94%A8nftables%E9%A2%84%E9%98%B2%E8%A2%AB%E7%AB%AF%E5%8F%A3%E6%89%AB%E6%8F%8F&amp;diff=1418&amp;oldid=prev"/>
		<updated>2026-02-18T13:18:21Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;3. 配置&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2026年2月18日 (三) 06:18的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l48&quot;&gt;第48行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第48行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         policy drop;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         policy drop;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;        # 放行本地/已建立/相关的连接&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         iif lo accept;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         iif lo accept;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         ct state established,related        accept;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         ct state established,related        accept;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff:1.41:old-1417:rev-1418:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Koud Wind</name></author>
	</entry>
	<entry>
		<id>https://md5.pw/index.php?title=%E4%BD%BF%E7%94%A8nftables%E9%A2%84%E9%98%B2%E8%A2%AB%E7%AB%AF%E5%8F%A3%E6%89%AB%E6%8F%8F&amp;diff=1417&amp;oldid=prev</id>
		<title>2026年2月18日 (三) 13:13 Koud Wind</title>
		<link rel="alternate" type="text/html" href="https://md5.pw/index.php?title=%E4%BD%BF%E7%94%A8nftables%E9%A2%84%E9%98%B2%E8%A2%AB%E7%AB%AF%E5%8F%A3%E6%89%AB%E6%8F%8F&amp;diff=1417&amp;oldid=prev"/>
		<updated>2026-02-18T13:13:58Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2026年2月18日 (三) 06:13的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l30&quot;&gt;第30行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第30行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 设立陷阱端口, 只有尝试建立连接时才会封禁, 推荐设为一些协议的默认端口, 误封概率适中&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 设立陷阱端口, 只有尝试建立连接时才会封禁, 推荐设为一些协议的默认端口, 误封概率适中&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight&amp;gt;table inet prevent_scanning {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;table inet prevent_scanning {&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     set tmp_blacklist_ipv4 {&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     set tmp_blacklist_ipv4 {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         type ipv4_addr&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         type ipv4_addr&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l69&quot;&gt;第69行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第68行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         udp dport { 50-70, 110-170, 514, 1194, 5353 }   ct state new    add @tmp_blacklist_ipv6 { ip6 saddr }   drop;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         udp dport { 50-70, 110-170, 514, 1194, 5353 }   ct state new    add @tmp_blacklist_ipv6 { ip6 saddr }   drop;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 任何端口没被放行后, 直接拉黑, 端口被扫中的概率最低, 但误封率较高 (比如不小心访问到80端口)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 任何端口没被放行后, 直接拉黑, 端口被扫中的概率最低, 但误封率较高 (比如不小心访问到80端口)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l107&quot;&gt;第107行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第105行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=== 4. 完成配置 ===&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;根据自己的喜好进行调整后保存, 重启&amp;lt;syntaxhighlight&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;systemctl restart nftables.service&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/syntaxhighlight&amp;gt;查看封禁了哪些IP&amp;lt;syntaxhighlight&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;nft list set inet prevent_scanning tmp_blacklist_ipv4&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;nft list set inet prevent_scanning tmp_blacklist_ipv6&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff:1.41:old-1416:rev-1417:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Koud Wind</name></author>
	</entry>
	<entry>
		<id>https://md5.pw/index.php?title=%E4%BD%BF%E7%94%A8nftables%E9%A2%84%E9%98%B2%E8%A2%AB%E7%AB%AF%E5%8F%A3%E6%89%AB%E6%8F%8F&amp;diff=1416&amp;oldid=prev</id>
		<title>Koud Wind：​创建页面，内容为“我想很多人有这样的困惑, 明明自己改了默认端口, 一看日志, 仍然还有陌生IP在对端口进行暴力破解, 即便是上了类似Fail2ban这种防护工具, 日志里陌生IP的记录也永远不会消停; 想上白名单, 但每次自己的IP变了之后, 还要再手动加进白名单里, 比较麻烦.   这时候, 我们就可以用 &lt;code&gt;nftables&lt;/code&gt; 自动拉黑那些尝试扫描端口的陌生IP.  ----  === 1. 准备 === 确保…”</title>
		<link rel="alternate" type="text/html" href="https://md5.pw/index.php?title=%E4%BD%BF%E7%94%A8nftables%E9%A2%84%E9%98%B2%E8%A2%AB%E7%AB%AF%E5%8F%A3%E6%89%AB%E6%8F%8F&amp;diff=1416&amp;oldid=prev"/>
		<updated>2026-02-18T13:05:07Z</updated>

		<summary type="html">&lt;p&gt;创建页面，内容为“我想很多人有这样的困惑, 明明自己改了默认端口, 一看日志, 仍然还有陌生IP在对端口进行暴力破解, 即便是上了类似Fail2ban这种防护工具, 日志里陌生IP的记录也永远不会消停; 想上白名单, 但每次自己的IP变了之后, 还要再手动加进白名单里, 比较麻烦.   这时候, 我们就可以用 &amp;lt;code&amp;gt;nftables&amp;lt;/code&amp;gt; 自动拉黑那些尝试扫描端口的陌生IP.  ----  === 1. 准备 === 确保…”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;我想很多人有这样的困惑, 明明自己改了默认端口, 一看日志, 仍然还有陌生IP在对端口进行暴力破解, 即便是上了类似Fail2ban这种防护工具, 日志里陌生IP的记录也永远不会消停; 想上白名单, 但每次自己的IP变了之后, 还要再手动加进白名单里, 比较麻烦. &lt;br /&gt;
&lt;br /&gt;
这时候, 我们就可以用 &amp;lt;code&amp;gt;nftables&amp;lt;/code&amp;gt; 自动拉黑那些尝试扫描端口的陌生IP. &lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== 1. 准备 ===&lt;br /&gt;
确保 nftables 已经安装&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
nft --version&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;若没有安装, 以Debian13为例&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
apt update&lt;br /&gt;
apt install nftables&lt;br /&gt;
systemctl enable nftables&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;拷贝原有的nftables配置, 到一个好找的目录里, 以 &amp;lt;code&amp;gt;/main/nftables&amp;lt;/code&amp;gt; 为例, 再对原路径进行链接&amp;lt;syntaxhighlight&amp;gt;cp /etc/nftables.conf /main/nftables/&lt;br /&gt;
ln -f /main/nftables/nftables.conf /etc/nftables.conf&amp;lt;/syntaxhighlight&amp;gt;并准备好编辑 &amp;lt;code&amp;gt;/main/nftables/nftables.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== 2. 基础策略 ===&lt;br /&gt;
如果你之前配置过nftables, 那就在原有基础上进行新增或合并&lt;br /&gt;
&lt;br /&gt;
现在假设我不希望ssh端口被扫中, 默认的22端口肯定不得使用, 需要将ssh端口开放到一个&amp;#039;&amp;#039;&amp;#039;没有任何协议所使用的的默认端口上&amp;#039;&amp;#039;&amp;#039; (比如ssh开放到80端口)&lt;br /&gt;
&lt;br /&gt;
一般的陌生IP暴力破解一个端口, 需要先进行网络嗅探, 陌生IP可以自行扫描获取端口协议, 也可以使用其他平台公示的端口, 端口扫描器肯定优先扫描一些协议的默认端口, 绝对不能使用这些&lt;br /&gt;
&lt;br /&gt;
端口扫描器扫完常见协议的端口, 之后大部分只会按照端口顺序进行扫描, 但这样基本上是不可能扫中的, 只有随机顺序扫描才有可能扫中&lt;br /&gt;
&lt;br /&gt;
=== 3. 配置 ===&lt;br /&gt;
这里以ssh开放在46端口为例&lt;br /&gt;
&lt;br /&gt;
我们可以分成两种方式: &lt;br /&gt;
&lt;br /&gt;
* 设立陷阱端口, 只有尝试建立连接时才会封禁, 推荐设为一些协议的默认端口, 误封概率适中&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
table inet prevent_scanning {&lt;br /&gt;
    set tmp_blacklist_ipv4 {&lt;br /&gt;
        type ipv4_addr&lt;br /&gt;
        flags timeout&lt;br /&gt;
        # 封禁时间&lt;br /&gt;
        timeout 30m&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    set tmp_blacklist_ipv6 {&lt;br /&gt;
        type ipv6_addr&lt;br /&gt;
        flags timeout&lt;br /&gt;
        timeout 20m&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    chain input {&lt;br /&gt;
        type filter hook input priority 0;&lt;br /&gt;
        policy drop;&lt;br /&gt;
&lt;br /&gt;
        iif lo accept;&lt;br /&gt;
        ct state established,related        accept;&lt;br /&gt;
&lt;br /&gt;
        # 不希望被ping到可以注释掉&lt;br /&gt;
        ip protocol icmp                    accept;&lt;br /&gt;
        ip6 nexthdr ipv6-icmp               accept;&lt;br /&gt;
        &lt;br /&gt;
        &lt;br /&gt;
        ip saddr @tmp_blacklist_ipv4        drop;&lt;br /&gt;
        ip6 saddr @tmp_blacklist_ipv6       drop;&lt;br /&gt;
&lt;br /&gt;
        # 放行后不会往后执行&lt;br /&gt;
        tcp dport { 46 }    ct state new    accept;&lt;br /&gt;
        &lt;br /&gt;
        # 自行配置陷阱端口&lt;br /&gt;
        tcp dport { 1-25, 3300-3500, 6379, 8080 }       ct state new    add @tmp_blacklist_ipv4 { ip saddr }    drop;&lt;br /&gt;
        tcp dport { 1-25, 3300-3500, 6379, 8080 }       ct state new    add @tmp_blacklist_ipv6 { ip6 saddr }   drop;&lt;br /&gt;
        udp dport { 50-70, 110-170, 514, 1194, 5353 }   ct state new    add @tmp_blacklist_ipv4 { ip saddr }    drop;&lt;br /&gt;
        udp dport { 50-70, 110-170, 514, 1194, 5353 }   ct state new    add @tmp_blacklist_ipv6 { ip6 saddr }   drop;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 任何端口没被放行后, 直接拉黑, 端口被扫中的概率最低, 但误封率较高 (比如不小心访问到80端口)&lt;br /&gt;
&amp;lt;syntaxhighlight line=&amp;quot;1&amp;quot; start=&amp;quot;0&amp;quot;&amp;gt;table inet prevent_scanning {&lt;br /&gt;
    set tmp_blacklist_ipv4 {&lt;br /&gt;
        type ipv4_addr&lt;br /&gt;
        flags timeout&lt;br /&gt;
        timeout 30m&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    set tmp_blacklist_ipv6 {&lt;br /&gt;
        type ipv6_addr&lt;br /&gt;
        flags timeout&lt;br /&gt;
        timeout 20m&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    chain input {&lt;br /&gt;
        type filter hook input priority 0;&lt;br /&gt;
        policy drop;&lt;br /&gt;
&lt;br /&gt;
        iif lo accept;&lt;br /&gt;
        ct state established,related        accept;&lt;br /&gt;
&lt;br /&gt;
        # 不希望被ping到可以注释掉&lt;br /&gt;
        ip protocol icmp                    accept;&lt;br /&gt;
        ip6 nexthdr ipv6-icmp               accept;&lt;br /&gt;
        &lt;br /&gt;
        &lt;br /&gt;
        ip saddr @tmp_blacklist_ipv4        drop;&lt;br /&gt;
        ip6 saddr @tmp_blacklist_ipv6       drop;&lt;br /&gt;
&lt;br /&gt;
        tcp dport { 46 }    ct state new    accept;&lt;br /&gt;
        &lt;br /&gt;
        ct state new    add @tmp_blacklist_ipv4 { ip saddr }    drop;&lt;br /&gt;
        ct state new    add @tmp_blacklist_ipv6 { ip6 saddr }   drop;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Koud Wind</name></author>
	</entry>
</feed>