User Tools

Site Tools


iptables:basic_commands

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
iptables:basic_commands [2016/10/07 13:57] peteriptables:basic_commands [2019/11/29 16:34] (current) – removed peter
Line 1: Line 1:
-====== IPTables - Basic commands ====== 
- 
-Install iptables 
- 
-<code bash> 
-sudo apt-get install iptables 
-</code> 
- 
- 
-Policy Chain Default Behavior 
- 
-iptables --policy INPUT DROP 
-iptables --policy OUTPUT DROP 
-iptables --policy FORWARD DROP 
- 
- 
-Block all connections from the IP address 10.10.10.10. 
- 
-<code bash> 
-iptables -A INPUT -s 10.10.10.10 -j DROP 
-</code> 
- 
-Block all of the IP addresses in the 10.10.10.0/24 network range.  
- 
-<code bash> 
-iptables -A INPUT -s 10.10.10.0/24 -j DROP 
-</code> 
- 
-or 
- 
-<code bash> 
-iptables -A INPUT -s 10.10.10.0/255.255.255.0 -j DROP 
-</code> 
- 
-Block SSH connections from 10.10.10.10. 
- 
-<code bash> 
-iptables -A INPUT -p tcp --dport ssh -s 10.10.10.10 -j DROP 
-</code> 
- 
-Block SSH connections from any IP address. 
- 
-<code bash> 
-iptables -A INPUT -p tcp --dport ssh -j DROP 
-</code> 
- 
-Connection States 
- 
-<code bash> 
-iptables -A INPUT -p tcp --dport ssh -s 10.10.10.10 -m state --state NEW,ESTABLISHED -j ACCEPT 
- 
-iptables -A OUTPUT -p tcp --sport 22 -d 10.10.10.10 -m state --state ESTABLISHED -j ACCEPT 
-</code> 
  
iptables/basic_commands.1475848659.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki