User Tools

Site Tools


iptables: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:basic_firewall [2016/10/20 19:00] peteriptables:basic_firewall [2019/11/29 16:38] (current) – removed peter
Line 1: Line 1:
-====== IPTables - Basic Firewall ====== 
- 
-===== Verify the IPTables package is installed ===== 
- 
-<code bash> 
-dpkg --list | grep iptables 
-</code> 
- 
-Returns 
- 
-<code> 
-ii  iptables                            1.6.0-2ubuntu3                      amd64        administration tools for packet filtering and NAT 
-</code> 
- 
- 
-===== Verify the Kernel Module is loaded ===== 
- 
-<code bash> 
-lsmod | grep ip_tables 
-</code> 
- 
-Returns 
- 
-<code> 
-ip_tables              24576  4 iptable_filter,iptable_mangle,iptable_nat,iptable_raw 
-</code> 
- 
- 
- 
-===== Creating iptables rules ===== 
- 
-<code bash> 
-iptables -P INPUT DROP 
-iptables -P OUTPUT DROP 
- 
-# Allowing Loopback Traffic. 
-iptables -I INPUT -i lo -j ACCEPT 
- 
-# Allow established connections. 
-iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT 
- 
-# Allow SSH in. 
-# iptables -I INPUT -p tcp --dport 22 -j ACCEPT 
-iptables -A INPUT -p tcp --dport 22 -s 192.168.1.2 -j ACCEPT 
- 
-# iptables -A INPUT -p tcp --dport 80 -j ACCEPT 
-# iptables -A INPUT -p tcp --dport 443 -j ACCEPT 
- 
-# Loading the ip_conntrack_ftp module 
- 
-# iptables -A INPUT -p tcp --dport 21 -j ACCEPT 
-# iptables -A INPUT -p tcp --dport 20 -j ACCEPT 
- 
- 
- 
-</code> 
- 
  
iptables/basic_firewall.1476990048.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki