āļāļēāļĢāļัāļāđāļāļĢืāļāļ่āļēāļĒ Firewall āđāļāļ DMZ (Demilitarized Zone) āđāļ็āļāļĢูāļāđāļāļāļŦāļึ่āļāļี่āļิāļĒāļĄāđāļ้āļัāļ āļึ่āļāđāļāļĢืāļāļ่āļēāļĒāļāļ°āļāļĢāļ°āļāļāļāđāļāļ้āļ§āļĒāđāļāļĢืāļāļ่āļēāļĒ 3 āļŠ่āļ§āļāļ้āļ§āļĒāļัāļ āļืāļ
1 .āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāđāļ (trusted internal network) āļāļ°āđāļ็āļāļŠ่āļ§āļāļี่āđāļĄ่āļāļุāļāļēāļāđāļŦ้āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāļāļāļāđāļ้āļēāļĄāļēāđāļ้ āļึ่āļāļŠ่āļ§āļāđāļŦāļ่āļāļ°āđāļ็āļāļŠ่āļ§āļāļāļāļ Client
2. āđāļāļĢืāļāļ่āļēāļĒ DMZ āđāļ็āļāļŠ่āļ§āļāļี่āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāļāļāļāđāļĨāļ°āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāđāļāđāļ้āļēāļĄāļēāđāļ้āļāļēāļāđāļ้āļāļēāļĄāļāļāļี่ Firewall āđāļ้āļั้āļāđāļ§้
3.āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāļāļāļ (Internet)
āđāļāļĒāļāļēāļĢāđāļื่āļāļĄāļ่āļāđāļ้āļāļēāļāļāļ°āļ้āļāļāļĄี Linux Server āļัāļ§āļŦāļี่āļāļāļģāļŦāļ้āļēāļี่āđāļ็āļ Firewall āļึ่āļāļāļ°āļ้āļāļāļāļĢāļ°āļāļāļāļ้āļ§āļĒāļāļēāļĢ์āļāđāļĨāļ 3 āļāļēāļĢ์āļ āļัāļāļĢูāļāļี่ 1

āļĢูāļāļี่ 1

