Linux down to open port

Source: Internet
Author: User

First, I'd like to recommend a blog post here.

http://blog.csdn.net/zht666/article/details/17505789

This article is written in very detailed, contains the operation of the port some commands, we operate the port is actually operation iptables this file.

1. View Port

Iptables-l-N

2. Add Port

Iptables-a input-p TCP--dport 22-j ACCEPT

Note: INPUT is a group of its own, according to the actual system configuration to fill in.

Here we recommend an article:

Http://www.zybang.com/question/b0b8264a278253054b96aa87426dba1b.html

The same Add statement I choose the following sentence:

Iptables-a input-p tcp-m State--state new-m TCP--dport 22-j ACCEPT

In my actual system I changed to this:

Iptables-a in_public_allow-p tcp-m State--state new-m TCP--dport 22-j ACCEPT

3. Delete Port

To delete a port first check the NUM number by using the following statement:

Iptables-l-N--line-number

Num Target prot opt source destination
1 DROP TCP--0.0.0.0/0 0.0.0.0/0 TCP dpt:3306
2 DROP TCP--0.0.0.0/0 0.0.0.0/0 TCP dpt:21
3 DROP TCP--0.0.0.0/0 0.0.0.0/0 TCP dpt:80

See the first column of NUM, use this number to delete;

iptables-d INPUT 1

Executing the above statement removes the NUM number 3306 port number.

Linux down to 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.