A communication method, comprising: sending, by a mobility management network element, a first request message to a network repository network element, wherein the first request message carries a data network name of a session that a terminal device requests to establish; receiving, by the mobility management network element, an identifier of at least one target session management network element and information about a service area of the at least one target session management network element from the network repository network element, wherein the at least one target session management network element supports the data network name; determining, by the mobility management network element based on a first location information and the information about the service area of the at least one target session management network element, whether the at least one target session management network element supports the first location, wherein the first location information is used to indicate the first location corresponding to an access network accessed by the terminal device; if the at least one target session management network element cannot support the first location, sending, by the mobility management network element, a second request message to the network repository network element, wherein the second request message carries the first location information; and receiving, by the mobility management network element from the network repository network element, an identifier of at least one fourth session management network element supporting the first location information, wherein a type of the at least one fourth session management network element is an intermediate session management network element, and the intermediate session management network element is configured to control a user-plane function network element that interfaces with an access network. sending, by a mobility management network element, a first request message to a network repository network element, wherein the first request message carries a data network name of a session that a terminal device requests to establish; receiving, by the mobility management network element, an identifier of at least one target session management network element and information about a service area of the at least one target session management network element from the network repository network element, wherein the at least one target session management network element supports the data network name; determining, by the mobility management network element based on a first location information and the information about the service area of the at least one target session management network element, whether the at least one target session management network element supports the first location, wherein the first location information is used to indicate the first location corresponding to an access network accessed by the terminal device; if the at least one target session management network element cannot support the first location, sending, by the mobility management network element, a second request message to the network repository network element, wherein the second request message carries the first location information; and receiving, by the mobility management network element from the network repository network element, an identifier of at least one fourth session management network element supporting the first location information, wherein a type of the at least one fourth session management network element is an intermediate session management network element, and the intermediate session management network element is configured to control a user-plane function network element that interfaces with an access network.