A communications apparatus, comprising: a receiving unit , configured to receive a synchronization signal block which carries synchronization signal block index information, and information used to indicate a mapping relationship between a synchronization signal block and a random access occasion; and a processing unit , configured to access a network device based on the information indicating the mapping relationship by using a random access occasion mapped to the synchronization signal block index information, the random access occasion being in a period Y, wherein the period Y is X quantity of random access configuration periods Ps, and a value of X is one of 2, 4, 8, and 16 and the period Y is one of a plurality of periods Ys, wherein in each of the plurality of periods Ys, the first random access occasion is mapped to the first synchronization signal block of actually transmitted synchronization signal blocks in a half frame and the actually transmitted synchronization signal blocks are cyclically mapped to random access occasions, the actually transmitted synchronization signal blocks comprise the synchronization signal block received by the receiving unit, a value of the random access configuration period P is represented by using one of millisecond, a quantity of frames or a quantity of 10 millisecond, and the random access configuration period P is a time interval at which a random access resource repeatedly occurs, wherein the random access resource and the random access configuration period P are configured in a random access channel, RACH, configuration information from the network device and the random access resource comprises a random access occasion, or one random access preamble set on a random access occasion, or, a combination of a random access preamble and a random access occasion. a receiving unit , configured to receive a synchronization signal block which carries synchronization signal block index information, and information used to indicate a mapping relationship between a synchronization signal block and a random access occasion; and a processing unit , configured to access a network device based on the information indicating the mapping relationship by using a random access occasion mapped to the synchronization signal block index information, the random access occasion being in a period Y, wherein the period Y is X quantity of random access configuration periods Ps, and a value of X is one of 2, 4, 8, and 16 and the period Y is one of a plurality of periods Ys, wherein in each of the plurality of periods Ys, the first random access occasion is mapped to the first synchronization signal block of actually transmitted synchronization signal blocks in a half frame and the actually transmitted synchronization signal blocks are cyclically mapped to random access occasions, the actually transmitted synchronization signal blocks comprise the synchronization signal block received by the receiving unit, a value of the random access configuration period P is represented by using one of millisecond, a quantity of frames or a quantity of 10 millisecond, and the random access configuration period P is a time interval at which a random access resource repeatedly occurs, wherein the random access resource and the random access configuration period P are configured in a random access channel, RACH, configuration information from the network device and the random access resource comprises a random access occasion, or one random access preamble set on a random access occasion, or, a combination of a random access preamble and a random access occasion. <EOS>