Do not use in production Server or if you don't know what iptables do
Add this to torrc ( located on /etc/tor/torrc):
VirtualAddrNetwork 10.192.0.0/10 AutomapHostsOnResolve 1 TransPort 9051 DNSPort 9053
Run the attached script as root so all traffic will route from Tor. you can also use attached torrc as a sample.
Thank you for your English tips. I rarely write in it since it's not my first language. The majority of my time is spent reading and not writing English, and in my country, people speak a totally different language from English.
Regarding your question,
First of all, yes, all the traffics are routed through Tor, but there is a possibility of DNS leakage. To bypass the Tor, you can set your own rules and use your real IP address.
At the moment, I do not recommend this method. Use Tor as a regular proxy to bypass your application. This feature prevents any data from being transferred with your real IP address (Let's call it kill switch).
Last but not least, it works on behalf of the user. IPtables newbies should avoid this link. ;)