Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Write an article for LinuxForums Today! Win Great Prizes!
Hi
I wrote a firewall for my router (see below)... But because I'm a linux noob I'm not fully convinced of the firewall itself. Please take some time to read it and if you know something I need to add or remove... please reply
#icmp rules
iptables -A INPUT -i $EXT -p icmp --icmp-type 8 -j DROP
iptables -A FORWARD -i $EXT -p icmp --icmp-type 8 -j DROP
iptables -A OUTPUT -o $EXT -p icmp --icmp-type 8 -j ACCEPT
#Forward all packets from eth1 (internal network) to eth0 (the internet).
iptables -A FORWARD -i $INT -o $EXT -j ACCEPT
#Forward packets that are part of existing and related connections from eth0 to eth1.
iptables -A FORWARD -i $EXT -o $INT -m state --state ESTABLISHED,RELATED -j ACCEPT
#Permit packets in to firewall itself that are part of existing and related connections.
iptables -A INPUT -i $EXT -m state --state ESTABLISHED,RELATED -j ACCEPT
#Allow all inputs to firewall from the internal network and local interfaces
iptables -A INPUT -i $INT -s 0/0 -d 0/0 -j ACCEPT
iptables -A INPUT -i lo -s 0/0 -d 0/0 -j ACCEPT
#Accept all tcp SYN packets for protocol SSH
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port 22 --syn -j ACCEPT
#For DHCP server
iptables -A INPUT -i $INT -p tcp --sport 68 --dport 67 -j ACCEPT
iptables -A INPUT -i $INT -p udp --sport 68 --dport 67 -j ACCEPT
iptables -A INPUT -i $EXT -p tcp --sport 68 --dport 67 -j DROP
iptables -A INPUT -i $EXT -p udp --sport 68 --dport 67 -j DROP
#For DNS server
iptables -A INPUT -i $INT -p tcp --sport 53 --dport 53 -j ACCEPT
iptables -A INPUT -i $INT -p udp --sport 53 --dport 53 -j ACCEPT
iptables -A INPUT -i $EXT -p tcp --sport 53 --dport 53 -j DROP
iptables -A INPUT -i $EXT -p udp --sport 53 --dport 53 -j DROP
#extra
iptables -A INPUT -s 0/0 -d 0/0 -p udp -j DROP
iptables -A INPUT -s 0/0 -d 0/0 -p tcp --syn -j DROP
Open Source Security Myths Dispelled Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization subscribe
InformationWeek InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology. subscribe