Devices used for Internet of Things (IoT) are lacking in resources, and they are susceptible to many attacks that the internet provides a pathway. These devices are connected to the internet using the protocol known as IPv6 ad the network specifically designed for them 6LoWPAN. Authentication and encryption are used in all the layers of the standard IoT protocol stack; however, due to the resource constraints present in IoT devices, the standard security measures used in conventional networks cannot be applied robustly and efficiently to IoT. Hence they are susceptible to both internal and external attacks. That is why a special IDS that suits the requirements of IoT is necessary for the widespread use of IoT. In this paper, we propose and implement a modified version of the SVELTE Intrusion Detection System (IDS). We have specifically improved the rank inconsistency detection algorithm of the SVELTE IDS. In our implementation, we have tested the system against sinkhole attack; however, the approach can be extended to cater to other emergent attacks of the rank attack. The algorithm has been implemented in Contiki OS, and the simulations for the experiments have been performed in Cooja.Our results show that the modified algorithm performs significantly better in the simulated scenarios than the original algorithm. The results also show that accuracy is not 100%, and there are some false alarms. According to our results, the accuracy for an eight-node network is 89%, the accuracy for sixteen node network is 90.2%, the accuracy for a thirty-two-node network is 87%, and the accuracy for a sixty four-node network is 73%. In terms of delay, a modified version of SVELTE is also giving better performance. Moreover, energy and average power consumption are a little bit better than the modified version of SVELTE.