In the framework of this research, machine learning based on detection and classification is applied on a hybrid model of SDN, and it will cover the OpenFlow communication protocol, types and implementation of controllers as one of the key parts of SDN. The application of hybrid SDN architecture uses elements of traditional network architecture in terms of collecting network traffic flows and communication of separate network segments, and the advantages of SDN will provide a central view of the network environment, automation and the possibility of blocking unwanted traffic in real time. By implementing the process of detection and classification with the help of machine learning on a real hybrid software-defined network, the proposed model of the attack prevention system is verified in real time.