Linux firewall plus white list __linux

Source: Internet
Author: User

Install yum install iptables-services on Linux systems

Then Vi/etc/sysconfig/iptables


# generated by Iptables-save v1.4.7 on Sun Aug 28 12:14:02 2016
*filter
: INPUT ACCEPT [0:0]
: FORWARD ACCEPT [0:0]
: OUTPUT ACCEPT [0:0]


-N Whitelist
-A whitelist-s 8.8.8.8-j ACCEPT
-A whitelist-s x.x.x.x-j ACCEPT

-A whitelist-s x.x.x.x-j ACCEPT

-A whitelist-s x.x.x.x-j ACCEPT

-A whitelist-s x.x.x.x-j ACCEPT

-A whitelist-s x.x.x.x-j ACCEPT
-A input-m state--state related,established-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 Whitelist
-A input-m state--state new-m tcp-p TCP--dport 80-j Whitelist
-A input-m state--state new-m tcp-p TCP--dport 443-j Whitelist
-A input-m state--state new-m tcp-p TCP--dport 25-j Whitelist
-A input-j REJECT--reject-with icmp-host-prohibited
-A forward-j REJECT--reject-with icmp-host-prohibited

COMMIT


Top is the list of IP lists of whitelist

Below are some ports that are open for the contents of the whitelist

Write the accept on the top.

Write the contents of the reject down below.

So the white list of IP can access our restricted ports and services, and not in the whitelist IP will be rejected.

-A input-m state--state new-m tcp-p TCP--dport 22-j Whitelist This is for the white list of ports open, that is, only white list of IP can access through this port.

-A input-m State--state new-m tcp-p TCP--dport 22-j This is all white open, that is, any machine can access through this 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.