If you need both TCP and UDP for these ports:
sudo ufw allow from 192.168.0.0/24 to any port 22
If you only need TCP (e.g., for SSH-style or custom services):
sudo ufw allow from 192.168.0.0/24 to any port 22 proto tcp
Verify and enable
sudo ufw status numbered
sudo ufw enable
Related