Smart cities, ITS, supply chains, and smart industries may all be developed with minimal human interaction thanks to the increasing prevalence of automation enabled by machine-type communication (MTC). Yet, MTC has substantial security difficulties because of diverse data, public network access, and an insufficient security mechanism. In this study, we develop a novel IIOT attack detection basis by joining the following four main steps: (a) data collection, (b) pre-processing, (c) attack detection, and (d) optimisation for high classification accuracy. At the initial stage of processing, known as "pre-processing," the collected raw data (input) is normalised. Attack detection requires the creation of an intelligent security architecture for IIoT networks. In this work, we present a learning model that can recognise previously unrecognised attacks on an IIoT network without the use of a labelled training set. An IoT network intrusion detection system-generated labelled dataset. The study also introduces a hybrid optimisation algorithm for pinpointing the optimal LSTM weight when it comes to intrusion detection. When trained on the labelled dataset provided by the proposed method, the improved LSTM outperforms the other models with a finding accuracy of 95%, as exposed in the research.