Transliteration
sarva-karmani manasa sannyasyaste sukham vasi
nava-dvare pure dehi naiva kurvan na karayan
Translation
When the embodied living being controls his nature and mentally renounces all actions, he resides happily in the city of nine gates [the material body], neither working nor causing work to be done.
Purport
In earlier Shloka Bhagwan Shri Krishna explains how when a Human renounces his attachment with the results of his actions and submits all his actions to the lotus feet of Parmatma attains the supreme peace. But renunciation is easier said than done. Renouncing the desires of results itself is a complex phenomenon and may not be achieved automatically.
In this Shloka Bhagwan Shri Krishna explains the secret of how to achieve the state of renouncing the desires for the result. Two steps explained
1. Controlling nature(self-control)
2. Renouncing the actions from mind
The very first step to achieve the state of renunciation is to know the truth of the self. We are not the body, but the soul which is residing inside the body. This body is simply a small abstraction of this material nature. All the acts by this body are driven by the rules of nature and variations in modes of nature(Ch3: Sh27). Knowing this reality one should remove the ego of being the doer of the actions. This is how a human detaches itself from the actions. Once it is done the soul then resides happily in this material body. To be noted that this body is compared with a city of nine gates. Our body has a nice opening, two eyes, two noses, two ears, mouth, anus and genital. This body hence is a city for the living soul through which the soul enjoys the material world.