A method for allocating a device-to-device, D2D, communication resource, comprising: receiving, by a first network device, a D2D communication capability sent by a user device within coverage; characterised by sending, by the first network device according to the communication capability, a first D2D communication resource identifier to each user device and a second D2D communication resource identifier to each user device within the coverage of the first network device in a D2D group, wherein the D2D group comprises at least two user devices; and sending, by the first network device, one first resource allocation message to the D2D group corresponding to the first resource identifier, wherein the first resource allocation message carries D2D communication resource allocation information corresponding to the first resource identifier; and sending, by the first network device, one second resource allocation message to the D2D group corresponding to the second resource identifier, wherein the second resource allocation message carries D2D communication resource allocation information corresponding to the second resource identifier; wherein the first resource identifier is a resource identifier used by each user device within the coverage of the first network device in the D2D group in a device discovery phase of a D2D communication process, and a D2D communication resource corresponding to the first resource identifier is a resource used by each user device within the coverage of the first network device in the D2D group in the device discovery phase of the D2D communication process; and the second resource identifier is a resource identifier used by each user device within the coverage of the first network device in the D2D group in a device communication phase of a D2D communication process, and a D2D communication resource corresponding to the second resource identifier is a resource used by each user device within the coverage of the first network device in the D2D group in the device communication phase of the D2D communication process. receiving, by a first network device, a D2D communication capability sent by a user device within coverage; characterised by sending, by the first network device according to the communication capability, a first D2D communication resource identifier to each user device and a second D2D communication resource identifier to each user device within the coverage of the first network device in a D2D group, wherein the D2D group comprises at least two user devices; and sending, by the first network device, one first resource allocation message to the D2D group corresponding to the first resource identifier, wherein the first resource allocation message carries D2D communication resource allocation information corresponding to the first resource identifier; and sending, by the first network device, one second resource allocation message to the D2D group corresponding to the second resource identifier, wherein the second resource allocation message carries D2D communication resource allocation information corresponding to the second resource identifier; wherein the first resource identifier is a resource identifier used by each user device within the coverage of the first network device in the D2D group in a device discovery phase of a D2D communication process, and a D2D communication resource corresponding to the first resource identifier is a resource used by each user device within the coverage of the first network device in the D2D group in the device discovery phase of the D2D communication process; and the second resource identifier is a resource identifier used by each user device within the coverage of the first network device in the D2D group in a device communication phase of a D2D communication process, and a D2D communication resource corresponding to the second resource identifier is a resource used by each user device within the coverage of the first network device in the D2D group in the device communication phase of the D2D communication process.