Network security experiments often require complex experimental environment. The network attack and defense technology is destructive and irreversible. Setting network security vulnerabilities for teaching will produce huge risk. The setup and maintenance costs for experimental environment are very expensive. Therefore, it is of great significance to use virtualization and SDN technology to build the simulation platform. The virtual experiment platform of network attack and defense is constructed based on CloudStack, open source cloud architecture, and XEN virtualization technology. The platform solves the problems in the network security experiment teaching and can provide IaaS cloud services. The introduction and analysis of a specific experiment show that the cloud experiment platform can effectively improve the quality of experiment teaching and cultivate students' engineering practice ability and innovation ability. The cloud platform itself has broad prospects for development and application.