A data transmission method, which is used in an Internet Protocol Multimedia Subsystem, IMS, comprising: establishing a tunnel between a network device and a peer end, wherein the tunnel is any one of the following: an SSL tunnel, a Hypertext Transfer Protocol, HTTP tunnel, and a User Datagram Protocol, UDP tunnel; performing, by the network device, tunnel encapsulation for a Real-time Transport Protocol packet to obtain a first tunnel packet, wherein the first tunnel packet comprises a record unit, and wherein a plurality of RTP packets are encapsulated in the record unit; and sending, by the network device, the first tunnel packet to the peer end over the tunnel connected to the peer end, wherein when the network device is a IMS terminal the peer end is a Security Tunnel Gateway, and when the network device is the STG the peer end is the IMS terminal; wherein the performing tunnel encapsulation for the RTP packet to obtain a first tunnel packet comprises: generating and buffering an RTP packet in a pre-created link table; judging whether a preset encapsulation time interval, T, is reached, wherein the preset encapsulation time interval is integral multiple to the packetization time for a specific media coding type in the network device for generating the RTP packet, and is smaller than or equal to 200 ms; and if the preset encapsulation time interval is reached, performing tunnel encapsulation for a plurality of RTP packets generated in the link table within the preset encapsulation time interval to obtain a first tunnel packet; wherein the performing tunnel encapsulation for the plurality of RTP packets generated in the link table within the preset encapsulation time interval to obtain a first tunnel packet comprises: fetching the plurality of RTP packets from the link table, and copying the packets to a section of contiguous memory space; adding a tunneling protocol header, Enc Header, in the header of the section of contiguous memory space; performing digest calculation for the packets in the section of contiguous memory space with the Enc Header added, and attaching the digest information, HMAC, obtained by the calculation in the tail of the section of contiguous memory space with the Enc Header added; attaching packet length padding information Tail behind the HMAC. establishing a tunnel between a network device and a peer end, wherein the tunnel is any one of the following: an SSL tunnel, a Hypertext Transfer Protocol, HTTP tunnel, and a User Datagram Protocol, UDP tunnel; performing, by the network device, tunnel encapsulation for a Real-time Transport Protocol packet to obtain a first tunnel packet, wherein the first tunnel packet comprises a record unit, and wherein a plurality of RTP packets are encapsulated in the record unit; and sending, by the network device, the first tunnel packet to the peer end over the tunnel connected to the peer end, wherein when the network device is a IMS terminal the peer end is a Security Tunnel Gateway, and when the network device is the STG the peer end is the IMS terminal; wherein the performing tunnel encapsulation for the RTP packet to obtain a first tunnel packet comprises: generating and buffering an RTP packet in a pre-created link table; judging whether a preset encapsulation time interval, T, is reached, wherein the preset encapsulation time interval is integral multiple to the packetization time for a specific media coding type in the network device for generating the RTP packet, and is smaller than or equal to 200 ms; and if the preset encapsulation time interval is reached, performing tunnel encapsulation for a plurality of RTP packets generated in the link table within the preset encapsulation time interval to obtain a first tunnel packet; generating and buffering an RTP packet in a pre-created link table; judging whether a preset encapsulation time interval, T, is reached, wherein the preset encapsulation time interval is integral multiple to the packetization time for a specific media coding type in the network device for generating the RTP packet, and is smaller than or equal to 200 ms; and if the preset encapsulation time interval is reached, performing tunnel encapsulation for a plurality of RTP packets generated in the link table within the preset encapsulation time interval to obtain a first tunnel packet; wherein the performing tunnel encapsulation for the plurality of RTP packets generated in the link table within the preset encapsulation time interval to obtain a first tunnel packet comprises: fetching the plurality of RTP packets from the link table, and copying the packets to a section of contiguous memory space; adding a tunneling protocol header, Enc Header, in the header of the section of contiguous memory space; performing digest calculation for the packets in the section of contiguous memory space with the Enc Header added, and attaching the digest information, HMAC, obtained by the calculation in the tail of the section of contiguous memory space with the Enc Header added; attaching packet length padding information Tail behind the HMAC. fetching the plurality of RTP packets from the link table, and copying the packets to a section of contiguous memory space; adding a tunneling protocol header, Enc Header, in the header of the section of contiguous memory space; performing digest calculation for the packets in the section of contiguous memory space with the Enc Header added, and attaching the digest information, HMAC, obtained by the calculation in the tail of the section of contiguous memory space with the Enc Header added; attaching packet length padding information Tail behind the HMAC.