<?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%E5%B1%8F%E8%94%BD%E5%9B%BD%E5%A4%96%E6%B5%81%E9%87%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%E5%B1%8F%E8%94%BD%E5%9B%BD%E5%A4%96%E6%B5%81%E9%87%8F"/>
	<link rel="alternate" type="text/html" href="https://md5.pw/index.php?title=%E4%BD%BF%E7%94%A8nftables%E5%B1%8F%E8%94%BD%E5%9B%BD%E5%A4%96%E6%B5%81%E9%87%8F&amp;action=history"/>
	<updated>2026-04-07T00:30:12Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://md5.pw/index.php?title=%E4%BD%BF%E7%94%A8nftables%E5%B1%8F%E8%94%BD%E5%9B%BD%E5%A4%96%E6%B5%81%E9%87%8F&amp;diff=1470&amp;oldid=prev</id>
		<title>2026年2月19日 (四) 16:13 Liam</title>
		<link rel="alternate" type="text/html" href="https://md5.pw/index.php?title=%E4%BD%BF%E7%94%A8nftables%E5%B1%8F%E8%94%BD%E5%9B%BD%E5%A4%96%E6%B5%81%E9%87%8F&amp;diff=1470&amp;oldid=prev"/>
		<updated>2026-02-19T16:13:20Z</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月19日 (四) 09: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-l56&quot;&gt;第56行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第56行：&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;systemctl restart nftables.service&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;systemctl restart nftables.service&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-1462:rev-1470:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Liam</name></author>
	</entry>
	<entry>
		<id>https://md5.pw/index.php?title=%E4%BD%BF%E7%94%A8nftables%E5%B1%8F%E8%94%BD%E5%9B%BD%E5%A4%96%E6%B5%81%E9%87%8F&amp;diff=1462&amp;oldid=prev</id>
		<title>Koud Wind：​/* 2. 获取国内IP段 */</title>
		<link rel="alternate" type="text/html" href="https://md5.pw/index.php?title=%E4%BD%BF%E7%94%A8nftables%E5%B1%8F%E8%94%BD%E5%9B%BD%E5%A4%96%E6%B5%81%E9%87%8F&amp;diff=1462&amp;oldid=prev"/>
		<updated>2026-02-19T15:01:45Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;2. 获取国内IP段&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月19日 (四) 08:01的版本&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-l23&quot;&gt;第23行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第23行：&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;=== 3. 配置nftables ===&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;=== 3. 配置nftables ===&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;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;的&lt;/del&gt;添加或与其它的table进行合并, 这里比如只有访问tcp 46端口的国内IP, 才能放行&amp;lt;syntaxhighlight line=&quot;1&quot;&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;在合适位置添加或与其它的table进行合并, 这里比如只有访问tcp 46端口的国内IP, 才能放行&amp;lt;syntaxhighlight line=&quot;1&quot;&amp;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;table inet geoip_filter {&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;table inet geoip_filter {&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;!-- diff cache key my_wiki:diff:1.41:old-1460:rev-1462: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%E5%B1%8F%E8%94%BD%E5%9B%BD%E5%A4%96%E6%B5%81%E9%87%8F&amp;diff=1460&amp;oldid=prev</id>
		<title>Koud Wind：​/* 2. 获取国内IP段 */</title>
		<link rel="alternate" type="text/html" href="https://md5.pw/index.php?title=%E4%BD%BF%E7%94%A8nftables%E5%B1%8F%E8%94%BD%E5%9B%BD%E5%A4%96%E6%B5%81%E9%87%8F&amp;diff=1460&amp;oldid=prev"/>
		<updated>2026-02-19T14:47:26Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;2. 获取国内IP段&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月19日 (四) 07:47的版本&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-l17&quot;&gt;第17行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第17行：&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;unzip master.zip&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;unzip master.zip&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;rm master.zip&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;rm master.zip&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;执行脚本&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;执行脚本&amp;lt;syntaxhighlight&amp;gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;mv nftables-geoip-master/* ./&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;chmod u+x nft_geoip.py&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;chmod u+x nft_geoip.py&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;./nft_geoip.py --file-location location.csv --download&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_geoip.py --file-location location.csv --download&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;./nft_geoip.py --download -c cn&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;./nft_geoip.py --download -c cn&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;=== 3. 配置nftables ===&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;=== 3. 配置nftables ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff:1.41:old-1459:rev-1460: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%E5%B1%8F%E8%94%BD%E5%9B%BD%E5%A4%96%E6%B5%81%E9%87%8F&amp;diff=1459&amp;oldid=prev</id>
		<title>Koud Wind：​创建页面，内容为“----  === 1. 准备 === 确保 nftables 与 python3 已经安装&lt;syntaxhighlight&gt; nft --version python3 --version &lt;/syntaxhighlight&gt;若没有安装, 以Debian13为例&lt;syntaxhighlight&gt;apt update apt install nftables python3 unzip systemctl enable nftables&lt;/syntaxhighlight&gt;拷贝原有的nftables配置, 到一个好找的目录里, 以 &lt;code&gt;/main/nftables&lt;/code&gt; 为例, 再对原路径进行链接&lt;syntaxhighlight&gt;cp /etc/nftables.conf /main/nftables/ ln -f /main…”</title>
		<link rel="alternate" type="text/html" href="https://md5.pw/index.php?title=%E4%BD%BF%E7%94%A8nftables%E5%B1%8F%E8%94%BD%E5%9B%BD%E5%A4%96%E6%B5%81%E9%87%8F&amp;diff=1459&amp;oldid=prev"/>
		<updated>2026-02-19T14:42:24Z</updated>

		<summary type="html">&lt;p&gt;创建页面，内容为“----  === 1. 准备 === 确保 nftables 与 python3 已经安装&amp;lt;syntaxhighlight&amp;gt; nft --version python3 --version &amp;lt;/syntaxhighlight&amp;gt;若没有安装, 以Debian13为例&amp;lt;syntaxhighlight&amp;gt;apt update apt install nftables python3 unzip systemctl enable nftables&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/ ln -f /main…”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;----&lt;br /&gt;
&lt;br /&gt;
=== 1. 准备 ===&lt;br /&gt;
确保 nftables 与 python3 已经安装&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
nft --version&lt;br /&gt;
python3 --version&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;若没有安装, 以Debian13为例&amp;lt;syntaxhighlight&amp;gt;apt update&lt;br /&gt;
apt install nftables python3 unzip&lt;br /&gt;
systemctl enable nftables&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;
=== 2. 获取国内IP段 ===&lt;br /&gt;
先获取并解压项目文件&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
mkdir /main/nftables/geoip&lt;br /&gt;
cd /main/nftables/geoip&lt;br /&gt;
wget https://github.com/pvxe/nftables-geoip/archive/refs/heads/master.zip&lt;br /&gt;
unzip master.zip&lt;br /&gt;
rm master.zip&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;执行脚本&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
chmod u+x nft_geoip.py&lt;br /&gt;
./nft_geoip.py --file-location location.csv --download&lt;br /&gt;
./nft_geoip.py --download -c cn&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3. 配置nftables ===&lt;br /&gt;
在合适位置的添加或与其它的table进行合并, 这里比如只有访问tcp 46端口的国内IP, 才能放行&amp;lt;syntaxhighlight line=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
table inet geoip_filter {&lt;br /&gt;
&lt;br /&gt;
    include &amp;quot;/main/nftables/geoip/geoip-def-all.nft&amp;quot;;&lt;br /&gt;
    include &amp;quot;/main/nftables/geoip/geoip-ipv4-interesting.nft&amp;quot;;&lt;br /&gt;
	include &amp;quot;/main/nftables/geoip/geoip-ipv6-interesting.nft&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    chain geoip_mark_input {&lt;br /&gt;
		type filter hook                        prerouting priority -10;&lt;br /&gt;
        policy accept;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		meta mark set                           ip saddr map @geoip4;&lt;br /&gt;
		meta mark set                           ip6 saddr map @geoip6;&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;
        # 放行本地/已建立/相关的连接&lt;br /&gt;
        iif lo accept;&lt;br /&gt;
        ct state established,related        accept;&lt;br /&gt;
        &lt;br /&gt;
        tcp dport { 46 }    meta mark $CN   ct state new    accept;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 4. 完成配置 ===&lt;br /&gt;
保存后并重启&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
systemctl restart nftables.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Koud Wind</name></author>
	</entry>
</feed>