In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
Original security
[root@localhost~]# vi /etc/iptables_settings.sh
#################################################################
#!/ bin/sh -e
#----------------------------------------------------------
# iptables settings
#----------------------------------------------------------
#Connection IP address
SSH_IP1="192.168.1.0/24"
SSH_IP2="192.168.2.0/24"
SNMP_IP1="10.10.1.1"
SNMP_IP2="10.10.2.1"
#----------------------Standard part---------------------------
# Stop iptables service first
#service iptables stop
/sbin/iptables -F
/sbin/iptables -X
/sbin/iptables -Z
# Inital chains default policy
/sbin/iptables -F -t filter
/sbin/iptables -P INPUT DROP
/sbin/iptables -P OUTPUT ACCEPT
# Enable Native Network Transfer
/sbin/iptables -A INPUT -i lo -j ACCEPT
# Accept Established Connections
/sbin/iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# ICMP Control
/sbin/iptables -A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT
# SSH Service
/sbin/iptables -A INPUT -s $SSH_IP1 -p tcp --dport 22 -j ACCEPT
/sbin/iptables -A INPUT -s $SSH_IP2 -p tcp --dport 22 -j ACCEPT
# SNMP Service
/sbin/iptables -A INPUT -s $SNMP_IP1 -p udp --dport 161 -j ACCEPT
/sbin/iptables -A INPUT -s $SNMP_IP2 -p udp --dport 161 -j ACCEPT
#-----------------------Custom part-----------------------
# Name Service
/sbin/iptables -A INPUT -p tcp --dport 53 -j ACCEPT
/sbin/iptables -A INPUT -p udp --dport 53 -j ACCEPT
Add custom content here
#deny all Service
/sbin/iptables -A INPUT -j REJECT --reject-with icmp-host-prohibited
/sbin/iptables -A FORWARD -j REJECT --reject-with icmp-host-prohibited
#################################################################
[root@localhost~]# chmod +x /etc/iptables_settings.sh
[root@localhost~]# echo "/etc/iptables_settings.sh">>/etc/rc.local
[root@localhost~]# chkconfig iptables off
[root@localhost~]# service iptables stop
[root@localhost~]# /etc/iptables_settings.sh
[root@localhost~]# iptables -L
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.