iptables

Reference

Display rules

  • sudo iptables -L -v -n –line-numbers

Deleting all the rules

  • sudo iptables -F

Add rules

  • blocking an IP for incoming traffic: iptables -A INPUT -s 1.2.3.4 -j DROP
  • iptables -A INPUT -p icmp –icmp-type echo-request -j DROP
  • iptables -A INPUT -p tcp –dport 8080 ! -s  24.86.126.251 -j DROP
  • iptables -A INPUT -p tcp –dport 8080 -m iprange –src-range 24.86.126.251 -j ACCEPT

Save rules

  • service iptables save
  • iptables-save > /root/my.active.firewall.rules
Advertisements
This entry was posted in iptables. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s