The classification of network traffic has become increasingly crucial due to the rapid growth in the number of internet users. Conventional approaches, such as identifying traffic based on port numbers and payload inspection are becoming ineffective due to the dynamic and encrypted nature of modern network traffic. A number of researchers haveimplemented Software Defined Networking (SDN) based traffic classification using Machine Learning (ML) and Deep Learning (DL) models. However, the studieshad variouslimitations such as encrypted traffic detection, payload inspection, poor detection accuracy, and challenges withtesting models both inoffline and real-timetrafficmodes. ML models together with SDN are adopted nowadays to enhance classification performance. In this paper, both supervised (Logistic Regression, Decision Tree, Random Forest, AdaBoost, and Support Vector Machine) and unsupervised (K-means clustering) ML models were used to classify Domain Name System (DNS), Telnet, Ping, and Voice traffic flows simulated usingthe Distributed Internet Traffic Generator (D-ITG) tool. The use of this tooleffectively manages and classifies traffic types based ontheir application. The study discussed the dataset used, model selection, implementation of the model, and implementation techniques (such as pre-processing, feature extraction, ML algorithm, and modelevaluation metrics). The proposed model in SDN was implemented in Mininet for designing the network architecture and generating network traffic. Anaconda Python environment was utilized for traffic classification using various ML techniques. Among the models tested, the Decision Tree supervised learning achieved the highest accuracy of99.81%, outperforming other supervised and unsupervised learning algorithms. These results indicate that theintegration of ML with SDN provides an efficient classification method for identifying and accurately classifying both offline and real-timenetwork traffic, enhanced quality of service (QoS), detection of encrypted packets, deep packet inspection and management.