Tag: 53

Iptables firewall open the port 22,53 and 80

Posted by on 2009-04-30


Iptables firewall useless for a long time, and yesterday, a simple tune
This print is what I use command "history", I am lazy,ha ha

365 iptables -F
366 iptables -A INPUT -p tcp --dport 22 -j ACCEPT /*Packet from port 22 to allow access to*/
367 iptables -A OUTPUT -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT /*Allowed to enter the port from 22 to return to the package*/
368 iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
369 iptables -A INPUT -p udp --sport 53 -j ACCEPT
370 iptables -A INPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT /*Allowed localhost access to itself*/
371 iptables -A OUTPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
372 iptables -A INPUT -p tcp -s 0/0 --dport 80 -j ACCEPT /*Allowed all ip access to the port 80 of localhost*/
373 iptables -A OUTPUT -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
374 iptables-save > /etc/sysconfig/iptables /*Save config now*/
375 iptables -L