Last updated: 20160526
Teamviewer will check to see if the two computers can see each other directly. If they can, direct UDP data on random ports is used. If they can't, Teamviewer checks for the availability of a proxy on the network and uses it if its available. Below are included logs from a successful proxy session. If no proxy, TCP 5938 traffic is used to relfection servers. I have only observed these connections being made to IP addresses in the range 126.96.36.199/24.
DNS host names that need to be allowed to resolve are included below.
This jives with this Teamviewer documentation.
Webproxy logs: CONNECT client.teamviewer.com:443 CONNECT master14.teamviewer.com:443 CONNECT 188.8.131.52:443 CONNECT 184.108.40.206:443
DIG results: email@example.com (Google): client.teamviewer.com. 105 IN CNAME client-tv-com.trafficmanager.net. client-tv-com.trafficmanager.net. 107 IN CNAME client-tv-com-eastus.cloudapp.net. client-tv-com-eastus.cloudapp.net. 38 IN A 220.127.116.11 firstname.lastname@example.org (Google): master14.teamviewer.com. 92 IN A 18.104.22.168
DNS filters to allow: teamviewer.com *.teamviewer.com trafficmanager.net *.trafficmanager.net cloudapp.net *.cloudapp.net