Linux (CentOS6.5) Open ports, configuring firewalls

Source: Internet
Author: User

1. Open the configuration file

[Root@localhost ~]# vi/etc/sysconfig/iptables 

2. The correct configuration file

# Firewall configuration written by System-config-firewall# Manual Customization of this file are not recommended.*filter:input accept [0:0]: FORWARD ACCEPT [0:0]: OUTPUT ACCEPT [0:0]-A INPUT-< span class= "keyword" >m state–state established,related-j accept-a INPUT -P icmp-j accept-a input-i lo-j accept-a INPUT-m state–state NEW-m tcp-p tcp–dport 22-j accept-a INPUT-m state–state NEW-m tcp-p tcp–dport 80-j accept-a input-j reject–reject-with icmp-host-prohibited-a forward-j reject–reject-with Icmp-host-pro hibited COMMIT              
-A INPUT-state– StateNEW-m tcp-p tcp–dport *-j AC  

3. The newly opened port must be written on the back of Port 22

Restart the firewall for configuration to take effect

[Root@localhost ~]#/etc/init.d/iptables Restart



To view open ports
[Root@localhost ~]#/etc/init.d/iptables status 

Shutting down the firewall

[Root@localhost ~]#/etc/init.d/iptables Stop 

Linux (CentOS6.5) Open ports, configuring firewalls

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.