User Tools

Site Tools


iptables:implement_a_basic_firewall

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:implement_a_basic_firewall [2016/10/07 13:48] peteriptables:implement_a_basic_firewall [2019/11/29 17:37] (current) – removed peter
Line 1: Line 1:
-====== IPTables - Implement a basic firewall ====== 
- 
-Install iptables 
- 
-<code bash> 
-sudo apt-get install iptables 
-</code> 
- 
-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/implement_a_basic_firewall.1475848137.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki