As Internet protocol (IP)-based protocols move toward becoming the prevalent means for providing new forms of communication, for example, using IP for communication traditionally done via public Switched telephone network (PSTN), location privacy of mobile end users becomes an important problem to address. In an IP network, each packet carries IP addresses corresponding to the source (sender) and the destination (receiver) of the packet. Mobile hosts (laptop computers, PDAs, mobile phones etc.) usually acquire temporary IP addresses from the address spaces allocated to the access networks where they are currently connected to the Internet, and use these addresses for communication over the Internet. Due to a strong correlation between the address spaces used by the access networks and the geographic location of the access networks, location privacy of mobile users is compromised. If the recipient or an intermediate network node in the path of the packet analyzes the packet, the location of the sender of the packet is revealed. This may affect the widespread acceptance of IP based protocols. In this paper we present a novel protocol called LocPriv that preserves the location privacy in an IP based mobile communication network. The protocol works by employing an IP address encapsulation/swapping scheme at the access nodes to conceal the IP address of the mobile host, without affecting the route that the packets should follow in the network. We compare the protocol with existing techniques for providing location privacy and also analyze the effect of the protocol on the complexity of routing elements.