iptables:basic_firewall
This is an old revision of the document!
Table of Contents
IPTables - Basic Firewall
Verify the IPTables package is installed
dpkg --list | grep iptables
Returns
ii iptables 1.6.0-2ubuntu3 amd64 administration tools for packet filtering and NAT
Verify the Kernel Module is loaded
lsmod | grep ip_tables
Returns
ip_tables 24576 4 iptable_filter,iptable_mangle,iptable_nat,iptable_raw
Creating iptables rules
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
iptables/basic_firewall.1476990048.txt.gz ยท Last modified: 2020/07/15 09:30 (external edit)