An ad hoc network is a decentralized wireless network formed spontaneously by wireless devices without a preexisting infrastructure. Ad hoc networks are wireless local area networks where devices communicate directly instead of through an access point. Each device participates in routing by determining routes using a routing algorithm and forwarding data. There are different types of ad hoc networks including self-organizing, mobile, vehicular, and smartphone networks. Vehicular ad hoc networks use vehicles as mobile nodes and differ from other networks due to their high dynamic topology and predictable mobility. Some challenges of ad hoc networks include quality of service, limited resources, scalability, and security such as denial of service attacks.