网络安全--iptables防火墙初级配置----纯属笔记
###################################################################
命令iptales
配置文件 /etc/sysconfig/iptables
命令iptables-save
grep http /etc/services -----查看http服务的端口号
####################
######################################
简单配置防火墙为对外只开放 ssh--22端口 和 http 80端口
思想:默认全部设置百威drop,accept端口设置为22 ,80
# iptables -F ----------F flush 清除默认设置
# iptables -A INPUT -p tcp -d 10.10.10.100 --dport 22 -j ACCEPT -------注意大小写,A---增加
append------p 协议,proto------d,目的ip,destination
# iptables -A OUTPUT -p tcp -s 10.10.10.100 --sport 22 -j ACCEPT -------s souse,源地址
---------------SSH 20端口设置,保证putty可以连接
###################
# iptables -P INPUT DROP
# iptables -P OUTPUT DROP
# iptables -P FORWARD DROP
----------------把iptables默认设置设置为丢弃
###################
# iptables -A INPUT -p tcp -d 10.10.10.100 --dport 80 -j ACCEPT
# iptables -A OUTPUT -p tcp -s 10.10.10.100 --sport 80 -j ACCEPT
-----------------对外开放80端口
####################
# service iptables save
# iptables-save > /etc/syscnofig/iptables
-----------------两条命令任选其一,保存编辑的iptables配置
转载于:https://blog.51cto.com/winewyy/499580