To play TrackMania 2 Canyon and ManiaPlanet, you need the following ports open:
UDP ports 80 & 443
Most of the dedicated servers use ports in the 2350-2450 and 3450-3550 range, for both TCP and UDP.
Please make sure you these ports open to avoid any connectivity issues you are playing.
If you have any other questions, please get in touch.