Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
19
rated 0 times [  19] [ 0]  / answers: 1 / hits: 37812  / 2 Years ago, fri, july 1, 2022, 11:09:34

I want to create a custom table using iptables so that I can add my custom chains in it. But I doesn't see any option to do that. I tried to search for it but didnt found anything. Please Help.


More From » iptables

 Answers
4

I think you are looking for creating a chain, not a table.



   -N, --new-chain chain
Create a new user-defined chain by the given name. There must be no target of that name already.


Example (-t filter is implied):



iptables -N Services
iptables -A INPUT -j Services
iptables -A Services -m tcp -p tcp --dport 80 -j ACCEPT


Tables can be selected with the -t option:



iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE


And if you are using iptables-restore, the above two rules can be combined to:



*nat
-A POSTROUTING -j MASQUERADE
COMMIT

*filter
:Services -
-A INPUT -j Services
-A Services -m tcp -p tcp --dport 80 -j ACCEPT
COMMIT

[#30427] Sunday, July 3, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rcraftemur

Total Points: 118
Total Questions: 119
Total Answers: 144

Location: Turks and Caicos Islands
Member since Sun, Mar 7, 2021
3 Years ago
;