Nowadays internet and network technology have been spread rapidly, cyber-attack increasing accordingly. In this paper we propose a network based Intrusion Detection and Prevention System (IDPS) which can detect many attack types that can prevent network systems from network attack. Our system is simple that can be used with several machine learning algorithms. We test the IDPS using machine learning algorithm in online network environment. The result of the test shows that our IDPS can distinguish normal attack activities from main attack types. We apply C4.5 machine learning technique in our approach to consider unknown or new attack types