Owing to the development and expansion of energy-aware sensing devices and autonomous and intelligent systems, the Internet of Things (IoT) has gained remarkable growth and found uses in several day-to-day applications. Currently, the Internet of Things (IoT) network is gradually developing ubiquitous connectivity amongst distinct new applications namely smart homes, smart grids, smart cities, and several others. The developing network of smart devices and objects allows people to make smart decisions with machine to machine (M2M) communications. One of the real-world security and IoT-related challenges was vulnerable to distinct attacks which poses several security and privacy challenges. Thus, an IoT provides effective and efficient solutions. An Intrusion Detection System (IDS) is a solution for addressing security and privacy challenges with identifying distinct IoT attacks. This study develops a new Barnacles Mating Optimizer with Hopfield Neural Network based Intrusion Detection (BMOHNN-ID) in IoT environment. The presented BMOHNN-ID technique majorly concentrates on the detection and classification of intrusions from IoT environments. In order to attain this, the BMOHNN-ID technique primarily pre-processes the input data for transforming it into a compatible format. Next, the HNN model was employed for the effectual recognition and classification of intrusions from IoT environments. Moreover, the BMO technique was exploited to optimally modify the parameters related to the HNN model. When a list of possible susceptibilities of every device is ordered, every device is profiled utilizing data related to every device. It comprises routing data, the reported hostname, network flow, and topology. This data was offered to the external modules for digesting the data via REST API model. The experimental values assured that the BMOHNN-ID model has gained effectual intrusion classification performance over the other models.