With the advent of the industrial Internet era and rapid traffic growth, network optimization is increasingly needed, and network optimization starts with knowing QoS-related metrics. In this paper, we use a machine learning approach in a theoretical SDN architecture, using traffic as the input to a machine learning model, to predict network QoS metrics, focusing on network jitter and packet loss rate. We built a LAN and deployed a time server on the LAN in order to make the time of the devices on the LAN highly consistent. Experiments were conducted under this LAN to obtain data sets about traffic and QoS metrics. Then, we used the completed trained machine learning model to predict the network jitter and packet loss rate using traffic as the input to the machine learning model. The highest R² values for the prediction of network jitter and packet loss reached 0.9996 and 0.939, respectively. The experiments show that a suitable machine learning model is able to predict network jitter and packet loss rate relatively accurately for a specific network topology.