39 lines
1.2 KiB
Markdown
39 lines
1.2 KiB
Markdown
# firewalld 简便小工具
|
||
> firewall 自带的命令比较难记,往往只想简单地开放一个端口,却需要查文档查百度
|
||
本工具诣在简化防火墙端口的开放与关闭
|
||
例如,firewalld自带开放端口命令:
|
||
```bash
|
||
firewall-cmd --zone=public --add-port=12345/tcp --permanent
|
||
```
|
||
安装本工具后,只需要执行:
|
||
```bash
|
||
fwd -a 12345
|
||
```
|
||
**更多简便操作请看命令使用说明**
|
||
|
||
## 安装命令
|
||
|
||
```bash
|
||
wget -O /usr/bin/fwd https://mirror.liuyan.wang/shell/fwd.sh && chmod +x /usr/bin/fwd
|
||
```
|
||
|
||
## 使用方法
|
||
```bash
|
||
$fwd -h
|
||
Usage:
|
||
fwd [options]
|
||
|
||
Options:
|
||
-a, --add open a tcp port #增加tcp端口
|
||
-au, --add-udp open a udp port #增加udp端口
|
||
-r, --remove close a tcp port #关闭tcp端口
|
||
-ru, --remove-udp close a udp port #关闭udp端口
|
||
-l, --list show opened ports #展示已开放列表
|
||
start, start firewalld #开启firewalld
|
||
stop, stop firewalld #关闭firewalld
|
||
status, see if started #查看firewalld装态
|
||
update, update this command #升级
|
||
-v, --version show version of local and remote #查看版本
|
||
-h, --help display this help and exit #查看帮助
|
||
|
||
``` |