Set iptables for security

Source: Internet
Author: User
I have written an article "iptables details about Cainiao breakthrough". I should be able to understand iptables. But in daily work, you should be careful when setting this, or else you will block yourself out of the door. How can I securely set iptables? First, prepare a script to clear or back up iptables. In crontab or screen, I wrote an article titled iptables details about Cainiao breakthrough. IptablesHave some knowledge of it.
But in daily work, you should be careful when setting this, or else you will block yourself out of the door.
How can I securely set iptables?
First, prepare a script to clear or back up iptables. Put it in crontab or screen for scheduled execution.
For example, the/home/pooy/iptables. clear File

The script is as follows:
#! /Bin/sh
# IPTables Location-adjust if needed
EPT = "/sbin/iptables"
IPTS = "/sbin/iptables-save"
IPTR = "/sbin/iptables-restore"
####################################
#
# Flush Any Existing Rules or Chains
#
Echo "Flushing Tables ..."
# Reset Default Policies
$ Ipt-p INPUT ACCEPT
$ Ipt-p FORWARD ACCEPT
$ Ipt-p OUTPUT ACCEPT
$ Ipt-t nat-P PREROUTING ACCEPT
$ Ipt-t nat-P POSTROUTING ACCEPT
$ Ipt-t nat-P OUTPUT ACCEPT
$ Ipt-mangle-P PREROUTING ACCEPT
$ Ipt-mangle-P OUTPUT ACCEPT
# Flush all rules
$ Ipt-f
$ Ipt-t nat-F
$ Ipt-t mangle-F
# Erase all non-default chains
$ Ipt-x
$ Ipt-t nat-X
$ Ipt-t mangle-X
Echo "Done ."
If I put it in crontab, I will execute it once in ten minutes!
*/10 */home/stef/iptables. clear>/dev/null
Then I began to write my iptables rules, so I was not afraid of being rejected by "accidents. Hey ~

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.