iptables firewall specified port range in Linux

Source: Internet
Author: User

I need a port between 700 and 800 to have TCP access

Code to copy code as follows
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 700-j ACCEPT
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 701-j ACCEPT
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 702-j ACCEPT
...
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 800-j ACCEPT

This is very pit Father Ah, (Www.111cn.net) will have a better solution, below we look

Code to copy code as follows
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 700:800-j ACCEPT

This will be done, a sentence on it, the following a few more words iptables firewall some rules.

One, 700:800 represents all ports between 700 and 800

Ii.: 800 means all ports 800 and below

Three, 700: Indicates 700 and above all ports


We can take a look at the examples

Code to copy code as follows
One,-a rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 7979:9898-j ACCEPT

Access 9898 Normal
From:http://www.111cn.net/sys/linux/45525.htm

iptables firewall specified port range in Linux

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.