A method for obtaining a correspondence, comprising: obtaining, by a first routing device, network address information of a second routing device and a first identifier sent by the second routing device, wherein the first identifier is used for identifying a service function, SF, node connected to the second routing device; and obtaining, by the first routing device, a first correspondence based on the network address information of the second routing device and the first identifier, wherein the first correspondence comprises the network address information of the second routing device and the first identifier, wherein the second routing device is a next-hop routing device of the first routing device on a service chain, and the obtaining, by a first routing device, network address information of a second routing device and a first identifier sent by the second routing device comprises: receiving, by the first routing device, a first packet sent by the second routing device, wherein the first packet comprises the network address information of the second routing device and the first identifier; and obtaining, by the first routing device, the network address information of the second routing device and the first identifier from the first packet, and wherein the first packet further comprises network address information of a third routing device and a second identifier, and the second identifier is used for identifying a SF node connected to the third routing device, and the third routing device is a next-hop routing device of the second routing device on the service chain. obtaining, by a first routing device, network address information of a second routing device and a first identifier sent by the second routing device, wherein the first identifier is used for identifying a service function, SF, node connected to the second routing device; and obtaining, by the first routing device, a first correspondence based on the network address information of the second routing device and the first identifier, wherein the first correspondence comprises the network address information of the second routing device and the first identifier, wherein the second routing device is a next-hop routing device of the first routing device on a service chain, and the obtaining, by a first routing device, network address information of a second routing device and a first identifier sent by the second routing device comprises: receiving, by the first routing device, a first packet sent by the second routing device, wherein the first packet comprises the network address information of the second routing device and the first identifier; and obtaining, by the first routing device, the network address information of the second routing device and the first identifier from the first packet, and wherein the first packet further comprises network address information of a third routing device and a second identifier, and the second identifier is used for identifying a SF node connected to the third routing device, and the third routing device is a next-hop routing device of the second routing device on the service chain. receiving, by the first routing device, a first packet sent by the second routing device, wherein the first packet comprises the network address information of the second routing device and the first identifier; and obtaining, by the first routing device, the network address information of the second routing device and the first identifier from the first packet, and wherein the first packet further comprises network address information of a third routing device and a second identifier, and the second identifier is used for identifying a SF node connected to the third routing device, and the third routing device is a next-hop routing device of the second routing device on the service chain.