Large switched Ethernet networks are deployed in campus networks, data centers and metropolitan area networks to support various types of services. Congestion is usually handled by deploying more switches and installing higher bandwidth link bundles, although a better use of the existing infrastructure would allow to deal with congestion at lower cost. In this paper, we use constrained-based local search and the COMET language to develop an efficient traffic engineering technique that improves the use of the infrastructure by the spanning tree protocol. We evaluate the performance of our scheme by considering several types of network topologies and traffic matrices. We also compare the performance of our technique with the performance that a routing-based deployment supported by an IP traffic engineering technique would obtain.