A method for a terminal to traverse a private network to communicate with a server in an internet protocol multimedia subsystem, IMS, core network, wherein a security tunnel gateway is located at the edge of the IMS core network, the method comprising: sending, by the terminal, an SSL tunnel setup request carrying identity information to the security tunnel gateway for setting up a security socket layer, SSL, tunnel for transmission of service control information; receiving, by the terminal an authentication result returned by the security tunnel gateway, the authentication result indicating that the SSL tunnel is set up successfully; sending, by the terminal after the SSL tunnel is set up successfully, a user data protocol, UDP, connection setup request to the security tunnel gateway to detect whether a path is enabled between the terminal and the security tunnel gateway; and negotiating, by the terminal if the path is enabled, a UDP tunnel key over the SSL tunnel with the security tunnel gateway to set up the UDP tunnel; sending, by the terminal after the UDP tunnel is setup successfully, a configuration information request packet over the UDP tunnel to the security tunnel gateway; receiving, by the terminal, configuration information returned by the security tunnel gateway over the UDP tunnel, the configuration information comprises an IP address of the server, and a virtual IP address allocated by the security tunnel gateway to the terminal; setting, by the terminal, a source address of service data to be sent as the virtual IP address, setting a destination address of the service data to be sent as an address of the server to obtain a first service packet; encapsulating, by the terminal, the first service packet into a first tunnel packet, wherein a source IP address of the first tunnel packet is a real IP address of the terminal, and a destination IP address of the first tunnel packet is an IP address of the security tunnel gateway; and sending, by the terminal, the first tunnel packet to the security tunnel gateway over the UDP tunnel between the terminal and the security tunnel gateway. sending, by the terminal, an SSL tunnel setup request carrying identity information to the security tunnel gateway for setting up a security socket layer, SSL, tunnel for transmission of service control information; receiving, by the terminal an authentication result returned by the security tunnel gateway, the authentication result indicating that the SSL tunnel is set up successfully; sending, by the terminal after the SSL tunnel is set up successfully, a user data protocol, UDP, connection setup request to the security tunnel gateway to detect whether a path is enabled between the terminal and the security tunnel gateway; and negotiating, by the terminal if the path is enabled, a UDP tunnel key over the SSL tunnel with the security tunnel gateway to set up the UDP tunnel; sending, by the terminal after the UDP tunnel is setup successfully, a configuration information request packet over the UDP tunnel to the security tunnel gateway; receiving, by the terminal, configuration information returned by the security tunnel gateway over the UDP tunnel, the configuration information comprises an IP address of the server, and a virtual IP address allocated by the security tunnel gateway to the terminal; setting, by the terminal, a source address of service data to be sent as the virtual IP address, setting a destination address of the service data to be sent as an address of the server to obtain a first service packet; encapsulating, by the terminal, the first service packet into a first tunnel packet, wherein a source IP address of the first tunnel packet is a real IP address of the terminal, and a destination IP address of the first tunnel packet is an IP address of the security tunnel gateway; and sending, by the terminal, the first tunnel packet to the security tunnel gateway over the UDP tunnel between the terminal and the security tunnel gateway.