Hello @Jesús Sánchez Soto
What you are looking for is a Virtual Switch set as "Private":
Only allows communication between virtual machines on the same Hyper-V server. A private network is isolated from all external network traffic on the Hyper-V server. This type of network is useful when you must create an isolated networking environment, like an isolated test domain.
Hope this helps with your query,
------------
--If the reply is helpful, please Upvote and Accept as answer--