Iptables

#!/bin/bash
iptables -P INPUT ACCEPT
iptables -F
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp –dport 22 -j ACCEPT
iptables -A INPUT -p tcp –dport 80 -j ACCEPT
# Drop an IP address
# iptables -A INPUT -s 10.1.2.3 -j DROP
#
# Accept packets from trusted IP addresses using standard slash notation
# iptables -A INPUT -s 192.168.0.0/24 -j ACCEPT
#
# Accept packets from trusted IP/MAC addresses
# iptables -A INPUT -s 192.168.0.4 -m mac –mac-source 00:50:8D:FD:E6:32 -j ACCEPT
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -L -v

Comments are closed.