Isolate NAS from internet but keep it with LAN access in Linux system

I have a network attached storage (NAS) that connects to two different Wi-Fi networks, depending on its location (it is not anchored always in the same place). Normally, these Wi-Fi networks provide internet access to the computers connected to them. I cannot modify the settings of the Wi-Fi networks. For security reasons, I would like to configure the NAS such that

  1. it completely rejects any internet connection in both directions, no matter which Wi-Fi network it connects to, and
  2. it remains accessible from the Wi-Fi LAN.

The idea is that only computers directly connected to the Wi-Fi can access the NAS.

Is this possible? What is the best way to do it? I am not very knowledgeable about networks, so sorry if this is something that may be trivial.