This study investigates the use of convolutional neural network (CNN) technology to solve the problem of network intrusion detection, specifically studying the impact of convolutional layer count. Experiments revealed that two convolutional layers yield optimal results. An AdaBoost+CNN model was proposed using this CNN with optimization strategies such as ensemble learning. Eight classical learning algorithms were compared with the proposed methods, and the results were evaluated using parameters such as accuracy, precision, and F-measurement. Compared with traditional machine learning, deep learning, and other methods, the method proposed in this study achieved higher classification accuracy and successful results in detecting network attacks.