I have a network with hundreds of users .
I saw many times some of the users use the "Teamviewer software" to connect somewhere outside of the network.
How can I use mikrotik to block it ?
Here's what I just tried, and it worked for me. Assuming all DNS queries go through your router, this should work for you as well.
I created a new Firewall L7 rule called "teamviewer-dns" that has this Regexp: "^.+(teamviewer|dyngate).*$" (without the double quotes).
Then, I created a firewall rule (forward chain) that blocks UDP traffic on port 53 that matches that L7 rule.
Give it a should and report back if it works for you as well.
Cheers,
Shaun