A method comprising the steps of: receiving, by a network virtualization device, a first frame via a first port of the network virtualization device, the first frame comprising a first media access control, MAC, address of a first compute instance that is a destination of the first frame, a second MAC address of a second compute instance that is a source of the first frame, and a Layer 2, L2, protocol data unit, PDU, the first compute instance and the second compute instance being members of a virtual L2 network, the first compute instance hosted by a first host machine that is connected with the network virtualization device via a second port of the network virtualization device, wherein for each port used to connect the network virtualization device to a host machine, the network virtualization device maintains a respective spanning tree associated with only the respective port; determining, by the network virtualization device, that a loop prevention rule prevents transmission of a frame using a port via which the frame was received; transmitting, by the network virtualization device based on a spanning tree associated with the second port, to the first compute instance via the second port, a bridge protocol data unit, BPDU; determining, by the network virtualization device, whether a loop exists between the network virtualization device and the first compute instance, wherein receiving, from the first compute instance via the second port, the BPDU is indicative that a loop exists between the network virtualization device and the first compute instance, and not receiving, from the first compute instance via the second port, the BPDU is indicative that a loop does not exist between the network virtualization device and the first compute instance; determining, by the network virtualization device, that the first frame is to be transmitted via all ports of the network virtualization device based on the second MAC address; and transmitting, by the network virtualization device, the first frame via all ports of the network virtualization device except the first port based on the loop prevention rule and except the second port if it is determined that a loop exists between the network virtualization device and the first compute instance. receiving, by a network virtualization device, a first frame via a first port of the network virtualization device, the first frame comprising a first media access control, MAC, address of a first compute instance that is a destination of the first frame, a second MAC address of a second compute instance that is a source of the first frame, and a Layer 2, L2, protocol data unit, PDU, the first compute instance and the second compute instance being members of a virtual L2 network, the first compute instance hosted by a first host machine that is connected with the network virtualization device via a second port of the network virtualization device, wherein for each port used to connect the network virtualization device to a host machine, the network virtualization device maintains a respective spanning tree associated with only the respective port; determining, by the network virtualization device, that a loop prevention rule prevents transmission of a frame using a port via which the frame was received; transmitting, by the network virtualization device based on a spanning tree associated with the second port, to the first compute instance via the second port, a bridge protocol data unit, BPDU; determining, by the network virtualization device, whether a loop exists between the network virtualization device and the first compute instance, wherein receiving, from the first compute instance via the second port, the BPDU is indicative that a loop exists between the network virtualization device and the first compute instance, and not receiving, from the first compute instance via the second port, the BPDU is indicative that a loop does not exist between the network virtualization device and the first compute instance; determining, by the network virtualization device, that the first frame is to be transmitted via all ports of the network virtualization device based on the second MAC address; and transmitting, by the network virtualization device, the first frame via all ports of the network virtualization device except the first port based on the loop prevention rule and except the second port if it is determined that a loop exists between the network virtualization device and the first compute instance.