UFW on Ubuntu to Allow All Traffic on LAN

sudo ufw allow from 192.168.15.0/24

you need to do sudo ufw allow from yourip/24 like this

sudo ufw allow from 192.168.1.0/24 

replace 1 with your ip router.

To allow connections for particular IP addresses ranging from 192.168.1.1 to 192.168.1.254 to port 22 (SSH), run the following command

sudo ufw allow from 192.168.1.0/24 to any port 22