Route processing method, related apparatus, and network system
A first network device obtains a first route, where a first route prefix of the first route includes an identifier of a route advertiser. The first network device generates a first route entry based on the first route. The first network device obtains a second route, where the second route includes a second route prefix and the identifier of the route advertiser. The first network device generates a second route entry based on the identifier of the route advertiser and the second route prefix, to associate the first route entry with the second route entry.
1 . A method, comprising:
obtaining, by a first network device, a first route, wherein a first route prefix of the first route comprises an identifier of a route advertiser;
generating, by the first network device, a first route entry based on the first route, wherein generating, by the first network device, the first route entry based on the first route comprises:
allocating, by the first network device, a basic next-hop index corresponding to the route advertiser, wherein the first route entry comprises the identifier of the route advertiser and the basic next-hop index;
obtaining, by the first network device, a second route, wherein the second route comprises a second route prefix and the identifier of the route advertiser; and
generating, by the first network device, a second route entry based on the identifier of the route advertiser and the second route prefix, to associate the first route entry with the second route entry, wherein the basic next-hop index associates the first route entry and the second route entry.
2 . The method according to claim 1 , wherein:
the first route further comprises a first flag, and the first flag indicates that the first route is a basic route; and
the second route further comprises a second flag, and the second flag indicates that the second route is a service route.
3 . The method according to claim 1 , wherein the first route entry comprises a first sub-route entry and a second sub-route entry, the first sub-route entry comprises the identifier of the route advertiser and the basic next-hop index, the second sub-route entry comprises the basic next-hop index and information about at least one outbound interface path, the information about the at least one outbound interface path comprises an outbound interface and a next-hop address, and the next-hop address is an Internet protocol (IP) address of an interface of a neighboring device connected to the outbound interface.
4 . The method according to claim 3 , wherein the second sub-route entry comprises an index entry and a next-hop entry, the index entry comprises the basic next-hop index and a direct next-hop index, and the next-hop entry comprises the direct next-hop index and the information about the at least one outbound interface path.
5 . The method according to claim 4 , further comprising:
obtaining, by the first network device, a route withdraw message, wherein the route withdraw message comprises the identifier of the route advertiser; and
processing, by the first network device, the second sub-route entry based on the route withdraw message.
6 . The method according to claim 5 , wherein processing, by the first network device, the second sub-route entry based on the route withdraw message comprises:
deleting, by the first network device, the second sub-route entry when the second sub-route entry comprises the information about an outbound interface path; and
deleting, by the first network device, information about an outbound interface path corresponding to the route withdraw message from the second sub-route entry when the second sub-route entry comprises information about a plurality of outbound interface paths.
7 . The method according to claim 6 , wherein the second route entry comprises the second route prefix and the basic next-hop index.
8 . The method according to claim 1 , wherein the identifier of the route advertiser is an internet protocol (IP) address of a loopback interface of the route advertiser.
9 . The method according to claim 1 , wherein obtaining, by the first network device, the first route comprises: receiving, by the first network device, an extended border gateway protocol message, wherein the extended border gateway protocol message comprises the first route.
10 . The method according to claim 2 , wherein the basic route is route whose route prefix includes an identifier of a route advertiser, and the service route includes an identifier of a route publisher, to indicate a basic route on which the service route depends.
11 . A network device, comprising:
at least one processor; and
a non-transitory computer readable storage medium storing a program that is executable by the at least one processor, the program including instructions to:
obtain a first route, wherein a first route prefix of the first route comprises an identifier of a route advertiser;
generate a first route entry based on the first route, wherein generating the first route entry based on the first route comprises:
allocating a basic next-hop index corresponding to the route advertiser, wherein the first route entry comprises the identifier of the route advertiser and the basic next-hop index;
obtain a second route, wherein the second route comprises a second route prefix and the identifier of the route advertiser; and
generate a second route entry based on the identifier of the route advertiser and the second route prefix, to associate the first route entry with the second route entry, wherein the basic next-hop index associates the first route entry and the second route entry.
12 . The network device according to claim 11 , wherein:
the first route further comprises a first flag, and the first flag indicates that the first route is a basic route; and
the second route further comprises a second flag, and the second flag indicates that the second route is a service route.
13 . The network device according to claim 11 , wherein the first route entry comprises a first sub-route entry and a second sub-route entry, the first sub-route entry comprises the identifier of the route advertiser and the basic next-hop index, the second sub-route entry comprises the basic next-hop index and information about at least one outbound interface path, the information about the at least one outbound interface path comprises an outbound interface and a next-hop address, and the next-hop address is an Internet protocol (IP) address of an interface of a neighboring device connected to the outbound interface.
14 . The network device according to claim 13 , wherein the second sub-route entry comprises an index entry and a next-hop entry, the index entry comprises the basic next-hop index and a direct next-hop index, and the next-hop entry comprises the direct next-hop index and the information about the at least one outbound interface path.
15 . The network device according to claim 14 , wherein the program further includes instructions to:
obtain a route withdraw message, wherein the route withdraw message comprises the identifier of the route advertiser; and
process the second sub-route entry based on the route withdraw message.
16 . The network device according to claim 15 , wherein the program further includes instructions to:
delete the second sub-route entry when the second sub-route entry comprises the information about the at least one outbound interface path; and
delete information about an outbound interface path corresponding to the route withdraw message from the second sub-route entry when the second sub-route entry comprises information about a plurality of outbound interface paths.
17 . The network device according to claim 16 , wherein the second route entry comprises the second route prefix and the basic next-hop index.
18 . The network device according to claim 17 , wherein the identifier of the route advertiser is an internet protocol (IP) address of a loopback interface of the route advertiser.
19 . The network device according to claim 18 , further comprising:
a transceiver, configured to receive an extended border gateway protocol message, wherein the extended border gateway protocol message comprises the first route.
20 . The network device according to claim 12 , wherein the basic route is route whose route prefix includes an identifier of a route advertiser, and the service route includes an identifier of a route publisher, to indicate a basic route on which the service route depends.