A federated learning-based intrusion detection system (FL-IDS) is introduced in this paper to enhance the security of vehicular networks in the context of IoT edge device implementations. The FL-IDS system protects data privacy by using local learning, where devices share only model updates with an aggregation server. This server then generates an enhanced detection model. The FL-IDS system also incorporates machine learning (ML) and deep learning (DL) classifiers, namely logistic regression (LR) and convolutional neural networks (CNN), to prevent attacks in transportation IoT environments. The performance of the proposed IDS was evaluated using two different datasets, NSL-KDD and Car-Hacking. The model evaluation has been evaluated based on the accuracy and loss parameters. The results show that the FL-IDS system outperforms traditional centralized machine learning and deep learning approaches regarding accuracy and privacy protection.