At present, intelligent electronic device (IED) virtual terminal connection of smart substation is mainly manual connection. Due to the large number of virtual terminals and high similarity of names, the workload of IED virtual terminals is large, and the efficiency is low and error-prone. Automatic connection method of virtual terminals based on firework algorithm for calculating distance weight similarity of Levinstein is proposed in this paper. This method is established based on the Levinstein distance similarity model, calculates the virtual terminal similarity, establishes a distance weight vector optimization model, uses the completed virtual connection information of other smart substations, and adopts the firework algorithm to train the optimal distance weight vector. The virtual terminal of the IED to be matched is successfully connected. Simulation examples show that this method uses the completed IED virtual connection information to automatically and efficiently connect the IED virtual terminals to be matched, which can effectively improve the efficiency and reliability of smart substations.