Block web browsing (port 80,443), and allow only Teamviewer to work

Good morning.
I need help in the following:
In a particular Vlan, I need to block all types of web browsing. but I need the “teamviewer” of those computers that belong to this vlan to work.

Try blocking port 80, 443, block navigation but try to use the teamviewer and mark me “error, without internet connection”.

I await your help.
Thank you very much

To make TeamViewer work it is normally enough to permit access to UDP and TCP port 5938. However, various operating systems use various methods to determine internet availability, often based on DNS availability, plus the TeamViewer probably also needs DNS to work. So permit also access to DNS to the computers which should be able to run TeamViewer.