IPTABLES-APPLY(8)
๐ IPTABLES-APPLY(8) โ a safer way to update iptables remotely
okay so bestie, this is iptables-apply from the iptables 1.8.13 era, and it is literally the โจ responsible queen โจ of remote firewall editing. buckle up ๐
๐ธ SYNOPSIS ๐ธ
iptables-apply [-hV] [-t timeout] [-w savefile] {[rulesfile]|-c
[runcmd]}
๐ฆ DESCRIPTION ๐ฆ
so here's the whole vibe: iptables-apply tries to apply a new rulesfile โ like, the kind of file that iptables-save spits out and iptables-restore reads back in โ or it runs a command to configure iptables. then it prompts you to confirm whether the changes are actually okay. main character energy, but with a safety net ๐ซถ
and why does it ask? because if the new iptables rules just cut your existing connection (yes, we've all been there ๐ญ), you literally can't answer affirmatively. you're locked out. no cap. so when that timeout hits and you haven't said "yeah it's fine," the script rolls back to the previous working iptables rules. iconic rollback behaviour, honestly ๐
rules that do get applied successfully can also be written out to a savefile, and later used to roll back to this state. this is how you implement a store-last-good-configuration mechanism while you're out here experimenting with an iptables setup script:
iptables-apply -w /etc/network/iptables.up.rules -c /etc/network/iptables.up.run
also, when it's called as ip6tables-apply, the script uses ip6tables-save/-restore and IPv6 default values instead of the v4 ones. cute, right? ๐ and the default value for rulesfile is /etc/network/iptables.up.rules.
โจ OPTIONS โจ
-t seconds,--timeout secondsโ sets the timeout, in seconds, after which the script rolls back to the previous ruleset. default:10.-w savefile,--write savefileโ names the savefile where successfully applied rules get written. the default, if an empty string is given, is/etc/network/iptables.up.rules.-c runcmd,--command runcmdโ runs the command runcmd to configure iptables instead of applying a rulesfile. default:/etc/network/iptables.up.run.-h,--helpโ displays usage information.-V,--versionโ displays version information.
โ ๏ธ real talk: the whole point of -t is that you might lose your connection. keep the timeout short-ish, hold your breath, and confirm fast ๐
๐ผ SEE ALSO ๐ผ
๐ LEGALESE ๐
original iptables-apply โ Copyright 2006 Martin F. Krafft <madduck@madduck.net>. Version 1.1 โ Copyright 2010 GW <gw.2010@tnode.com or http://gw.tnode.com/>.
this manual page was written by Martin F. Krafft <madduck@madduck.net> and extended by GW <gw.2010@tnode.com or http://gw.tnode.com/>.
permission is granted to copy, distribute and/or modify this document under the terms of the Artistic License 2.0. periodt ๐
and that's the whole page, bestie ๐ โ brought to you by iptables 1.8.13, straight from the IPTABLES-APPLY(8) corner of the manual. go forth and not lock yourself out ๐โจ
๐ฆ where this page comes from
- alpine 3.24: iptables-doc 1.8.13-r0 ยท GPL-2.0-or-later
- nixpkgs unstable: iptables 1.8.13
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms