A method for discovering a network topology, comprising: collecting state information of all ports of a network element in a to-be-analyzed network, and if there is a port of all the ports whose state is normally-closed, deleting the port in the normally-closed state from a first port set comprising all the ports to obtain a second port set, wherein if there is no port of all the ports whose state is normally-closed, the first port set is equal to the second port set, the closed refers to DOWN which is physical DOWN or protocol DOWN; obtaining a link set of each port in the second port set by using the following method: selecting one port in the second port set as a port of a link, selecting all ports except the selected port as the other port of the link to obtain all links corresponding to the selected port, and setting a set comprising all the links as a link set of the selected port, wherein the link is a link comprising two ports; acquiring a similarity value between state information of two ports comprised in all the links in the link set of each port in the second port set according to a similarity algorithm and state information of each port in the second port set; acquiring a link with a maximum similarity value in the link set of each port in the second port set as a candidate link of each port in the second port set; and acquiring a network topology of the to-be-analyzed network according to the candidate link of each port in the second port set; wherein the acquiring a network topology of the to-be-analyzed network according to the candidate link of each port in the second port set comprises: obtaining a link set of the to-be-analyzed network by performing an operation on a candidate link set comprising the candidate link of each port in the second port set, and the operation comprises: combining same links in the candidate link set and setting a minimum one of all similarity values of the same links as a similarity value of the link retained after the combination, wherein the same links are at least two links comprising two ports, both of which are the same, and for at least two links of which only one port is the same, retaining a link with a maximum similarity value in the at least two links and deleting the rest of links; and acquiring the network topology of the to-be-analyzed network according to each link in the link set of the to-be-analyzed network. collecting state information of all ports of a network element in a to-be-analyzed network, and if there is a port of all the ports whose state is normally-closed, deleting the port in the normally-closed state from a first port set comprising all the ports to obtain a second port set, wherein if there is no port of all the ports whose state is normally-closed, the first port set is equal to the second port set, the closed refers to DOWN which is physical DOWN or protocol DOWN; obtaining a link set of each port in the second port set by using the following method: selecting one port in the second port set as a port of a link, selecting all ports except the selected port as the other port of the link to obtain all links corresponding to the selected port, and setting a set comprising all the links as a link set of the selected port, wherein the link is a link comprising two ports; acquiring a similarity value between state information of two ports comprised in all the links in the link set of each port in the second port set according to a similarity algorithm and state information of each port in the second port set; acquiring a link with a maximum similarity value in the link set of each port in the second port set as a candidate link of each port in the second port set; and acquiring a network topology of the to-be-analyzed network according to the candidate link of each port in the second port set; wherein the acquiring a network topology of the to-be-analyzed network according to the candidate link of each port in the second port set comprises: obtaining a link set of the to-be-analyzed network by performing an operation on a candidate link set comprising the candidate link of each port in the second port set, and the operation comprises: combining same links in the candidate link set and setting a minimum one of all similarity values of the same links as a similarity value of the link retained after the combination, wherein the same links are at least two links comprising two ports, both of which are the same, and for at least two links of which only one port is the same, retaining a link with a maximum similarity value in the at least two links and deleting the rest of links; and acquiring the network topology of the to-be-analyzed network according to each link in the link set of the to-be-analyzed network. obtaining a link set of the to-be-analyzed network by performing an operation on a candidate link set comprising the candidate link of each port in the second port set, and the operation comprises: combining same links in the candidate link set and setting a minimum one of all similarity values of the same links as a similarity value of the link retained after the combination, wherein the same links are at least two links comprising two ports, both of which are the same, and for at least two links of which only one port is the same, retaining a link with a maximum similarity value in the at least two links and deleting the rest of links; and acquiring the network topology of the to-be-analyzed network according to each link in the link set of the to-be-analyzed network.