Edit/etc/rc. local and enter the following content :#! /Bin/sh # Thisscriptwillbeexecuted * after * alltheotherinitscripts. # Youcanputyourowninitializationstuffinhereifyoudont # wanttodothefullSysVst
Edit/etc/rc. local and enter the following content:
#! /Bin/sh
#
# This script will be executed * after * all the other init scripts.
# You can put your own initialization stuff in here if you don't
# Want to do the full Sys V style init stuff.
Touch/var/lock/subsys/local
# StartMemcached
/Usr/local/bin/memcached-d-m-u root-p-c-P/tmp/memcached. pid
# Configuring a firewall
/Sbin/Iptables-F
/Sbin/iptables-X
/Sbin/iptables-Z
/Sbin/modprobe ip_tables
/Sbin/modprobe iptable_nat
/Sbin/modprobe ip_nat_ftp
#/Sbin/modprobe ip_conntrack
/Sbin/iptables-P INPUT DROP
/Sbin/iptables-P FORWARD ACCEPT
/Sbin/iptables-P OUTPUT ACCEPT
# Up to 100 new connections are allowed per second
/Sbin/iptables-a input-f-m limit -- limit/sec -- limit-burst-j ACCEPT
# Prevent ping flood attacks. The maximum number of ping packets per second is 10.
/Sbin/iptables-a forward-p icmp -- icmp-type echo-request-m limit -- limit/s -- limit-burst-j ACCEPT
# Prevent various port scans and limit SYN and ack syn to no more than 200 per second, so as not to exhaust the bandwidth of the server
/Sbin/iptables-a input-p tcp-m tcp -- tcp-flags SYN, RST, ack syn-m limit -- limit/sec -- limit-burst-j ACCEPT
# Open access to a specified host, such as the IP address of the host for Intrusion Detection
#/Sbin/iptables-a input-s 122.70.x.x-j ACCEPT
# Loop data must be released
/Sbin/iptables-a input-I lo-j ACCEPT
/Sbin/iptables-a output-o lo-j ACCEPT
# Self-sent users can collect
/Sbin/iptables-a input-m state -- state ESTABLISHED, RELATED-j ACCEPT
# Open ports 80 and 22. do not explain/sbin/iptables-a input-p tcp-m multiport -- dport 80, 22-j ACCEPT
If the test fails to run automatically, you need to create a soft link:
Ln-s/etc/rc. local/etc/rc3.d/S99rc. local