Both the furnace and the gas water heater have to be vented to the outside, not the attic. Use a separate vent for either appliance.

The reason is CO2.