Debian Codegraph @

upstream/debian-unstable/man8/xtables-nft.8

raw
1 .\"
2 .\" (C) Copyright 2016-2017, Arturo Borrero Gonzalez <[email protected]>
3 .\"
4 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
9 .\"
10 .\" The GNU General Public License's references to "object code"
11 .\" and "executables" are to be interpreted as the output of any
12 .\" document formatting or typesetting system, including
13 .\" intermediate and printed output.
14 .\"
15 .\" This manual is distributed in the hope that it will be useful,
16 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 .\" GNU General Public License for more details.
19 .\"
20 .\" You should have received a copy of the GNU General Public
21 .\" License along with this manual; if not, see
22 .\" <http://www.gnu.org/licenses/>.
23 .\" %%%LICENSE_END
24 .\"
25 .TH XTABLES-NFT 8 "June 2018"
26
27 .SH NAME
28 xtables-nft \(em iptables using nftables kernel api
29
30 .SH DESCRIPTION
31 \fBxtables-nft\fP are versions of iptables that use the nftables API.
32 This is a set of tools to help the system administrator migrate the
33 ruleset from \fBiptables(8)\fP, \fBip6tables(8)\fP, \fBarptables(8)\fP, and
34 \fBebtables(8)\fP to \fBnftables(8)\fP.
35
36 The \fBxtables-nft\fP set is composed of several commands:
37 .IP \[bu] 2
38 iptables\-nft
39 .IP \[bu]
40 iptables\-nft\-save
41 .IP \[bu]
42 iptables\-nft\-restore
43 .IP \[bu]
44 ip6tables\-nft
45 .IP \[bu]
46 ip6tables\-nft\-save
47 .IP \[bu]
48 ip6tables\-nft\-restore
49 .IP \[bu]
50 arptables\-nft
51 .IP \[bu]
52 ebtables\-nft
53
54 These tools use the libxtables framework extensions and hook to the nf_tables
55 kernel subsystem using the \fBnft_compat\fP module.
56
57 .SH USAGE
58 The xtables-nft tools allow you to manage the nf_tables backend using the
59 native syntax of \fBiptables(8)\fP, \fBip6tables(8)\fP, \fBarptables(8)\fP, and
60 \fBebtables(8)\fP.
61
62 You should use the xtables-nft tools exactly the same way as you would use the
63 corresponding original tools.
64
65 Adding a rule will result in that rule being added to the nf_tables kernel
66 subsystem instead.
67 Listing the ruleset will use the nf_tables backend as well.
68
69 When these tools were designed, the main idea was to replace each legacy binary
70 with a symlink to the xtables-nft program, for example:
71
72 .nf
73 /sbin/iptables -> /usr/sbin/iptables\-nft\-multi
74 /sbin/ip6tables -> /usr/sbin/ip6tables\-nft\-multi
75 /sbin/arptables -> /usr/sbin/arptables\-nft\-multi
76 /sbin/ebtables -> /usr/sbin/ebtables\-nft\-multi
77 .fi
78
79 The iptables version string will indicate whether the legacy API (get/setsockopt) or
80 the new nf_tables api is used:
81 .nf
82 iptables \-V
83 iptables v1.7 (nf_tables)
84 .fi
85
86 .SH DIFFERENCES TO LEGACY IPTABLES
87
88 Because the xtables-nft tools use the nf_tables kernel API, rule additions
89 and deletions are always atomic. Unlike iptables-legacy, iptables-nft \-A ..
90 will NOT need to retrieve the current ruleset from the kernel, change it, and
91 re-load the altered ruleset. Instead, iptables-nft will tell the kernel to add
92 one rule. For this reason, the iptables-legacy \-\-wait option is a no-op in
93 iptables-nft.
94
95 Use of the xtables-nft tools allow monitoring ruleset changes using the
96 .B xtables\-monitor(8)
97 command.
98
99 When using \-j TRACE to debug packet traversal to the ruleset, note that you will need to use
100 .B xtables\-monitor(8)
101 in \-\-trace mode to obtain monitoring trace events.
102
103 .SH EXAMPLES
104 One basic example is creating the skeleton ruleset in nf_tables from the
105 xtables-nft tools, in a fresh machine:
106
107 .nf
108 root@machine:\(ti# iptables\-nft \-L
109 [...]
110 root@machine:\(ti# ip6tables\-nft \-L
111 [...]
112 root@machine:\(ti# arptables\-nft \-L
113 [...]
114 root@machine:\(ti# ebtables\-nft \-L
115 [...]
116 root@machine:\(ti# nft list ruleset
117 table ip filter {
118 chain INPUT {
119 type filter hook input priority 0; policy accept;
120 }
121
122 chain FORWARD {
123 type filter hook forward priority 0; policy accept;
124 }
125
126 chain OUTPUT {
127 type filter hook output priority 0; policy accept;
128 }
129 }
130 table ip6 filter {
131 chain INPUT {
132 type filter hook input priority 0; policy accept;
133 }
134
135 chain FORWARD {
136 type filter hook forward priority 0; policy accept;
137 }
138
139 chain OUTPUT {
140 type filter hook output priority 0; policy accept;
141 }
142 }
143 table bridge filter {
144 chain INPUT {
145 type filter hook input priority \-200; policy accept;
146 }
147
148 chain FORWARD {
149 type filter hook forward priority \-200; policy accept;
150 }
151
152 chain OUTPUT {
153 type filter hook output priority \-200; policy accept;
154 }
155 }
156 table arp filter {
157 chain INPUT {
158 type filter hook input priority 0; policy accept;
159 }
160
161 chain FORWARD {
162 type filter hook forward priority 0; policy accept;
163 }
164
165 chain OUTPUT {
166 type filter hook output priority 0; policy accept;
167 }
168 }
169 .fi
170
171 (please note that in fresh machines, listing the ruleset for the first time
172 results in all tables an chain being created).
173
174 To migrate your complete filter ruleset, in the case of \fBiptables(8)\fP,
175 you would use:
176
177 .nf
178 root@machine:\(ti# iptables\-legacy\-save > myruleset # reads from x_tables
179 root@machine:\(ti# iptables\-nft\-restore myruleset # writes to nf_tables
180 .fi
181 or
182 .nf
183 root@machine:\(ti# iptables\-legacy\-save | iptables\-translate\-restore | less
184 .fi
185
186 to see how rules would look like in the nft
187 \fBnft(8)\fP
188 syntax.
189
190 .SH LIMITATIONS
191 You should use \fBLinux kernel >= 4.17\fP.
192
193 The CLUSTERIP target is not supported.
194
195 To get up-to-date information about this, please head to
196 \fBhttp://wiki.nftables.org/\fP.
197
198 .SH SEE ALSO
199 \fBnft(8)\fP, \fBxtables\-translate(8)\fP, \fBxtables\-monitor(8)\fP
200
201 .SH AUTHORS
202 The nftables framework is written by the Netfilter project
203 (https://www.netfilter.org).
204
205 This manual page was written by Arturo Borrero Gonzalez
206 <[email protected]> for the Debian project, but may be used by others.
207
208 This documentation is free/libre under the terms of the GPLv2+.