I have these example rules from iptables and I want to economize them
lan=enp2s0
iptables -A INPUT -i $lan -p tcp --dport 1234 -j NFLOG --nflog-prefix 'foo'
iptables -A INPUT -i $lan -p tcp --dport 1234 -j ACCEPT
iptables -A FORWARD -i $lan -p tcp --dport 1234 -j NFLOG --nflog-prefix 'foo'
iptables -A FORWARD -i $lan -p tcp --dport 1234 -j ACCEPT
iptables -t mangle -A PREROUTING -i $lan -p tcp --dport 1234 -j NFLOG --nflog-prefix 'foo'
iptables -t mangle -A PREROUTING -i $lan -p tcp --dport 1234 -j ACCEPT
I tried with a custom rule but it doesn't work for me. It says that the chain MYCHAIN already exists
iptables -N MYCHAIN
iptables -A INPUT -i $lan -p tcp --dport 1234 -j MYCHAIN
iptables -A FORWARD -i $lan -p tcp --dport 1234 -j MYCHAIN
iptables -t mangle -A PREROUTING -i $lan -p tcp --dport 1234 -j MYCHAIN
iptables -A MYCHAIN -j NFLOG --nflog-prefix 'foo'
iptables -A MYCHAIN -j ACCEPT
How to abbreviate iptables rules? (to economize lines)