One embodiment of the present invention provides a switch. The switch includes a storage and a lookup mechanism. The storage stores a first table that contains an entry corresponding to a media access control (MAC) address of a device and an identifier of a remote switch associated with the device. The storage also stores a second table that contains an entry indicating a local outgoing interface corresponding to the remote switch. The lookup mechanism identifies the local outgoing interface corresponding to the device based on the first table and the second table.