āļĢูāļāļี่ 2
1 .āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāđāļ (trusted internal network) āļāļ°āđāļ็āļāļŠ่āļ§āļāļี่āđāļĄ่āļāļุāļāļēāļāđāļŦ้āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāļāļāļāđāļ้āļēāļĄāļēāđāļ้ āļึ่āļāļŠ่āļ§āļāđāļŦāļ่āļāļ°āđāļ็āļāļŠ่āļ§āļāļāļāļ Client
2. āđāļāļĢืāļāļ่āļēāļĒ DMZ āđāļ็āļāļŠ่āļ§āļāļี่āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāļāļāļāđāļĨāļ°āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāđāļāđāļ้āļēāļĄāļēāđāļ้āļāļēāļāđāļ้āļāļēāļĄāļāļāļี่ Firewall āđāļ้āļั้āļāđāļ§้
3.āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāļāļāļ (Internet)
āđāļāļĒāļāļēāļĢāđāļื่āļāļĄāļ่āļāđāļ้āļāļēāļāļāļ°āļ้āļāļāļĄี Linux Server āļัāļ§āļŦāļี่āļāļāļģāļŦāļ้āļēāļี่āđāļ็āļ Firewall āļึ่āļāļāļ°āļ้āļāļāļāļĢāļ°āļāļāļāļ้āļ§āļĒāļāļēāļĢ์āļāđāļĨāļ 3 āļāļēāļĢ์āļ āļัāļāļĢูāļāļี่ 1
āļĢูāļāļี่ 1
āđāļื่āļāđāļŦ้āđāļ้āļēāđāļāđāļ้āļ่āļēāļĒāļึ้āļāļึāļāļāļāđāļ้āļĢูāļāļัāļ§āļāļĒ่āļēāļāļāļēāļĢāđāļื่āļāļĄāļ่āļāļāļĢิāļ āđ āļัāļāļĢูāļāļี่ 2 āļึ่āļāļี่ Linux Firewall āļāļ°āļĄี Ethernet Card 3 āļāļēāļĢ์āļāļืāļ eth0 āđāļ้āđāļื่āļāļĄāļ่āļāļัāļāđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāļāļāļ, eth1 āđāļ้āđāļื่āļāļĄāļ่āļāļัāļāđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāđāļ āđāļĨāļ° eth2 āđāļ้āđāļื่āļāļĄāļ่āļāļัāļāđāļāļĢืāļāļ่āļēāļĒ DMZ āđāļāļŠ่āļ§āļāļāļāļ eth0 āļั้āļāļĄี IP Address āđāļ็āļ 3 āļ่āļēāļืāļ
1. 202.129.49.194 āđāļāļāļัāļ§āđāļāļāļึ่āļāđāļ็āļ Firewall
2. 202.129.49.195 āđāļ้āđāļāļ HTTP
3. 202.129.49.196 āđāļ้āđāļāļ DNS
āļŦāļĄāļēāļĒāđāļŦāļุ Proxy āđāļĄ่āļāļģāđāļ็āļāļ้āļāļāđāļŦ้āļāļĢิāļāļēāļĢāļัāļāļุāļāļāļĨāļ āļēāļĒāļāļāļ āļึāļāđāļĄ่āļāļģāđāļ็āļāļ้āļāļāđāļ้ IP āļāļĢิāļ
1. 202.129.49.194 āđāļāļāļัāļ§āđāļāļāļึ่āļāđāļ็āļ Firewall
2. 202.129.49.195 āđāļ้āđāļāļ HTTP
3. 202.129.49.196 āđāļ้āđāļāļ DNS
āļŦāļĄāļēāļĒāđāļŦāļุ Proxy āđāļĄ่āļāļģāđāļ็āļāļ้āļāļāđāļŦ้āļāļĢิāļāļēāļĢāļัāļāļุāļāļāļĨāļ āļēāļĒāļāļāļ āļึāļāđāļĄ่āļāļģāđāļ็āļāļ้āļāļāđāļ้ IP āļāļĢิāļ
āļĢูāļāļี่ 2
āļŦāļ้āļēāļี่āļāļāļ Linux Firewall
1.āļāļģ NAT (Outbound) āđāļŦ้āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāđāļ (trusted internal network) āļŠāļēāļĄāļēāļĢāļāđāļื่āļāļĄāļ่āļāđāļāļĒัāļāđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāļāļāļāđāļ้
2.āđāļāļāļĢāļีāļี่āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāđāļāļāļāļāđāļāđāļ้āļāļēāļāđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāļāļāļāđāļ็āļāļāļēāļĢāđāļĢีāļĒāļāđāļ้ http āđāļŦ้ redirect āđāļāļĒัāļ Proxy āļāļāļ DMZ (Transparent Proxy)
3.Linux Server āļ้āļāļāļāļุāļāļēāļāđāļŦ้āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāđāļāļŠāļēāļĄāļēāļĢāļāđāļ้āļāļēāļ DNS Server āđāļāļ§āļ DMZ āļั้āļāļāļēāļĢāđāļĢีāļĒāļāđāļāļĒāđāļ้ IP āļāļĢิāļāđāļĨāļ° IP āļāļĨāļāļĄāđāļ้ (āļั้āļ 202.129.49.196 āđāļĨāļ° 192.168.2.3)
4.Linux Server āļ้āļāļāļāļุāļāļēāļāđāļŦ้āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāđāļāļŠāļēāļĄāļēāļĢāļāđāļ้āļāļēāļ Web Server āđāļāļ§āļ DMZ āļั้āļāļāļēāļĢāđāļĢีāļĒāļāđāļāļĒāđāļ้ IP āļāļĢิāļāđāļĨāļ° IP āļāļĨāļāļĄ (āļั้āļ 202.129.49.195 āđāļĨāļ° 192.168.2.2)
5.āļāļģ NAT (Inbound) āđāļŦ้āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāļāļāļāđāļ้āļēāļĄāļēāđāļ้ Web Server āđāļĨāļ° DNS Server āđāļāļ§āļ DMZ āđāļ้
6.āļāļģāļŦāļ้āļēāļี่āđāļ็āļ Firewall
āļāļģāļŠั่āļ iptables āļี่āđāļ้
āļāļģāļŠั่āļāļี่āđāļ้āļั้āļāļŦāļĄāļāđāļ็āļāļัāļāļี้ :
#-----Start script------#
#Define variables
LAN_IP="192.168.1.1"
LAN_BCAST_ADRESS="192.168.1.255"
LAN_IFACE="eth1"
INET_IP="202.129.49.194"
INET_IFACE="eth0"
HTTP_IP="202.129.49.195"
DNS_IP="202.129.49.196"
DMZ_IP="192.168.2.1"
DMZ_IFACE="eth2"
DMZ_HTTP_IP="192.168.2.2"
DMZ_DNS_IP="192.168.2.3"
DMZ_PROXY_IP="192.168.2.4"
LO_IP="127.0.0.1"
LO_IFACE="lo"
1.āļāļģ NAT (Outbound) āđāļŦ้āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāđāļ (trusted internal network) āļŠāļēāļĄāļēāļĢāļāđāļื่āļāļĄāļ่āļāđāļāļĒัāļāđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāļāļāļāđāļ้
2.āđāļāļāļĢāļีāļี่āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāđāļāļāļāļāđāļāđāļ้āļāļēāļāđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāļāļāļāđāļ็āļāļāļēāļĢāđāļĢีāļĒāļāđāļ้ http āđāļŦ้ redirect āđāļāļĒัāļ Proxy āļāļāļ DMZ (Transparent Proxy)
3.Linux Server āļ้āļāļāļāļุāļāļēāļāđāļŦ้āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāđāļāļŠāļēāļĄāļēāļĢāļāđāļ้āļāļēāļ DNS Server āđāļāļ§āļ DMZ āļั้āļāļāļēāļĢāđāļĢีāļĒāļāđāļāļĒāđāļ้ IP āļāļĢิāļāđāļĨāļ° IP āļāļĨāļāļĄāđāļ้ (āļั้āļ 202.129.49.196 āđāļĨāļ° 192.168.2.3)
4.Linux Server āļ้āļāļāļāļุāļāļēāļāđāļŦ้āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāđāļāļŠāļēāļĄāļēāļĢāļāđāļ้āļāļēāļ Web Server āđāļāļ§āļ DMZ āļั้āļāļāļēāļĢāđāļĢีāļĒāļāđāļāļĒāđāļ้ IP āļāļĢิāļāđāļĨāļ° IP āļāļĨāļāļĄ (āļั้āļ 202.129.49.195 āđāļĨāļ° 192.168.2.2)
5.āļāļģ NAT (Inbound) āđāļŦ้āđāļāļĢืāļāļ่āļēāļĒāļ āļēāļĒāļāļāļāđāļ้āļēāļĄāļēāđāļ้ Web Server āđāļĨāļ° DNS Server āđāļāļ§āļ DMZ āđāļ้
6.āļāļģāļŦāļ้āļēāļี่āđāļ็āļ Firewall
āļāļģāļŠั่āļ iptables āļี่āđāļ้
āļāļģāļŠั่āļāļี่āđāļ้āļั้āļāļŦāļĄāļāđāļ็āļāļัāļāļี้ :
#-----Start script------#
#Define variables
LAN_IP="192.168.1.1"
LAN_BCAST_ADRESS="192.168.1.255"
LAN_IFACE="eth1"
INET_IP="202.129.49.194"
INET_IFACE="eth0"
HTTP_IP="202.129.49.195"
DNS_IP="202.129.49.196"
DMZ_IP="192.168.2.1"
DMZ_IFACE="eth2"
DMZ_HTTP_IP="192.168.2.2"
DMZ_DNS_IP="192.168.2.3"
DMZ_PROXY_IP="192.168.2.4"
LO_IP="127.0.0.1"
LO_IFACE="lo"
#CRITICAL: Enable IP forwarding since it is disabled by default.
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "1" > /proc/sys/net/ipv4/ip_forward
#Clear all chains of rule
iptables -F
iptables -X allowed
iptables -X icmp_packets
iptables -t nat -F
# Chain Policies gets set up before any bad packets gets through
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
# the allowed chain for TCP connections, utilized in the FORWARD chain
iptables -N allowed
iptables -A allowed -p TCP --syn -j ACCEPT
iptables -A allowed -p TCP -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A allowed -p TCP -j DROP
# ICMP rules, utilized in the FORWARD chain
iptables -N icmp_packets
iptables -A icmp_packets -p ICMP -s 0/0 --icmp-type 0 -j ACCEPT
iptables -A icmp_packets -p ICMP -s 0/0 --icmp-type 3 -j ACCEPT
iptables -A icmp_packets -p ICMP -s 0/0 --icmp-type 5 -j ACCEPT
iptables -A icmp_packets -p ICMP -s 0/0 --icmp-type 11 -j ACCEPT
# POSTROUTING chain in the nat table : Enable IP SNAT for all internal networks trying to get out on the Internet
iptables -t nat -A POSTROUTING -o $INET_IFACE -j SNAT --to-source $INET_IP
# PREROUTING chain in the nat table
# Do some checks for obviously spoofed IP's
iptables -t nat -A PREROUTING -i $INET_IFACE -s 192.168.0.0/16 -j DROP
iptables -t nat -A PREROUTING -i $INET_IFACE -s 10.0.0.0/8 -j DROP
iptables -t nat -A PREROUTING -i $INET_IFACE -s 172.16.0.0/12 -j DROP
iptables -t nat -A PREROUTING -i $INET_IFACE -s $INET_IP -j DROP
# Enable IP Destination NAT for DMZ zone (Inbound NAT)
iptables -t nat -A PREROUTING -p TCP -i $INET_IFACE -d $HTTP_IP --dport 80 -j DNAT --to-destination $DMZ_HTTP_IP
iptables -t nat -A PREROUTING -p TCP -i $INET_IFACE -d $DNS_IP --dport 53 -j DNAT --to-destination $DMZ_DNS_IP
iptables -t nat -A PREROUTING -p UDP -i $INET_IFACE -d $DNS_IP --dport 53 -j DNAT --to-destination $DMZ_DNS_IP
iptables -F
iptables -X allowed
iptables -X icmp_packets
iptables -t nat -F
# Chain Policies gets set up before any bad packets gets through
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
# the allowed chain for TCP connections, utilized in the FORWARD chain
iptables -N allowed
iptables -A allowed -p TCP --syn -j ACCEPT
iptables -A allowed -p TCP -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A allowed -p TCP -j DROP
# ICMP rules, utilized in the FORWARD chain
iptables -N icmp_packets
iptables -A icmp_packets -p ICMP -s 0/0 --icmp-type 0 -j ACCEPT
iptables -A icmp_packets -p ICMP -s 0/0 --icmp-type 3 -j ACCEPT
iptables -A icmp_packets -p ICMP -s 0/0 --icmp-type 5 -j ACCEPT
iptables -A icmp_packets -p ICMP -s 0/0 --icmp-type 11 -j ACCEPT
# POSTROUTING chain in the nat table : Enable IP SNAT for all internal networks trying to get out on the Internet
iptables -t nat -A POSTROUTING -o $INET_IFACE -j SNAT --to-source $INET_IP
# PREROUTING chain in the nat table
# Do some checks for obviously spoofed IP's
iptables -t nat -A PREROUTING -i $INET_IFACE -s 192.168.0.0/16 -j DROP
iptables -t nat -A PREROUTING -i $INET_IFACE -s 10.0.0.0/8 -j DROP
iptables -t nat -A PREROUTING -i $INET_IFACE -s 172.16.0.0/12 -j DROP
iptables -t nat -A PREROUTING -i $INET_IFACE -s $INET_IP -j DROP
# Enable IP Destination NAT for DMZ zone (Inbound NAT)
iptables -t nat -A PREROUTING -p TCP -i $INET_IFACE -d $HTTP_IP --dport 80 -j DNAT --to-destination $DMZ_HTTP_IP
iptables -t nat -A PREROUTING -p TCP -i $INET_IFACE -d $DNS_IP --dport 53 -j DNAT --to-destination $DMZ_DNS_IP
iptables -t nat -A PREROUTING -p UDP -i $INET_IFACE -d $DNS_IP --dport 53 -j DNAT --to-destination $DMZ_DNS_IP
# Enable Internal network connect to DMZ HTTP and DMZ DNS by public IP (update by Adisorn)
iptables -t nat -A PREROUTING -p TCP -i $LAN_IFACE -d $HTTP_IP --dport 80 -j DNAT --to-destination $DMZ_HTTP_IP
iptables -t nat -A PREROUTING -p TCP -i $LAN_IFACE -d $DNS_IP --dport 53 -j DNAT --to-destination $DMZ_DNS_IP
iptables -t nat -A PREROUTING -p UDP -i $LAN_IFACE -d $DNS_IP --dport 53 -j DNAT --to-destination $DMZ_DNS_IP
#Redirect all http from internal network (not DMZ http destination) to Proxy Server (Transparent Proxy) (update by sorn)
iptables -t nat -A PREROUTING -p TCP -i $LAN_IFACE -s 192.168.1.0/24 -d ! $DMZ_HTTP_IP --dport 80 -j DNAT --to-dest 192.168.2.4:3128
iptables -t nat -A PREROUTING -p TCP -i $LAN_IFACE -d $HTTP_IP --dport 80 -j DNAT --to-destination $DMZ_HTTP_IP
iptables -t nat -A PREROUTING -p TCP -i $LAN_IFACE -d $DNS_IP --dport 53 -j DNAT --to-destination $DMZ_DNS_IP
iptables -t nat -A PREROUTING -p UDP -i $LAN_IFACE -d $DNS_IP --dport 53 -j DNAT --to-destination $DMZ_DNS_IP
#Redirect all http from internal network (not DMZ http destination) to Proxy Server (Transparent Proxy) (update by sorn)
iptables -t nat -A PREROUTING -p TCP -i $LAN_IFACE -s 192.168.1.0/24 -d ! $DMZ_HTTP_IP --dport 80 -j DNAT --to-dest 192.168.2.4:3128
# FORWARD chain
# Get rid of bad TCP packets
iptables -A FORWARD -p tcp ! --syn -m state --state NEW -j LOG --log-prefix "New not syn:"
iptables -A FORWARD -p tcp ! --syn -m state --state NEW -j DROP
# DMZ section : General rules
iptables -A FORWARD -i $DMZ_IFACE -o $INET_IFACE -j ACCEPT
iptables -A FORWARD -i $INET_IFACE -o $DMZ_IFACE -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i $LAN_IFACE -o $DMZ_IFACE -j ACCEPT
iptables -A FORWARD -i $DMZ_IFACE -o $LAN_IFACE -j ACCEPT
# DMZ section : HTTP server
iptables -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_HTTP_IP --dport 80 -j allowed
iptables -A FORWARD -p ICMP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_HTTP_IP -j icmp_packets
#DMZ section : DNS server
iptables -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_DNS_IP --dport 53 -j allowed
iptables -A FORWARD -p UDP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_DNS_IP --dport 53 -j ACCEPT
iptables -A FORWARD -p ICMP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_DNS_IP -j icmp_packets
# Get rid of bad TCP packets
iptables -A FORWARD -p tcp ! --syn -m state --state NEW -j LOG --log-prefix "New not syn:"
iptables -A FORWARD -p tcp ! --syn -m state --state NEW -j DROP
# DMZ section : General rules
iptables -A FORWARD -i $DMZ_IFACE -o $INET_IFACE -j ACCEPT
iptables -A FORWARD -i $INET_IFACE -o $DMZ_IFACE -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i $LAN_IFACE -o $DMZ_IFACE -j ACCEPT
iptables -A FORWARD -i $DMZ_IFACE -o $LAN_IFACE -j ACCEPT
# DMZ section : HTTP server
iptables -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_HTTP_IP --dport 80 -j allowed
iptables -A FORWARD -p ICMP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_HTTP_IP -j icmp_packets
#DMZ section : DNS server
iptables -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_DNS_IP --dport 53 -j allowed
iptables -A FORWARD -p UDP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_DNS_IP --dport 53 -j ACCEPT
iptables -A FORWARD -p ICMP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_DNS_IP -j icmp_packets
# LAN section
iptables -A FORWARD -i $LAN_IFACE -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
# LOG all packets reaching here
iptables -A FORWARD -m limit --limit 3/minute --limit-burst 3 -j LOG --log-level DEBUG --log-prefix "IPT FORWARD packet died: "
# Firewall rules
# INPUT chain
#Get rid of bad packets
iptables -A INPUT -p tcp ! --syn -m state --state NEW -j LOG --log-prefix "New not syn:"
iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
iptables -A FORWARD -i $LAN_IFACE -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
# LOG all packets reaching here
iptables -A FORWARD -m limit --limit 3/minute --limit-burst 3 -j LOG --log-level DEBUG --log-prefix "IPT FORWARD packet died: "
# Firewall rules
# INPUT chain
#Get rid of bad packets
iptables -A INPUT -p tcp ! --syn -m state --state NEW -j LOG --log-prefix "New not syn:"
iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
# Packets from the Internet to this box
iptables -A INPUT -p ICMP -i $INET_IFACE -j icmp_packets
# Packets from LAN, DMZ or LOCALHOST
# From DMZ Interface to DMZ firewall IP
iptables -A INPUT -p ALL -i $DMZ_IFACE -d $DMZ_IP -j ACCEPT
# From LAN Interface to LAN firewall IP
iptables -A INPUT -p ALL -i $LAN_IFACE -d $LAN_IP -j ACCEPT
iptables -A INPUT -p ALL -i $LAN_IFACE -d $LAN_BCAST_ADRESS -j ACCEPT
iptables -A INPUT -p ICMP -i $INET_IFACE -j icmp_packets
# Packets from LAN, DMZ or LOCALHOST
# From DMZ Interface to DMZ firewall IP
iptables -A INPUT -p ALL -i $DMZ_IFACE -d $DMZ_IP -j ACCEPT
# From LAN Interface to LAN firewall IP
iptables -A INPUT -p ALL -i $LAN_IFACE -d $LAN_IP -j ACCEPT
iptables -A INPUT -p ALL -i $LAN_IFACE -d $LAN_BCAST_ADRESS -j ACCEPT
# From Localhost interface to Localhost IP
iptables -A INPUT -p ALL -i $LO_IFACE -d $LO_IP -j ACCEPT
iptables -A INPUT -p ALL -i $LO_IFACE -d $LO_IP -j ACCEPT
# All established and related packets incoming from the internet to the firewall
iptables -A INPUT -p ALL -d $INET_IP -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p ALL -d $INET_IP -m state --state ESTABLISHED,RELATED -j ACCEPT
# Logging rule
iptables -A INPUT -m limit --limit 3/minute --limit-burst 3 -j LOG --log-level DEBUG --log-prefix "IPT INPUT packet died: "
iptables -A INPUT -m limit --limit 3/minute --limit-burst 3 -j LOG --log-level DEBUG --log-prefix "IPT INPUT packet died: "
# OUTPUT chain
# Get rid of bad TCP packets
iptables -A OUTPUT -p tcp ! --syn -m state --state NEW -j LOG --log-prefix "New not syn:"
iptables -A OUTPUT -p tcp ! --syn -m state --state NEW -j DROP
# Get rid of bad TCP packets
iptables -A OUTPUT -p tcp ! --syn -m state --state NEW -j LOG --log-prefix "New not syn:"
iptables -A OUTPUT -p tcp ! --syn -m state --state NEW -j DROP
# Allow ourself to send packets not spoofed everywhere
iptables -A OUTPUT -p ALL -o $LO_IFACE -s $LO_IP -j ACCEPT
iptables -A OUTPUT -p ALL -o $LAN_IFACE -s $LAN_IP -j ACCEPT
iptables -A OUTPUT -p ALL -o $INET_IFACE -s $INET_IP -j ACCEPT
iptables -A OUTPUT -p ALL -o $LO_IFACE -s $LO_IP -j ACCEPT
iptables -A OUTPUT -p ALL -o $LAN_IFACE -s $LAN_IP -j ACCEPT
iptables -A OUTPUT -p ALL -o $INET_IFACE -s $INET_IP -j ACCEPT
# Logging rule
iptables -A OUTPUT -m limit --limit 3/minute --limit-burst 3 -j LOG --log-level DEBUG --log-prefix "IPT OUTPUT packet died: "
#-----End script------#
iptables -A OUTPUT -m limit --limit 3/minute --limit-burst 3 -j LOG --log-level DEBUG --log-prefix "IPT OUTPUT packet died: "
#-----End script------#



9:02 PM
Computer !