The paper presents an algorithm to enhance intrusion detection in computer networks using swarm intelligence, addressing the shortcomings of existing methods like DSDV and AODV. It proposes a Distributed Local Action Detection (DLAD) algorithm that accurately identifies local actions at network nodes to mitigate damage from intrusions. Experimental results indicate that the DLAD algorithm outperforms traditional routing protocols in packet delivery and throughput.