Linux firewall configuration and reject cause no effective issue

Source: Internet
Author: User

1. Go to/etc/sysconfig

2. Use the VI command to edit the iptables. " VI iptables ", and then show

# Firewall configuration written by system-config-firewall# Manual customization of this file is not recommended.*filter:i Nput Accept [0:0]:forward Accept [0:0]:output Accept [0:0]-a input-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 -j REJEC T--reject-with icmp-host-prohibited-a forward-j reject--reject-with icmp-host-prohibitedcommit

3. Add MySQL port 3306, here we need to pay attention to this line of command

-A input-j REJECT--reject-with icmp-host-prohibited, this line has rejected the command of the other ports, if we add the newly inserted
Open ports are not enabled after this line of command is placed, and subsequent configuration of the open ports.
# Firewall configuration written by system-config-firewall# Manual customization of this file is not recommended.*filter:i Nput Accept [0:0]:forward Accept [0:0]:output Accept [0:0]-a input-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 s Tate--state new-m tcp-p tcp--dport 3306-j ACCEPT-A input-j REJECT--reject-with icmp-host-prohibited-a FORWARD -j REJECT--reject-with Icmp-host-prohibitedcommit

4. Then call the service iptables Resatar command
, the display represents success.

[Email protected] sysconfig]# service iptables restartiptables:setting chains to policy Accept:filter          [  ok
    
     ]iptables:flushing firewall rules:                         [  OK  ]iptables:unloading modules:                               [  OK  ]iptables: Applying firewall rules:                         [  OK  ]
    

Linux firewall configuration and reject cause no effective issue

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.