作者:仲颖凯翰奕颖 | 来源:互联网 | 2017-11-08 15:25
文章标题:Linux系统Iptables的常用防火墙配置方法。Linux是中国IT实验室的一个技术频道。包含桌面应用,Linux系统管理,内核研究,嵌入式系统和开源等一些基本分类
Iptables的常用防火墙配置
本脚本环境为eth0外网,eth1内网;
#!/bin/sh
#外网网卡
EXT_IF="eth0"
FW_IP="61.137.85.21"
#内网网卡
INT_IF="eth1"
LAN_IP="192.168.0.1"
LAN_IP_RANGE="192.168.0.0/255.255.255.0"
#加阅模块,一般已内建
#Module loading.
#echo "modprobe modules"
#modprode ip_tables
#modprode ip_nat_ftp
#modprode ip_conntrack
#modprobe ip_conntrack_ftp
#启用转发(forward)功能
echo "enabling IP FORWARDING……"
echo "1" >; /proc/sys/net/ipv4/ip_forward
#规则初始化,设置默认都为drop
echo "enabling iptables rules"
#reset the default policies in the tables
iptables -F
iptables -X
iptables -F -t mangle
iptables -X -t mangle
iptables -F -t nat
iptables -X -t nat
iptables -Z -t nat
#set policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
###——###
[1] [2] [3] [4] [5] 下一页