Wireless Ad hoc Network is established by a collection of mobile nodes without any fixed infrastructure, where each node plays a role of the router. There are not any centralize control to handle the routing process of network, due to the dynamic tropology and infrastructure less network the network is vulnerable to various kinds of attacks. Therefore, numerous proactive, reactive and hybrid routing protocols have been recommended, among which one of the well-known a protocol is AODV due to its high-performance gain. This research work contributes towards mitigating network layer attacks on routing protocols in Wireless Ad hoc Networks. Problem and it's security issues because its consequences and existing mechanisms for detection and prevention with the context of AODV protocol is a challenge in Wireless Ad hoc Network, particularly in MANET and Sensor network. We present an AODV based secure routing algorithm for detection and prevention of different network layer attacks such as blackhole and rushing attacks. We use different types of security parameters like node sequence numbers, hop count, trust value, path value, acknowledge time, the threshold value and ALERT packet message to design a secure algorithm for AODV routing protocol. It shows enactment evaluation of AODV with the enhanced secure routing algorithm and existing routing algorithm through simulations which will confirm the effectiveness and accuracy of the algorithm by considering performance metrics like throughput, packet delivery ratio and end to end delay. Using network simulator NS-2.35 the experimental results have been shown an improvement in throughput, packet delivery ratio (PDR), and end to end delay using IDSAODV and results are compared with normal AODV routing protocol for blackhole and rushing attacks. The comparative results have been also shown with proposed IDSAODV and existing method