I think you would need a router that is not connected to the internet. I think that would not be hard to do. In my case, it would mean unplugging the ethernet cable from the router.
Are you asking how to have your iMac on the same Wi-Fi network as other computers that do access the internet? I think that would be difficult. (@JoeP’s solution of blocking the MAC address had not occurred to me.)
In my situation, in case it helps, I have two networks, one Wi-Fi and one ethernet. The computers and other devices are connected to ethernet all the time, and the ethernet router is not connected to the internet. I have not enabled file or screen sharing, but I would expect them to work, just as I can access the devices on the ethernet network. When I want to access the internet, I turn Wi-Fi on. Having both Wi-Fi and ethernet active is not a problem.
I think Airdrop uses Bluetooth for discovery and an ad hoc WiFi network for point-to-point data transfer. Having the WiFi radio enabled but not configured with an IP would work in this situation.
File sharing (e.g. SMB/CIFS), I believe needs to have the interface configured in advance.
Not having the default gateway field populated (or setting it to 0.0.0.0 if necessary) would mean that the interface would only communicate on the local LAN and would not know how to get outside the LAN. Configuring the interface this way would need to be done manually since DHCP autoconfig would fill in the router/gateway info.
Yes. And as @bb1 wrote, you only need to have the interface enabled. You don’t need to actually be connected to any wireless LAN for AirDrop to work.
Which is good, but it’s still annoying that AirDrop won’t work over wired Ethernet, even when that Ethernet connects to the same router running my Wi-Fi. Oh well.
You could try Blip as an AirDrop alternative. The Macs in College have WiFi/Bluetooth disabled and connect via Ethernet. Students use Blip to send/receive files via WiFi from personal laptops and phones.
Hm Maybe that was what I was thinking of. In that case, the WiFi symbol will be gray?
Out of long habit, I am switching WiFi on then selecting the network. So, ok, hm, think I got it. Switch it on, look for following symbols, and carry on…
The Status Bar Symbol then, will be the wave pattern with line thru it for off; gray symbol for on but not connected to internet (?) and thus capable of local wifi networking (?) and solid symbol for on and connected to the Internet (?).
I used to keep an old iMac on that was attache to three film scanners. I needed it on the LAN to copy scans to my NAS, but I didn’t want the internet polluting it as it was stuck at Lion. I set the subnet mask to 0.0.0.0, and I think that worked.