The paper introduces a two-phase classification method for network anomaly detection using tree-based machine learning algorithms, focusing on addressing challenges like imbalance and feature selection. It utilizes information gain for feature selection and evaluates the CICIDS-2018 dataset, achieving a peak accuracy of 98.36% with its ensemble classifier. The study highlights the significant impact of selected features on performance metrics such as F1-score and detection accuracy, emphasizing the importance of effective preprocessing and classification techniques in intrusion detection systems.