XenServer and other virtualization technologies implement a "virtual switch" (or even several), which can achieve the results you are describing. Depending on your configuration, the virtual machines may be on the same IP subnet, which means they would just need to be connected to the same switch to communicate with each other (or virtual switch, in this case). In XenServer, the Dom0 OS may also be connected to this virtual switch, allowing Dom0 to communicate with the VMs. If the VMs are on two different IP subnets, then you would likely configure them to connect to two different virtual switches, and set up a system to route between them. In this scenario, the most common configuration is to connect Dom0 to both of the switches and allow it to do the routing, although you could achieve this in a number of other ways (you could connect a VM to both switches that acts as a router, or you could connect the host's physical NICs to the virtual switches and use a separate physical system to do the routing).