Debian Codegraph @

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

raw
1 .\"
2 .\" (C) Copyright 2018, 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 IPTABLES-TRANSLATE 8 "May 14, 2019"
26
27 .SH NAME
28 iptables-translate \(em translation tool to migrate from iptables to nftables
29 .P
30 ip6tables-translate \(em translation tool to migrate from ip6tables to nftables
31 .P
32 ebtables-translate \(em translation tool to migrate from ebtables to nftables
33 .P
34 arptables-translate \(em translation tool to migrate from arptables to nftables
35 .SH DESCRIPTION
36 There is a set of tools to help the system administrator translate a given
37 ruleset from \fBiptables(8)\fP, \fBip6tables(8)\fP, \fBebtables(8)\fP and
38 \fBarptables(8)\fP to \fBnftables(8)\fP.
39
40 The available commands are:
41
42 .IP \[bu] 2
43 iptables\-translate
44 .IP \[bu]
45 iptables\-restore\-translate
46 .IP \[bu] 2
47 ip6tables\-translate
48 .IP \[bu]
49 ip6tables\-restore\-translate
50 .IP \[bu] 2
51 ebtables\-translate
52 .IP \[bu] 2
53 arptables\-translate
54
55 .SH USAGE
56 They take as input the original
57 \fBiptables(8)\fP/\fBip6tables(8)\fP/\fBebtables(8)\fP/\fBarptables(8)\fP
58 syntax and output the native \fBnftables(8)\fP syntax.
59
60 The \fBiptables-restore-translate\fP tool reads a ruleset in the syntax
61 produced by \fBiptables-save(8)\fP. Likewise, the
62 \fBip6tables-restore-translate\fP tool reads one produced by
63 \fBip6tables-save(8)\fP. No ruleset modifications occur, these tools are
64 text converters only.
65
66 The \fBiptables-translate\fP reads a command line as if it was entered to
67 \fBiptables(8)\fP, and \fBip6tables-translate\fP reads a command like as if it
68 was entered to \fBip6tables(8)\fP.
69
70 .SH EXAMPLES
71 Basic operation examples.
72
73 Single command translation:
74
75 .nf
76 root@machine:\(ti# iptables\-translate \-A INPUT \-p tcp \-\-dport 22 \-m conntrack \-\-ctstate NEW \-j ACCEPT
77 nft add rule ip filter INPUT tcp dport 22 ct state new counter accept
78
79 root@machine:\(ti# ip6tables\-translate \-A FORWARD \-i eth0 \-o eth3 \-p udp \-m multiport \-\-dports 111,222 \-j ACCEPT
80 nft add rule ip6 filter FORWARD iifname eth0 oifname eth3 meta l4proto udp udp dport { 111,222} counter accept
81 .fi
82
83 Whole ruleset translation:
84
85 .nf
86 root@machine:\(ti# iptables\-save > save.txt
87 root@machine:\(ti# cat save.txt
88 # Generated by iptables\-save v1.6.0 on Sat Dec 24 14:26:40 2016
89 *filter
90 :INPUT ACCEPT [5166:1752111]
91 :FORWARD ACCEPT [0:0]
92 :OUTPUT ACCEPT [5058:628693]
93 \-A FORWARD \-p tcp \-m tcp \-\-dport 22 \-m conntrack \-\-ctstate NEW \-j ACCEPT
94 COMMIT
95 # Completed on Sat Dec 24 14:26:40 2016
96
97 root@machine:\(ti# iptables\-restore\-translate \-f save.txt
98 # Translated by iptables\-restore\-translate v1.6.0 on Sat Dec 24 14:26:59 2016
99 add table ip filter
100 add chain ip filter INPUT { type filter hook input priority 0; }
101 add chain ip filter FORWARD { type filter hook forward priority 0; }
102 add chain ip filter OUTPUT { type filter hook output priority 0; }
103 add rule ip filter FORWARD tcp dport 22 ct state new counter accept
104
105 root@machine:\(ti# iptables\-restore\-translate \-f save.txt > ruleset.nft
106 root@machine:\(ti# nft \-f ruleset.nft
107 root@machine:\(ti# nft list ruleset
108 table ip filter {
109 chain INPUT {
110 type filter hook input priority 0; policy accept;
111 }
112
113 chain FORWARD {
114 type filter hook forward priority 0; policy accept;
115 tcp dport ssh ct state new counter packets 0 bytes 0 accept
116 }
117
118 chain OUTPUT {
119 type filter hook output priority 0; policy accept;
120 }
121 }
122 .fi
123
124
125 .SH LIMITATIONS
126 Some (few) extensions may be not supported (or fully-supported) for whatever
127 reason (for example, they were considered obsolete, or we didn't have the time
128 to work on them).
129
130 There is no translation available for \fBarptables(8)\fP.
131
132 To get up-to-date information about this, please head to
133 \fBhttps://wiki.nftables.org/\fP.
134
135 .SH SEE ALSO
136 \fBnft(8)\fP, \fBiptables(8)\fP
137
138 .SH AUTHORS
139 The nftables framework is written by the Netfilter project
140 (https://www.netfilter.org).
141
142 This manual page was written by Arturo Borrero Gonzalez
143 <[email protected]>.
144
145 This documentation is free/libre under the terms of the GPLv2+.