I have a Rinnai natural gas tankless mounted inside and I have well water.
Run a cartridge filter in a clear housing on the inlet line. Also look into an item called Clear Wave and hook it up on your inlet also. It works great.
This setup is one of the best things I have done in my home.