What is claimed is:1. A random access method, performed by a network device, comprising:sending first resource configuration information to a terminal, wherein the first resource configuration information comprises resource configuration information for sending a random access request and resource configuration information for receiving a random access response, the resource configuration information for sending the random access request is used to indicate M first frequency resources, the resource configuration information for receiving the random access response is used to indicate N second frequency resources, and M and N are positive integers greater than or equal to 1;selecting at least one free frequency resource from the M first frequency resources indicated by the first resource configuration information as a target first frequency resource;receiving the random access request sent by the terminal on the target first frequency resource;selecting at least one free frequency resource from the N second frequency resources indicated by the first resource configuration information as a target second frequency resource; andsending the random access response on the target second frequency resource to the terminal.2. The random access method according to claim 1, wherein selecting at least one free frequency resource from the N second frequency resources indicated by the first resource configuration information as a target second frequency resource comprises:monitoring some or all second frequency resources in the N second frequency resources; andwhen the network device detects that X second frequency resources in the some or all second frequency resources are free, using at least one of the X second frequency resources as the target second frequency resource,wherein X is less than or equal to a quantity of the some or all second frequency resources, and X is a positive integer greater than or equal to 1.3. The random access method according to claim 2, wherein monitoring some or all second frequency resources in the N second frequency resources comprises: monitoring the some or all second frequency resources in the N second frequency resources according to a fifth predetermined rule,wherein the fifth predetermined rule comprises at least one of the following: second frequency resources satisfying a first condition are monitored, or a quantity of monitored second frequency resources is less than or equal to a sixth threshold,wherein the first condition is that a frequency measurement value corresponding to the second frequency resource is greater than or equal to a second threshold, and the sixth threshold is less than or equal to N.4. The random access method according to claim 2, wherein using at least one of the X second frequency resources as the target second frequency resource comprises: selecting at least one of the X second frequency resources as the target second frequency resource according to a sixth predetermined rule,wherein the sixth predetermined rule comprises at least one of the following: second frequency resources satisfying a first condition are selected, or a quantity of selected second frequency resources is less than or equal to a seventh threshold,wherein the first condition is that a frequency measurement value corresponding to the second frequency resource is greater than or equal to a second threshold, and the seventh threshold is less than or equal to X.5. The random access method according to claim 1, wherein the first resource configuration information is further used to indicate K third frequency resources and L fourth frequency resources; or the random access response comprises second resource configuration information, and the second resource configuration information is used to indicate K third frequency resources and L fourth frequency resources.6. The random access method according to claim 5, wherein after sending the random access response on the target second frequency resource to the terminal, the method further comprises:receiving uplink data sent by the terminal on a target third frequency resource; andsending a contention resolution message on a target fourth frequency resource to the terminal, wherein:the contention resolution message is used to indicate whether the terminal has successfully completed a random access process;the target third frequency resource is a free frequency resource in the K third frequency resources; andthe target fourth frequency resource is a free frequency resource in the L fourth frequency resources.7. The random access method according to claim 6, wherein before sending the contention resolution message on the target fourth frequency resource to the terminal, the method further comprises:monitoring some or all fourth frequency resources in the L fourth frequency resources; andwhen the network device detects that J fourth frequency resources in the some or all fourth frequency resources are free, using at least one of the J fourth frequency resources as the target fourth frequency resource,wherein J is less than or equal to a quantity of the some or all fourth frequency resources, and J is a positive integer greater than or equal to 1.8. The random access method according to claim 7, wherein monitoring some or all fourth frequency resources in the L fourth frequency resources comprises: monitoring the some or all fourth frequency resources in the L fourth frequency resources according to a seventh predetermined rule,wherein the seventh predetermined rule comprises at least one of the following: fourth frequency resources satisfying a first condition are monitored, or a quantity of monitored fourth frequency resources is less than or equal to an eighth threshold,wherein the first condition is that a frequency measurement value corresponding to the fourth frequency resource is greater than or equal to a second threshold, and the eighth threshold is less than or equal to L.9. The random access method according to claim 7, wherein using at least one of the J fourth frequency resources as the target fourth frequency resource comprises: selecting at least one of the J fourth frequency resources as the target fourth frequency resource according to an eighth predetermined rule,wherein the eighth predetermined rule comprises at least one of the following: fourth frequency resources satisfying a first condition are selected, or a quantity of selected fourth frequency resources is less than or equal to a ninth threshold,wherein the first condition is that a frequency measurement value corresponding to the fourth frequency resource is greater than or equal to a second threshold, and the ninth threshold is less than or equal to J.10. A network device, comprising:a memory storing a computer program; anda processor coupled to the memory and configured to execute the computer program to perform operations comprising:sending first resource configuration information to a terminal, wherein the first resource configuration information comprises resource configuration information for sending a random access request and resource configuration information for receiving a random access response, the resource configuration information for sending the random access request is used to indicate M first frequency resources, the resource configuration information for receiving the random access response is used to indicate N second frequency resources, and M and N are positive integers greater than or equal to 1;selecting at least one free frequency resource from the M first frequency resources indicated by the first resource configuration information as a target first frequency resource;receiving the random access request sent by the terminal on the target first frequency resource;selecting at least one free frequency resource from the N second frequency resources indicated by the first resource configuration information as a target second frequency resource; andsending the random access response on the target second frequency resource to the terminal.11. The network device according to claim 10, wherein selecting at least one free frequency resource from the N second frequency resources indicated by the first resource configuration information as a target second frequency resource comprise:monitoring some or all second frequency resources in the N second frequency resources; andwhen the network device detects that X second frequency resources in the some or all second frequency resources are free, using at least one of the X second frequency resources as the target second frequency resource,wherein X is less than or equal to a quantity of the some or all second frequency resources, and X is a positive integer greater than or equal to 1.12. The network device according to claim 11, wherein monitoring some or all second frequency resources in the N second frequency resources comprises: monitoring the some or all second frequency resources in the N second frequency resources according to a fifth predetermined rule,wherein the fifth predetermined rule comprises at least one of the following: second frequency resources satisfying a first condition are monitored, or a quantity of monitored second frequency resources is less than or equal to a sixth threshold,wherein the first condition is that a frequency measurement value corresponding to the second frequency resource is greater than or equal to a second threshold, and the sixth threshold is less than or equal to N.13. The network device according to claim 11, wherein using at least one of the X second frequency resources as the target second frequency resource comprises: selecting at least one of the X second frequency resources as the target second frequency resource according to a sixth predetermined rule,wherein the sixth predetermined rule comprises at least one of the following: second frequency resources satisfying a first condition are selected, or a quantity of selected second frequency resources is less than or equal to a seventh threshold,wherein the first condition is that a frequency measurement value corresponding to the second frequency resource is greater than or equal to a second threshold, and the seventh threshold is less than or equal to X.14. The network device according to claim 11, wherein the first resource configuration information is further used to indicate K third frequency resources and L fourth frequency resources; or the random access response comprises second resource configuration information, and the second resource configuration information is used to indicate K third frequency resources and L fourth frequency resources.15. The network device according to claim 14, wherein after sending the random access response on the target second frequency resource to the terminal, the operations further comprise:receiving uplink data sent by the terminal on a target third frequency resource; andsending a contention resolution message on a target fourth frequency resource to the terminal, wherein:the contention resolution message is used to indicate whether the terminal has successfully completed a random access process;the target third frequency resource is a free frequency resource in the K third frequency resources; andthe target fourth frequency resource is a free frequency resource in the L fourth frequency resources.16. The network device according to claim 15, wherein before sending the contention resolution message on the target fourth frequency resource to the terminal, the operations further comprise:monitoring some or all fourth frequency resources in the L fourth frequency resources; andwhen the network device detects that J fourth frequency resources in the some or all fourth frequency resources are free, using at least one of the J fourth frequency resources as the target fourth frequency resource,wherein J is less than or equal to a quantity of the some or all fourth frequency resources, and J is a positive integer greater than or equal to 1.17. The network device according to claim 16, wherein monitoring some or all fourth frequency resources in the L fourth frequency resources comprises: monitoring the some or all fourth frequency resources in the L fourth frequency resources according to a seventh predetermined rule,wherein the seventh predetermined rule comprises at least one of the following: fourth frequency resources satisfying a first condition are monitored, or a quantity of monitored fourth frequency resources is less than or equal to an eighth threshold,wherein the first condition is that a frequency measurement value corresponding to the fourth frequency resource is greater than or equal to a second threshold, and the eighth threshold is less than or equal to L.18. The network device according to claim 16, wherein using at least one of the J fourth frequency resources as the target fourth frequency resource comprises: selecting at least one of the J fourth frequency resources as the target fourth frequency resource according to an eighth predetermined rule,wherein the eighth predetermined rule comprises at least one of the following: fourth frequency resources satisfying a first condition are selected, or a quantity of selected fourth frequency resources is less than or equal to a ninth threshold,wherein the first condition is that a frequency measurement value corresponding to the fourth frequency resource is greater than or equal to a second threshold, and the ninth threshold is less than or equal to J.19. A non-transitory computer-readable storage medium, storing a computer program, when the computer program is executed by a processor, causes the processor to perform operations comprising:sending first resource configuration information to a terminal, wherein the first resource configuration information comprises resource configuration information for sending a random access request and resource configuration information for receiving a random access response, the resource configuration information for sending the random access request is used to indicate M first frequency resources, the resource configuration information for receiving the random access response is used to indicate N second frequency resources, and M and N are positive integers greater than or equal to 1;selecting at least one free frequency resource from the M first frequency resources indicated by the first resource configuration information as a target first frequency resource;receiving the random access request sent by the terminal on the target first frequency resource;selecting at least one free frequency resource from the N second frequency resources indicated by the first resource configuration information as a target second frequency resource; andsending the random access response on the target second frequency resource to the terminal.20. The non-transitory computer-readable storage medium according to claim 19, wherein selecting at least one free frequency resource from the N second frequency resources indicated by the first resource configuration information as a target second frequency resource comprise:monitoring some or all second frequency resources in the N second frequency resources, andwhen the network device detects that X second frequency resources in the some or all second frequency resources are free, using at least one of the X second frequency resources as the target second frequency resource,wherein X is less than or equal to a quantity of the some or all second frequency resources, and X is a positive integer greater than or equal to 1.