IEEE 802.11ah or HaLow is a new Wi-Fi standard for sub-1Ghz communications, aiming to address the major challenges of the Internet of Things: connectivity among a large number of power-constrained stations deployed over a wide area. Existing research on the performance evaluation of 802.11ah is generally based on analytical models, which does not accurately represent real network dynamics and is hard to adjust to different network conditions. To address this hiatus, we implemented the 802.11ah physical and MAC layer in the ns-3 network simulator, which, compared to analytical models, more closely reflects actual protocol behavior and can more easily be adapted to evaluate a broad range of network and traffic conditions. In this paper, we present the details of our implementation, including a sub-1Ghz physical layer model and several novel MAC layer features. Moreover, simulations based on the implemented model are conducted to evaluate performance of the novel features of IEEE 802.11ah.