ARPTABLES(8)
๐ ARPTABLES(8) ๐ ARP table administration (nft-based) ๐
โจ NAME โจ
okay so arptables is the ARPTABLES(8) tool, and it's all about ARP table administration (nft-based) ๐ฆ
๐ SYNOPSIS ๐
arptables [-t table] {-A|-D} chain rule-specification [options...]
arptables [-t table] -I chain [rulenum] rule-specification
arptables [-t table] -R chain rulenum rule-specification
arptables [-t table] -D chain rulenum
arptables [-t table] {-F|-L|-Z} [chain [rulenum]] [options...]
arptables [-t table] -N chain
arptables [-t table] -X [chain]
arptables [-t table] -P chain policy
arptables [-t table] -E old-chain-name new-chain-name
rule-specification := [matches...] [target]
match := -m matchname [per-match-options]
target := -j targetname [per-target-options]
๐ DESCRIPTION ๐
bestie, arptables is a user space tool ๐ง It's how you set up and maintain the tables of ARP rules in the Linux kernel, and those rules inspect the ARP frames they see. It's giving iptables energy, but arptables is less complicated ๐ธ
๐ฆ CHAINS ๐ฆ
So the table is used to divide functionality into different sets of rules, and each set is called a chain ๐ A chain is an ordered list of rules that can match ARP frames. If a rule matches a frame, a processing specification tells what to do with it, and that spec is called a 'target' ๐ฏ But if the frame doesn't match the current rule, the next rule in the chain gets checked, and so on and so forth. You can also create your own (user-defined) chains and use them as the 'target' of a rule. Iconic ๐
๐ฏ TARGETS ๐ฏ
A firewall rule has criteria for an ARP frame plus a frame processing specification called a target. When a frame matches, the kernel's next move is decided by the target. The target can be one of these values: ACCEPT, DROP, CONTINUE, RETURN, an 'extension' (see below) or a user-defined chain ๐
ACCEPTโ means let the frame through โจDROPโ means the frame has to be dropped ๐CONTINUEโ means the next rule has to be checked. This is handy for knowing how many frames pass a certain point in the chain, or for logging those frames ๐RETURNโ means stop traversing this chain and resume at the next rule in the previous (calling) chain ๐
For the extension targets, check the TARGET EXTENSIONS section of this man page, it's all there ๐ซถ
๐๏ธ TABLES ๐๏ธ
Real talk, there's only one ARP table in the Linux kernel, and it's filter. You can drop the -t filter argument to the arptables command. If you do use -t, it has to be the first argument on the arptables command line ๐
-t,--tableโfilteris the only table, and it contains two built-in chains:INPUT(for frames destined for the host) andOUTPUT(for locally-generated frames) ๐
๐ ARPTABLES COMMAND LINE ARGUMENTS ๐
After the initial arptables command line argument, the rest of your arguments sort into a few groups: commands, miscellaneous commands, rule-specifications, match-extensions, and watcher-extensions ๐ง
๐ COMMANDS ๐
These are the actions you perform on the table you picked with -t. If you don't use -t, the commands hit the default filter table. With the exception of the -Z command, you can only use one command on the command line at a time, so no multitasking ๐
-A,--appendโ tacks a rule onto the very end of the selected chain ๐-D,--deleteโ deletes a rule from the selected chain. There are two ways to do this. The first is by giving an interval of rule numbers, syntax:start_nr[:end_nr]. Negative numbers are allowed too, and for more on those, check the-Icommand. The second is by typing out the complete rule exactly as it was when you added it ๐๏ธ-I,--insertโ inserts the rule into the selected chain at the rule number you give. If the chain currently has N rules, the number can be anywhere between-NandN+1. For a positive number i, i and i-N-1 point to the same spot in the chain. The number0means the spot past the last rule, which makes it the same as using-A๐งฉ-R,--replaceโ replaces the rule at the given rule number in the selected chain. If the chain has N rules, the number can be between1andN. i is the spot in the chain where the replacement happens ๐-P,--policyโ sets the policy for the chain to the target you give. The policy can beACCEPT,DROPorRETURN๐-F,--flushโ flushes the selected chain. If you don't select one, every chain gets flushed ๐ Flushing doesn't change the chain's policy though, so don't panic ๐ซง-Z,--zeroโ resets the counters of the selected chain to zero. If no chain is selected, all the counters go to zero โฒ๏ธ You can pair-Zwith-L, and when you do that, the rule counters get printed on screen before they're zeroed, so you still get to see the tea โ-L,--listโ lists all rules in the selected chain. If no chain is selected, every chain gets listed ๐-N,--new-chainโ creates a new user-defined chain with the name you give. There's no limit on how many user-defined chains you can make, and a user-defined chain name can be at most 31 characters ๐-X,--delete-chainโ deletes the specified user-defined chain. There must be no remaining references to it, or arptables will refuse to delete it ๐ โโ๏ธ If you don't specify a chain, all user-defined chains that aren't referenced get removed ๐งน-E,--rename-chainโ renames the specified chain to a new name ๐ซ Besides renaming a user-defined chain, you can also rename a standard chain name to whatever suits your taste. For example, if you likePREBRIDGINGmore thanPREROUTING, you can use-Eto rename thePREROUTINGchain. Heads up though: if you rename one of the standard arptables chain names and then post a question on the arptables mailing lists, please mention that fact. It's wise to use the standard name in your post. Renaming a standard arptables chain this way has no effect on the structure or function of the arptables kernel table ๐ซถ
๐ธ MISCELLANEOUS COMMANDS ๐ธ
-V,--versionโ shows the version of the arptables userspace program ๐ท๏ธ-h,--helpโ gives you a brief description of the command syntax ๐-j,--jump targetโ the target of the rule. It's one of these values:ACCEPT,DROP,CONTINUE,RETURN, a target extension (see TARGET EXTENSIONS), or a user-defined chain name ๐ฏ-c,--set-counters PKTS BYTESโ lets you initialize the packet and byte counters of a rule during INSERT, APPEND, or REPLACE operations ๐ข
๐ง RULE-SPECIFICATIONS ๐ง
These command line arguments make up a rule specification (the stuff used in the add and delete commands). A "!" option placed before the specification inverts the test for that specification ๐ Apart from these standard rule specifications, there are some other command line arguments worth knowing about ๐
-s,--source-ip [!] address[/mask]โ the Source IP specification ๐-d,--destination-ip [!] address[/mask]โ the Destination IP specification ๐ฏ--source-mac [!] address[/mask]โ the source MAC address. Both mask and address are written as 6 hexadecimal numbers separated by colons ๐--destination-mac [!] address[/mask]โ the destination MAC address. Both mask and address are written as 6 hexadecimal numbers separated by colons ๐-i,--in-interface [!] nameโ the interface a frame is received on (for the INPUT chain). The flag--in-ifis an alias for this option ๐ฅ-o,--out-interface [!] nameโ the interface a frame is going to be sent out of (for the OUTPUT chain). The flag--out-ifis an alias for this option ๐ค-l,--h-length length[/mask]โ the hardware length, in number of bytes ๐--opcode code[/mask]โ the operation code (2 bytes). Available values are:1=Request,2=Reply,3=Request_Reverse,4=Reply_Reverse,5=DRARP_Request,6=DRARP_Reply,7=DRARP_Error,8=InARP_Request,9=ARP_NAK๐งพ--h-type type[/mask]โ the hardware type (2 bytes, hexadecimal). Available values are:1=Ethernet๐--proto-type type[/mask]โ the protocol type (2 bytes). Available values are:0x800=IPv4๐
๐ฅ TARGET-EXTENSIONS ๐ฅ
arptables extensions are precompiled into the userspace tool, so there's no need to load them with a -m option like you would in iptables ๐ That said, these extensions deal with functionality supported by supplemental kernel modules, so they're not nothing ๐ง
๐ฆ mangle ๐ฆ
--mangle-ip-s IP addressโ mangles the Source IP Address to the given value ๐ช--mangle-ip-d IP addressโ mangles the Destination IP Address to the given value ๐ช--mangle-mac-s MAC addressโ mangles the Source MAC Address to the given value ๐ช--mangle-mac-d MAC addressโ mangles the Destination MAC Address to the given value ๐ช--mangle-target targetโ the target of the ARP mangle operation (DROP,CONTINUEorACCEPTโ default isACCEPT) ๐ฏ
๐ CLASSIFY ๐
This module lets you set the skb->priority value, which means you can classify the packet into a specific CBQ class ๐ท๏ธ
--set-class major:minorโ sets the major and minor class value. The values are always interpreted as hexadecimal, even if you don't give a0xprefix ๐ข
๐ MARK ๐
This module lets you set the skb->mark value, so you can classify the packet by the mark in u32 ๐
--set-mark markโ sets the mark value. The values are always interpreted as hexadecimal, even if you don't give a0xprefix ๐--and-mark markโ does a binary AND of the mark with bits ๐งฎ--or-mark markโ does a binary OR of the mark with bits ๐งฎ
๐ NOTES ๐
โ ๏ธ Heads up, bestie: in this nft-based version of arptables, support for the FORWARD chain has not been implemented ๐ญ ARP packets only get "forwarded" by Linux bridges, so you can get the same effect using the FORWARD chain in ebtables instead ๐ซถ
๐ฌ MAILINGLISTS ๐ฌ
Check out http://netfilter.org/mailinglists.html ๐
๐ฆ SEE ALSO ๐ฆ
xtables-nft(8), iptables(8), ebtables(8), ip(8) โจ Also see https://wiki.nftables.org for more tea ๐ต
Okay that's the whole ARPTABLES(8) tea, bestie ๐ Dated March 2019 and filed under ARPTABLES(8) ๐ Stay iconic, go touch some grass, and I'll see you in the group chat ๐ธ๐ซถ๐
๐ฆ where this page comes from
- alpine 3.22: iptables-doc 1.8.11-r1 ยท GPL-2.0-or-later
- alpine 3.23: iptables-doc 1.8.11-r1 ยท GPL-2.0-or-later
- alpine 3.24: iptables-doc 1.8.13-r0 ยท GPL-2.0-or-later
- debian trixie: iptables 1.8.11-2 ยท GPL-2.0-only
- fedora 43: iptables-nft 1.8.11-11.fc43 ยท GPL-2.0-only AND Artistic-2.0 AND ISC
- fedora 43: iptables-nft 1.8.11-12.fc43 ยท GPL-2.0-only AND Artistic-2.0 AND ISC
- fedora 44: iptables-nft 1.8.11-13.fc44 ยท GPL-2.0-only AND Artistic-2.0 AND ISC
- nixpkgs unstable: iptables 1.8.13
- opensuse-leap 16.0: iptables 1.8.11-160000.2.2 ยท Artistic-2.0 AND GPL-2.0-only
- opensuse-leap 16.0: iptables 1.8.11-160000.2.2 ยท Artistic-2.0 AND GPL-2.0-only
- opensuse-leap 16.0: iptables 1.8.11-160000.2.2 ยท Artistic-2.0 AND GPL-2.0-only
- opensuse-leap 16.0: iptables 1.8.11-160000.2.2 ยท Artistic-2.0 AND GPL-2.0-only
- ubuntu questing: iptables 1.8.11-2ubuntu2 ยท GPL-2.0-only
- ubuntu resolute: iptables 1.8.11-2ubuntu3 ยท GPL-2.0-only
- ubuntu stonking: iptables 1.8.11-2ubuntu3 ยท GPL-2.0-only
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms