The exponential growth of Internet of Things (IoT) devices and smart technologies has escalated the risk of network intrusions, necessitating advanced Intrusion Detection Systems (IDS) to ensure robust cybersecurity. This study presents a machine learning-based IDS framework tailored for IoT networks, employing Recursive Feature Elimination (RFE), binning techniques, and GridSearchCV for comprehensive feature selection and hyperparameter tuning. The CICIDS2017 dataset, a benchmark dataset for intrusion detection, is utilized to train and validate the models. The proposed pipeline begins with data pre-processing, including attribute verification, duplicate removal, and label encoding, followed by a detailed feature selection process. Recursive Feature Elimination (RFE) was utilized to identify and retain the most significant features, feature engineering incorporated domain knowledge to create new attributes and employed binning techniques to effectively manage continuous features and GridSearchCV was applied to identify the best parameter combinations. Multiple machines learning models, including LR, DT, RF, NB and SVM were analyzed and optimized through this comprehensive pipeline. Visualization techniques further enhanced understanding of feature importance and model behavior. The performance metrics reveal the effectiveness of the approach, with Random Forest achieving a remarkable accuracy of 99.78%, closely followed by Decision Tree at 99.50%. This underscores the efficacy of the methodology in addressing network intrusion detection challenges within IoT ecosystems. The framework provides a robust, scalable solution for securing interconnected systems against evolving cyber threats.