In the last few years, using the Internet of Things has been expanded in many areas, such as environmental monitoring, industries, and smart home. Since the Internet of Things has a direct relation to human life, its security is of paramount importance. Therefore, the communication between the nodes should be secured and the valuable private information should be kept private so that the attacker cannot detect the network structure. This article provides a protocol that can handle routing privately. To do this, we use the data structure called Spatial Bloom Filter (SBF). In addition, the proposed protocol uses random identifiers instead of IP addresses, so that an attacker cannot collect network structure information and location of nodes from IP addresses. Using a homomorphic encryption scheme, the protocol prevent attackers from retrieving valuable network information, if they can infiltrate to one or more network nodes. Also, since almost all nodes in the internet of things are mobile, the structure of networks and subnets is constantly changing. The proposed protocol has the ability to manage to route in networks with a dynamic structure.