The invention discloses a method for automatically discovering an
Ethernet ring and generating a ring as well as a method for implementing automatic protection on the ring based thereof. The method comprises the steps of: voting a
network topology root node according to a
spanning tree algorithm, transmitting a ring discovering message from a ring port to the outside through the main node of the ring, checking whether the source node of the message is self or not through the node receiving the ring discovering message, if not, then respectively transmitting the message out through every non-blocking port and adding self mark, an inlet port and an outlet port in the message, if so, then checking the integrality of the ring through a
polling-based mechanism after the ring discovering is accomplished and combining with the port state monitoring to implement fault detection, and implementing
ring protection switching during link fault and resuming when the fault disappears. The method for automatically discovering the
Ethernet ring and generating the ring as well as the method for implementing automatic protection on the ring based thereof are based on
spanning tree protocol and
Ethernet ring protocol, can accomplish automatic ring discovering,
collocation and protection on
complex network topology, and can solve the dynamic change problem of the
network topology, thereby realizing automatic Ethernet ring planning and maintaining, and adapting to the further evolution and development of the Ethernet ring.