放行封锁port和ip脚本
标题放行封锁port和ip脚本
#!/bin/bashecho "
1.放行的端口
2.封锁的端口
3.放行ip
4.封锁ip
"
read -ep "请选择你的操作:" menucase $menu in
1)
while true;
do
read -ep "请输入要放行的端口:" port
iptables -I INPUT -p tcp --dport $port -j ACCEPT
iptables -I INPUT -p tcp --dport $port -j ACCEPT
echo "$port放行成功"
break
done
;
;
2)
while true;
do
read -ep "请输入要封锁的端口:" port
iptables -I INPUT -p tcp --dport $port -j REJECT
iptables -I INPUT -p tcp --dport $port -j REJECT
echo "$port封锁成功"
break
done
;
;
3)
while true;
do
read -ep "请输入要放行ip:" ip
iptables -I INPUT -s $ip -j ACCEPT
echo "$ip放行成功"
break
done
;
;
4)
while true;
do
read -ep "请输入要封锁的ip:" ip
iptables -I INPUT -s $ip -j DROP
echo "$ip封锁成功"
break
done
;
;
*)
echo "输入有误!!!"
esac
推荐阅读
- Spring|Spring Boot之ImportSelector
- 前端|web前端dya07--ES6高级语法的转化&render&vue与webpack&export
- Spring注解05|Spring注解05 @Import 给容器快速导入一个组件
- 026-Catagory-NSString
- 1.2.1
- Figure|Figure 图像
- iOS|iOS MD5加密
- Supported|Supported orientations has no common orientation with the application 解决方案
- iOS|iOS Technical Support For 我欲封神 - 无名小卒修仙记
- jquery导出excel、pdf等[tableExport简单使用]