以前的脚本是用save模式,现在把命令附加到一个文件里面,这样的话,可以方便的二次修改什么的
脚本基本是这样的,大家可以跟自己的情况再次修改~ 增加功能什么的。
复制代码 代码如下:
#!/bin/bash
while true
do
clear
echo "----------------------menu----------------------"
echo "(1) service iptables restart"
echo "(2) iptables add"
echo "(3) iptables delete"
echo "(4) iptables stop"
echo "(5) iptables save(不推荐使用这种模式)"
echo "(6) iptables status"
echo "(7) iptables ACL list"
echo "(0) exit"
echo "会在当前的目录下生成一个fw.sh文件"
echo "-------------------------------------------------"
echo -n "enter you chose[0-7]:"
read num
if [ ${num} -lt 0 -o ${num} -gt 7 ]
then
echo "this is not between 0-7"
else
if [ "${num}" == "1" ]
then
service iptables restart&
else
if [ "${num}" == "2" ]
#######################################################
then
while [ "1" == "1" ]
do
clear
echo "----------------------add ACL----------------------"
echo "(1) 针对源IP放行添加"
echo "(2) 针对服务器端口放行添加"
echo "(3) 针对有端口和服务的ACL添加(这里要参数IP和端口 例如 0/0 80)"
echo "(4) 自定义添加"
echo "(5) 退回上一级"
echo "-------------------------------------------------"
echo -n "enter you chose[0-4]:"
read aclnum
if [ "${aclnum}" == "1" ]
then
read ip
iptables -A INPUT -s ${ip} -p tcp --dport 22 -j ACCEPT
echo "iptables -A INPUT -s ${ip} -p tcp --dport 22 -j ACCEPT" fw.sh
# service iptables save
elif [ "${aclnum}" == "2" ]
then
rad ip
iptables -A INPUT -p tcp --dport ${IP} -j ACCEPT
echo "iptables -A INPUT -p tcp --dport ${IP} -j ACCEPT" fw.sh
# service iptables save
elif [ "${aclnum}" == "3" ]
then
read ip port
iptables -A INPUT -p tcp -s ${ip} --dport ${port} -j ACCEPT
echo "iptables -A INPUT -p tcp -s ${ip} --dport ${port} -j ACCEPT" fw.sh
# service iptables save
elif [ "${aclnum}" == "4" ]
then
read addacl
`${addacl}`
service iptables save
else
break
fi
echo -n "是否想继续添加: [y/n]:"
read contine
if [ "${contine}" == "n" -o "${contine}" == "N" ]
then
break
fi
done
#######################################################
else
if [ "${num}" == "3" ]
then
while [ "1" == "1" ]
do
clear
echo "---------------------delete ACL----------------------"
echo "(1) 针对源ip删除"
echo "(2) 针对端口删除"
echo "(3) 针对有端口和服务的ACL删除"
echo "(4) 自定义删除"
echo "(5) 退回上一级"
echo "-------------------------------------------------"
echo -n "enter you chose[0-5]:"
read aclnum
if [ "${aclnum}" == "1" ]
then
read ip
iptables -D INPUT -s ${ip} -p tcp --dport 22 -j ACCEPT
echo "iptables -D INPUT -s ${ip} -p tcp --dport 22 -j ACCEPT" fw.sh
# service iptables save
elif [ "${aclnum}" == "2" ]
then
read port
iptables -D INPUT -p tcp --dport ${port} -j ACCEPT
echo "iptables -D INPUT -p tcp --dport ${port} -j ACCEPT" fw.sh
# service iptables save
elif [ "${aclnum}" == "3" ]
then
read ip port
iptables -D INPUT -p tcp -s ${ip} --dport ${port} -j ACCEPT
echo "iptables -D INPUT -p tcp -s ${ip} --dport ${port} -j ACCEPT" fw.sh
# service iptables save
elif [ "${aclnum}" == "4" ]
then
read deleteacl
`${deleteacl}`
service iptables save
else
break
fi
echo -n "是否想继续添加: [y/n]:"
read contine
if [ "${contine}" == "n" -o "${contine}" == "N" ]
then
break
fi
done
###################################################################
else
if [ "${num}" == "4" ]
then
echo -e "`service iptables stop&` "
else
if [ "${num}" == "5" ]
then
echo -e "`service iptables save&`"
else
if [ "${num}" == "6" ]
then
echo -e "`service iptables status&`"
else
if [ "${num}" == "7" ]
then
while [ "1" == "1" ]
do
clear
echo "---------------------list ACL----------------------"
echo "(1) 查看当前正在使用的规则集"
echo "(2) 查看每个策略或每条规则、每条链的简单流量统计"
echo "(3) 查看NAT表"
echo "(4) 自定义查看"
echo "(5) 退回上一级"
echo "-------------------------------------------------"
echo -n "enter you chose[0-5]:"
read aclnum
if [ "${aclnum}" == "1" ]
then
iptables -L
elif [ "${aclnum}" == "2" ]
then
iptables -L -n -v
elif [ "${aclnum}" == "3" ]
then
iptables -L -t nat
elif [ "${aclnum}" == "4" ]
then
read listacl
`${listacl}`
else
break
fi
echo -n "是否想继续添加: [y/n]:"
read contine
if [ "${contine}" == "n" -o "${contine}" == "N" ]
then
break
fi
done
################################################
else
exit
fi
fi
fi
fi
fi
fi
fi
fi
echo -n "Do you contine [y/n]:"
read contine
if [ "${contine}" == "n" -o "${contine}" == "N" ]
then
exit
fi
done
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
- 雨林唱片《赏》新曲+精选集SACD版[ISO][2.3G]
- 罗大佑与OK男女合唱团.1995-再会吧!素兰【音乐工厂】【WAV+CUE】
- 草蜢.1993-宝贝对不起(国)【宝丽金】【WAV+CUE】
- 杨培安.2009-抒·情(EP)【擎天娱乐】【WAV+CUE】
- 周慧敏《EndlessDream》[WAV+CUE]
- 彭芳《纯色角3》2007[WAV+CUE]
- 江志丰2008-今生为你[豪记][WAV+CUE]
- 罗大佑1994《恋曲2000》音乐工厂[WAV+CUE][1G]
- 群星《一首歌一个故事》赵英俊某些作品重唱企划[FLAC分轨][1G]
- 群星《网易云英文歌曲播放量TOP100》[MP3][1G]
- 方大同.2024-梦想家TheDreamer【赋音乐】【FLAC分轨】
- 李慧珍.2007-爱死了【华谊兄弟】【WAV+CUE】
- 王大文.2019-国际太空站【环球】【FLAC分轨】
- 群星《2022超好听的十倍音质网络歌曲(163)》U盘音乐[WAV分轨][1.1G]
- 童丽《啼笑姻缘》头版限量编号24K金碟[低速原抓WAV+CUE][1.1G]