Skip to content

Instantly share code, notes, and snippets.

@yagosys
Created May 19, 2018 08:16
Show Gist options
  • Select an option

  • Save yagosys/09ba153b6a64be4a761d10e50d01e962 to your computer and use it in GitHub Desktop.

Select an option

Save yagosys/09ba153b6a64be4a761d10e50d01e962 to your computer and use it in GitHub Desktop.
You might also want to log all the dropped packets. These rules should be at the bottom.
First, create a new chain called LOGGING.
iptables -N LOGGING
Next, make sure all the remaining incoming connections jump to the LOGGING chain as shown below.
iptables -A INPUT -j LOGGING
Next, log these packets by specifying a custom “log-prefix”.
iptables -A LOGGING -m limit --limit 2/min -j LOG --log-prefix "IPTables Packet Dropped: " --log-level 7
Finally, drop these packets.
iptables -A LOGGING -j DROP
@yagosys

yagosys commented May 20, 2018

Copy link
Copy Markdown
Author

iptables -N LOGGING
iptables -A INPUT -J LOGGING
iptables -A LOGGING -m limit --limit 2/min -j LOG --log-prefix "IPTABLES Packet Dropped: " --log-level 7
iptables -A LOGGING -j DROP

@yagosys

yagosys commented May 20, 2018

Copy link
Copy Markdown
Author

iptables -nvL -t nat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment