Route advertisement method and related device
A first network device obtains a subnet prefix, where the subnet prefix is a destination identifier of a traffic engineering tunnel. The first network device performs data processing based on the subnet prefix.
1 . A method, comprising:
obtaining, by a first network device, a first subnet prefix, wherein the first subnet prefix is a destination identifier of a traffic engineering tunnel; and
performing, by the first network device, data processing based on the first subnet prefix, comprising:
advertising, by the first network device, a first routing packet based on the first subnet prefix, wherein the first routing packet comprises a second subnet prefix, and a range of the second subnet prefix comprises a range of the first subnet prefix.
2 . The method according to claim 1 , wherein performing, by the first network device, data processing based on the first subnet prefix further comprises:
obtaining, by the first network device, a first packet; and
when a longest match is between a first address and the first subnet prefix, sending, by the first network device, the first packet through the traffic engineering tunnel, wherein the first address is obtained based on a destination address of the first packet.
3 . The method according to claim 2 , wherein the first address comprises:
the destination address of the first packet; or
a next-hop forwarding address determined by the first network device based on the destination address.
4 . The method according to claim 3 , wherein the first routing packet comprises an interior gateway protocol (IGP) packet.
5 . The method according to claim 3 , wherein the traffic engineering tunnel comprises a segment routing policy (SR) policy tunnel or a segment routing traffic engineering (SR TE) tunnel.
6 . The method according to claim 1 , further comprising:
determining the second subnet prefix by aggregating subnet prefixes of a plurality of traffic engineering tunnels.
7 . An apparatus, comprising:
at least one processor;
at least one non-transitory computer-readable storage medium storing a program to be executed by the at least one processor, the program including instructions to:
obtain a first subnet prefix, wherein the first subnet prefix is a destination identifier of a traffic engineering tunnel; and
perform data processing based on the first subnet prefix, comprising:
advertising a first routing packet based on the first subnet prefix, wherein the first routing packet comprises a second subnet prefix, and a range of the second subnet prefix comprises a range of the first subnet prefix.
8 . The apparatus according to claim 7 , wherein the program further includes instructions to:
obtain a first packet; and
when a longest match is between a first address and the first subnet prefix, send the first packet through the traffic engineering tunnel, wherein the first address is obtained based on a destination address of the first packet.
9 . The apparatus according to claim 8 , wherein the first address comprises:
the destination address of the first packet; or
a next-hop forwarding address determined by the apparatus based on the destination address.
10 . The apparatus according to claim 7 , wherein the first routing packet comprises an interior gateway protocol (IGP) packet.
11 . The apparatus according to claim 7 , wherein the traffic engineering tunnel comprises a segment routing policy (SR) policy tunnel.
12 . The apparatus according to claim 7 , wherein the traffic engineering tunnel comprises a segment routing traffic engineering (SR TE) tunnel.
13 . The apparatus according to claim 7 , wherein the program further includes instructions to:
determine the second subnet prefix by aggregating subnet prefixes of a plurality of traffic engineering tunnels.
14 . A non-transitory storage medium storing a program, wherein when the program is executed by one or more processors, the program causes the one or more processors to perform operations, the operations comprising:
obtaining a first subnet prefix, wherein the first subnet prefix is a destination identifier of a traffic engineering tunnel; and
performing data processing based on the first subnet prefix, comprising:
advertising, a first routing packet based on the first subnet prefix, wherein the first routing packet comprises a second subnet prefix, and a range of the second subnet prefix comprises a range of the first subnet prefix.
15 . The non-transitory storage medium according to claim 14 , wherein the operations further comprise:
obtaining a first packet; and
when a longest match is between a first address and the first subnet prefix, sending the first packet through the traffic engineering tunnel, wherein the first address is obtained based on a destination address of the first packet.
16 . The non-transitory storage medium according to claim 15 , wherein the first address comprises: the destination address of the first packet or a next-hop forwarding address determined based on the destination address.
17 . The non-transitory storage medium according to claim 14 , wherein the first routing packet comprises an interior gateway protocol (IGP) packet.
18 . The non-transitory storage medium according to claim 14 , wherein the traffic engineering tunnel comprises a segment routing policy (SR) policy tunnel.
19 . The non-transitory storage medium according to claim 14 , wherein the traffic engineering tunnel comprises a segment routing traffic engineering (SR TE) tunnel.
20 . The non-transitory storage medium according to claim 14 , wherein the operations further comprise:
determining the second subnet prefix by aggregating subnet prefixes of a plurality of traffic engineering tunnels.