Generally, according to Tolstoy, Freemasonry, its precepts, are based on virtuous ideals and a mystic belief in god. You can look them up in the book
here. Just do a find for the word "freemason" and you'll come across them.
But like all other religious organizations, its members approach it from different angles, different degrees of belief, and with different aims and intents. This is how Tolstoy categorizes them through his protagonist Pierre Bezukhov:
He divided the Brothers he knew into four categories. In the first
he put those who did not take an active part in the affairs of the
lodges or in human affairs, but were exclusively occupied with the
mystical science of the order: with questions of the threefold
designation of God, the three primordial elements--sulphur, mercury,
and salt--or the meaning of the square and all the various figures
of the temple of Solomon. Pierre respected this class of Brothers to
which the elder ones chiefly belonged, including, Pierre thought,
Joseph Alexeevich himself, but he did not share their interests. His
heart was not in the mystical aspect of Freemasonry.
In the second category Pierre reckoned himself and others like
him, seeking and vacillating, who had not yet found in Freemasonry a
straight and comprehensible path, but hoped to do so.
In the third category he included those Brothers (the majority)
who saw nothing in Freemasonry but the external forms and
ceremonies, and prized the strict performance of these forms without
troubling about their purport or significance. Such were Willarski and
even the Grand Master of the principal lodge.
Finally, to the fourth category also a great many Brothers belonged,
particularly those who had lately joined. These according to
Pierre's observations were men who had no belief in anything, nor
desire for anything, but joined the Freemasons merely to associate
with the wealthy young Brothers who were influential through their
connections or rank, and of whom there were very many in the lodge.