The advancements of technology are playing a significant role in protecting the data from intruders. In this paper, a robust network intrusion detection system (IDS) is proposed for Internet of Things (IoT) using deep learning approaches. The type of intrusions we adopted in this work are distributed denial of service (DDoS) and replay attack. Our proposed work is divided into three sections, namely, node deployment, threat detection modelling, and prevention modelling. For detection, ensemble algorithm has been used, i.e., deep neural network (DNN) and support vector machine (SVM). SVM is used to identify the suspected route and DNN is used to identify the suspected node out of suspected routes. The chosen route ensures that it is prevented from attackers by incorporating the throughput and packet delivery ratio (PDR). The simulation results are obtained on the basis of accuracy, recall, precision, and F-measure to determine the effectiveness of the proposed approach. The precision, recall, F- measure, and accuracy of correctly identified intruders are 98.12%, 98.04%, 94.88%, and 98.68%, respectively, which is an improvement over the previous studies. The efficacy of the designed model for IoT is compared with the existing approaches.