iptables
Hi there, i am new to iptables and i need to find out how to implement following rules:
setup default policies of DROP for the input chain and REJECT for the other 2 default chains. ii) allow any input/output traffic over the loopback interface ie lo iii) deny any incoming packets claiming to be from your IP address and log them iv) deny any packets from/to the following networks and log them class A 10.0.0.0 NB class A networks have an 8-bit netmask class B 72.16.0.0 NB class B networks have a 16-bit netmask Class D 224.0.0.0 with a 4 bit netmask Class E 240.0.0.0 with a 5 bit netmask v) deny incoming/outgoing packets on eth0 which have an address of 127.0.0.1 and log them Thanks for any help. |
This site has a policy against doing people's homework problems.
iptables is the program that sets up netfilters tables. There is documentation at the netfilter homepage: http://www.netfilter.org/ |
Also check in /usr/share/doc/packages/iptables/packet-filtering-HOWTO.html. This directory may also contain documentation on NAT.
|
This should work for you.
Quote:
iptables -X iptables -N LOG_DROP #Default policies.. iptables -P INPUT DROP iptables -P FORWARD DROP iptables -P OUTPUT ACCEPT Quote:
iptables -A INPUT -i eth0 -s 10.0.0.0/8 -j LOG_DROP iptables -A INPUT -i eth0 -s 224.0.0.0/4 -j LOG_DROP iptables -A INPUT -i eth0 -s 240.0.0.0/5 -j LOG_DROP iptables -A INPUT -i eth0 -s 172.16.0.0/12 -j LOG_DROP #Drop them... iptables -A INPUT -i eth0 -s 10.0.0.0/8 -j DROP iptables -A INPUT -i eth0 -s 224.0.0.0/4 -j DROP iptables -A INPUT -i eth0 -s 240.0.0.0/5 -j DROP iptables -A INPUT -i eth0 -s 172.16.0.0/12 -j DROP Quote:
iptables -A INPUT -i lo -j ACCEPT # Rules for logging packets. iptables -A LOG_DROP -j LOG --log-prefix "[IPTABLES DROP] : " --log-tcp-options --log-ip-options --log-level 3 Edit your syslog.conf file by adding these two lines... # Log rc.firewall packets. kern.3 /var/log/firewall Restart syslogd and your done. |
Thank you Linux~Powered so much. I really appreciate your help.
|
All times are GMT -5. The time now is 11:51 PM. |