Linux Firewall Open port

Source: Internet
Author: User

1. Use the command to view port opening (no firewall is selected for installation)

[Email protected] ~]# iptables-l-nchain INPUT (policy ACCEPT) target     prot opt source               destination         Chain FORWARD (policy accept) target     prot opt source               destination         Chain OUTPUT (policy accept) target     prot opt SOURCE               

2. Clear firewall rules (existing rules may not be performed)

[Email protected] ~]# iptables-F        ~]# iptables-X        #清除预设表filter中使用者自定链中的规则 [[Email protected]< /c11>~]#/etc/rc.d/init.d/iptables Save   #保存以后下次重启才会开启
[Email protected] ~]# service iptables restart

3. Setting up firewall rules

[Email protected] ~]# iptables-~]# iptables-~]# iptables-p FORWARD DROP

This definition is to indicate that all requests that exceed the iptables two chain rule (input and forward) rules are discarded, and requests that exceed the output rules are acceptable, that is, control input, arbitrary output.

4. Add a rule

 - -j ACCEPT
[email protected]~]# /etc/rc.d/init.d/iptables Save

This adds a 80 port TCP connection to input and output, and finally does not forget to save

Linux Firewall Open port

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.