The strange problem of setting up firewalls with iptables on CentOS

Source: Internet
Author: User
Tags couchbase ssh centos iptables firewall linux

Server environment: Ali Server, Linux CentOS operating system, Couchbase server

Start security policy: Deny all by default, allow only required

Action command:

Allow inbound SSH connections

Iptables-a input-p TCP--dport 22-m State--state New,established-j

Allow inbound 8092-port access for eth0 network adapters

Iptables-a input-i eth0-p tcp-m tcp--dport 8092-j ACCEPT

Deny all other inbound connections

Iptables-p INPUT DROP

Save Rule to/etc/sysconfig/iptables

Service Iptables Save

Start the firewall and let it run

Chkconfig--level 345 iptables on

After this operation, the security policy takes effect, but the client ssh is found to be connected to the server, but the speed of the connection is significantly slower and the Couchbase server does not start properly.

Later, change the firewall security policy, instead of tacitly allow all, only reject the required, problem resolution. The operation commands are as follows:

Iptables-p INPUT ACCEPT
iptables-a input-i eth1-p tcp-m tcp--dport 8092-j DROP
service iptables save
Ch Kconfig--level 345 iptables on

Update:

Thanks to Sumtec, the reason that the SSH connection is slow is caused by the-m state--state new,established.

This column more highlights: http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/

Related Article

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.