During recent years, the number of attacks on networks has dramatically increased. Consequently the interest in network intrusion detection has increased among the researchers. This paper proposes a clustering Ant-IS and an active Ant colony optimization algorithms for intrusion detection in computer networks. The goal of these algorithms is to extract a set of learning instances from the initial training dataset. The proposed algorithms are an improvement of the previously presented Ant-IS algorithm, used is pattern recognition. Results of experimental tests show that the proposed algorithms are capable of producing a reliable intrusion detection system.