search on lynty.com

Related Articles

iptables

Print PDF

1.Getting error while trying to insert new rule into the chain:

 

iptables: Index of insertion too big

The problem is commonly is index given is
larger than the number of the RULES in chain, then you will get this
error.

e.g

You got 33 rules in SOME_CHAIN, and you try to INSERT rules with number 45 (-I SOME_CHAIN 45 ) to this CHAIN  for example

so, now You got the issue!

2.Force iptables to log messages to a different log file


By default, Iptables log message to a /var/log/messages file. To log the iptables messages to a different log file

Open your /etc/syslog.conf file:

# vi /etc/syslog.conf
Append following line
kern.warning /var/log/iptables.log
Save and close the file.

Restart the syslogd
Configure the log level

# DROP everything and Log it

iptables -A INPUT -j LOG --log-level 4
iptables -A INPUT -j DROP

--log-level 4: Level of logging. The level # 4 is for warning.
--log-prefix '*** TEXT ***': Prefix log messages with the specified prefix (TEXT); up to 29 letters long, and useful for distinguishing messages in the logs.

 

Related Articles+