Disclosed are a method and device for generating forwarding information, the method comprising: receiving a first request packet requesting first content for a first
network element; determining, according to obtained first registration information, that a second
network element is a provider of the first content; determining a first path from the second
network element to the first network element according to a
network topology; generating for a first forwarding device the first forwarding information comprising first matching information and first operation information, the first matching information comprising the
protocol identifier of the first request packet and the first identifier of the first content, and the first operation information being used to indicate that after determining that the received first data packet matches the first matching information, the first forwarding device encapsulates a first
label for the first data packet to obtain a first encapsulated packet; generating for a second forwarding device the second forwarding information comprising second matching information and second operation information, the second operation information being used to indicate that after receiving the first encapsulated packet having the encapsulated first
label, the second forwarding device generates for a third forwarding device the third forwarding information comprising second matching information and third operation information, the third operation information being used to indicate that after receiving the first encapsulated packet having the encapsulated first
label, the third forwarding device acquires, via de-encapsulation, the first data packet encapsulated in the first encapsulated packet and carrying the first content.