2023-01-12 17:33:50 -05:00
|
|
|
if you dont specify a protocol it allows either tcp/udp
|
|
|
|
|
|
|
|
**ports**
|
|
|
|
```
|
|
|
|
sudo ufw allow 22
|
|
|
|
sudo ufw allow 22/tcp
|
|
|
|
```
|
|
|
|
|
|
|
|
**ranges**
|
|
|
|
```
|
|
|
|
sudo ufw allow 6000:6007/tcp
|
|
|
|
sudo ufw allow 6000:6007/udp
|
|
|
|
```
|
|
|
|
|
|
|
|
**specific ip**
|
|
|
|
```
|
|
|
|
sudo ufw allow from 203.0.113.4
|
|
|
|
sudo ufw allow from 203.0.113.4 to any port 22
|
|
|
|
```
|
|
|
|
|
|
|
|
enable firewall `suod ufw enable`
|
|
|
|
|
|
|
|
|
|
|
|
## inquirey
|
|
|
|
`sudo ufw status numbered`
|
|
|
|
pt@r710:~$ sudo ufw status numbered
|
|
|
|
Status: active
|
|
|
|
|
|
|
|
To Action From
|
|
|
|
-- ------ ----
|
|
|
|
[ 1] 22/tcp ALLOW IN Anywhere
|
|
|
|
[ 2] 5432 ALLOW IN Anywhere
|
|
|
|
[ 3] 5440 ALLOW IN Anywhere
|
|
|
|
[ 4] 10000 ALLOW IN Anywhere
|
|
|
|
[ 5] 443/tcp ALLOW IN Anywhere
|
|
|
|
[ 6] 5433/tcp ALLOW IN Anywhere
|
|
|
|
[ 7] 22/tcp (v6) ALLOW IN Anywhere (v6)
|
|
|
|
[ 8] 5432 (v6) ALLOW IN Anywhere (v6)
|
|
|
|
[ 9] 5440 (v6) ALLOW IN Anywhere (v6)
|
|
|
|
[10] 10000 (v6) ALLOW IN Anywhere (v6)
|
|
|
|
[11] 443/tcp (v6) ALLOW IN Anywhere (v6)
|
|
|
|
[12] 5433/tcp (v6) ALLOW IN Anywhere (v6)
|
|
|
|
|