Linux firewall open ports for fixed IP open ports

Source: Internet
Author: User

Edit/etc/sysconfig/iptables, add

- s 127.0.0.1 --dport 6379-J Accept-s 126.212.173.185 --dport 6379-j ACCEPT

The above add red place is only to the local and 126.212.173.185 open 6379 port, other IP with Telnet is not connected,

If there is no limit to access IP, you do not need to add the- s IP address , for example

-A input-m state--state new-m tcp-p TCP--dport 6379-j ACCEPT

Yes, be sure to add it at the end

-A input-j REJECT--reject-with icmp-host-prohibited-A forward-j REJECT --reject-with icmp-host- Prohibitedcommit

Otherwise, the firewall will not work.

Restarting the firewall

   Service Iptables Start

The new firewall rules are well-equipped.

Attached: Full firewall configuration

# Firewall configuration written by system-config-firewall# Manual Customization of Thisfile is not recommended.*filter:input 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 state--state new-m tcp-p TCP--dport 21-J ACCEPT-A input-m state--state new-m tcp-p TCP--dport 20-J Accept#mysql-A input-m state--state new-m tcp-p TCP--dport 3306-J Accept#web Server-A input-m state--state new-m tcp-p TCP--dport 80-J ACCEPT#redis-A input-m state--state new-m tcp-p tcp-s 127.0.0.1--dport 6379-J ACCEPT-A input-j REJECT--reject-with icmp-host-prohibited-A forward-j REJECT--reject-with icmp-host-Prohibitedcommit

Linux firewall open ports for fixed IP open ports

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.