An intrusion detection system is a software or device that monitors traffic for detecting malicious content and vulnerabilities.
The IDS can be of two types:
1) HIDS (Host-based Intrusion detection system)
2) NIDS(Network Intrusion detection system)
Network Intrusion detection system
Network IDS is used to monitor and examine all the traffic from all devices on the network. The NIDS can monitor incoming and outgoing traffic. Example: Snort (It is a free packet sniffing tool that monitors the network traffic and detects the malicious packet coming to a system).
Host Intrusion detection system
Host IDS is a system that runs on an individual host, and it protects valuable data against viruses and other malware on the internet. Example: OSSEC (It is a free tool that performs log analysis, rootkit detection, etcetera)
Suggestion: How to protect yourself from hackers or attackers click here