I think that I tried this some time ago when drives were at the GB level. One approach I considered was to partition the hard drive in to different volumes. This allowed that I could use the drive as a TM backup for two different computers (I think that TM from machine A could not back up to the same volume when a TM backup from machine B was already resident). This also gave me a third volume as “share” just to store stuff that might need to be transferred from machine A to machine B at some point.
Drjjwmac, that is probably true as time machine backups will grow to fill ALL available space. So having a partition for each device would most likely be required.
According to Wikipedia, Time Machine requires the network-attached storage device to implement Apple Filing Protocol (I find this curious since it was my understanding that AFP was being, or has already been, phased out in favor of SMB). In any case I believe there is some magic that the NAS must perform in order to be considered by Time Machine.
As to partitioning, this is not done on the Time Capsule devices, and I can’t see why it would be necessary on third-party devices.
Finally, Time Machine backups don’t grow to fill all available space, instead older backups are deleted to make room for newer ones. That’s not saying the NAS would never fill up. One can easily imagine a scenario in which a too-small NAS is backing up multiple machines.
@jec0047 is correct. The storage device (router in this case) needs to support AFP in order to use it as a target for Time Machine. I’m not aware of any Linksys routers that support AFP, but I could be wrong. You can check your manual.
If 1 of your 2 Macs is stationary and always on, you could connect the backup drive to it. Time Machine Server is now built in to macOS.
The WD web software allows a TM folder to be set up and it’s sizes defined to stop it eating up the whole drive. I’ve done that but only given my Macbook access to it, it should work with another Mac accessing it but you would need to time that access as it appears to be only allow one device accessing my WD Mycloud drive at a time. I’m not sure if a partitioned MyBook/Cloud drive would be seen as multiple devices via the web interfaces as the device has one IP address.
The better solution maybe as have I found to add multiple USB HDD to my main Mac via a powered USB hub.