Using molecular dynamic simulations, we show that single-layers of molybdenum disulfide (MoS) and graphene can effectively reject ions and allow high water permeability. Solutions of water and three cations with different valencies (Na, Zn, and Fe) were investigated in the presence of the two types of membranes, and the results indicate a high dependence of the ion rejection on the cation charge. The associative characteristic of ferric chloride leads to a high rate of ion rejection by both nanopores, while the monovalent sodium chloride induces lower rejection rates. Particularly, MoS shows 100% of Fe rejection for all pore sizes and applied pressures. On the other hand, the water permeation does not vary with the cation valence, having dependence only with the nanopore geometric and chemical characteristics. This study helps us to understand the fluid transport through a nanoporous membrane, essential for the development of new technologies for the removal of pollutants from water.