The prevalence of the Internet of Things (IoT) in people’s life has led to a significant rise in the amounts of breaches against different IoT devices. Given that IoT devices are typically installed in settings with constrained resources and limited processing power, and malicious traffic samples are difficult to collect, resulting in traditional deep learning algorithms that do not handle intrusion detection in IoT network well. In this work, we present a two-stage lightweight intrusion detection model based on self-supervised contrastive learning and self-knowledge distillation to reduce model’s over-reliance on labels, optimize the model’s capacity for generalization and significantly increase the IoT network’s intrusion detection speed while lowering the model’s complexity. The representations of the network traffic are extracted in the first step using self-supervised contrastive learning, and the representations learnt by the teacher model are transferred to the student model in the second stage using self-knowledge distillation. On the benchmark datasets KDD CUP99, NSL-KDD, UNSW-NB15, CIC IDS2017 and BoT-IoT, we carried out in-depth studies, and the experimental results demonstrate that our proposed model outperforms recent state-of-the-art models in addition to achieving superior intrusion detection capabilities. The code will be released at https://github.com/RicardoMLi/CL-SKD.