How to enable port and port 80 of iptables firewall

Source: Internet
Author: User
Iptables-F # Allow packets from port 22 to enter iptables-AINPUT-ptcp -- dport22-jACCEPT # Allow packets from port 22 to return iptables-AOUTPUT-ptcp -- sport22-mstate -- stateESTABLISHED-jACCEPTiptables-AOUTPUT- pudp -- dp

Iptables-F
# Allow package entry from port 22
Iptables-a input-p tcp -- dport 22-j ACCEPT
# Return of packets allowed to enter from port 22
Iptables-a output-p tcp -- sport 22-m state -- state ESTABLISHED-j ACCEPT
Iptables-a output-p udp -- dport 53-j ACCEPT
Iptables-a input-p udp -- sport 53-j ACCEPT
# Allow local access to the local machine
Iptables-a input-s 127.0.0.1-d 127.0.0.1-j ACCEPT
Iptables-a output-s 127.0.0.1-d 127.0.0.1-j ACCEPT
# Allow all IP addresses to access port 80
Iptables-I INPUT-p tcp -- dport 80-j ACCEPT
Iptables-a output-p tcp -- sport 80-m state -- state ESTABLISHED-j ACCEPT
# Save configuration
Iptables-save>/etc/sysconfig/iptables
Iptables-restore </etc/sysconfig/iptables
Iptables-L

Iptables-save only lists the current settings, rather than saving the configuration
If you are using the RedHat series, use service iptables save to save and use chkconfig iptableson to enable startup.
If it is not a RedHat series, you can use the following method to manually save/restore the configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.