Using iptables


Iptables is a command line utility for configuring the Linux kernel firewall. The term iptables is also commonly used to refer to such a kernel firewall. Can be configured directly with iptables, or using one of the many existing console and graphics frontend

THE MOST COMMON IPTABLES ARE:


BLOCK A PORT: In this example, port 111 is blocked

  iptables -A INPUT -p udp -m tcp –dport -j DROP


ALLOW AN IP In this example all requests from ip 127.0.0.1 are accepted

  iptables -I INPUT -s 127.0.0.1/30 -j ACCEPT


OPEN A PORT

  iptables -A INPUT -p tcp –dport 22 -j ACCEPT

PERMITIR UN RANGO DE IP en esta opcion hay dos formas de hacerlo, la primera es solo si deseas permitir un rango de ip (como los de 162.168.10.20 hasta la ip 192.168.10.80), la segunda es por segmentos colocando /24 en esta opcion hay que tomar en cuenta que /24 permite un rango de 254 host.

  iptables -A INPUT -i eth1 -m iprange –src-range 162.168.10.20-80 -j ACCEPT
  iptables -A INPUT -i eth1 -s 10.50.0.0/16 -j ACCEPT


BLOQUEAR TODOS LOS PUERTOS EXCEPTO

  iptables -A INPUT -p tcp -m tcp -m multiport! –Dports 80,443,22,25 -j DROP
Previous Install Zabbix
Next DNS zone management

No Comment

Leave a reply

Your email address will not be published. Required fields are marked *