What Is a Network and How Do You Prevent Hacker Attacks on It?
Security is often overlooked on connected devices. When working with networks, it's critical to understand how network traffic flows and what types of threats may try to infiltrate your system. The first step to securing any network is understanding its architecture. In order to protect your organization's infrastructure, you need to know where data enters your network and where it exits. Once you have determined this information, you'll have a good idea of where to monitor for potential attacks and vulnerabilities.
Quick answer: A network is a group of connected devices that share data using agreed rules called protocols. Hackers attack networks through denial of service, man-in-the-middle and sniffing, phishing, malware, password guessing and unpatched flaws. You prevent most of it with patching, firewalls, encryption, strong authentication, network segmentation, monitoring with an IDS or IPS, tested backups and trained users.
Key takeaways
- A network is devices plus links plus protocols. Models such as OSI and TCP/IP describe how those protocols are layered; they are not protocols you "choose between".
- TCP is reliable and connection-based. UDP is connectionless and does not retransmit lost packets. Both run over IP.
- An IDS is a defence that detects suspicious activity. It is not an attack. An IPS goes further and blocks it.
- Common attacks are DoS and DDoS, man-in-the-middle, sniffing, spoofing, phishing, malware and password attacks.
- Defence works in layers: patching, firewalls, encryption, MFA, segmentation, monitoring, backups and training.
What is a network?
A network is two or more devices connected so they can exchange data. The devices can be computers, phones, printers, servers or sensors. They connect by cables or wireless links through switches, routers and access points. A small network in one building is a LAN. A network that spans cities or countries is a WAN, and the internet is the largest WAN, made from many networks joined together.
For devices to understand each other they need shared rules, and those rules are protocols. A protocol defines the format and order of messages, for example how a browser asks for a page (HTTP) or how a name is turned into an address (DNS).
Protocols and models: a quick, correct overview
OSI and TCP/IP are reference models, and UDP is one protocol within TCP/IP, so they are not three types of protocol. Here is the right picture.
- The OSI model is a seven-layer reference model from ISO: Physical, Data Link, Network, Transport, Session, Presentation, Application. It is a way to think and talk about where a function belongs, and is used mostly for teaching and troubleshooting.
- The TCP/IP model is the practical four- or five-layer model the internet is built on: link, internet (IP), transport (TCP or UDP) and application.
- TCP (Transmission Control Protocol) sets up a connection, numbers the data, acknowledges it and retransmits anything lost. It is reliable and used for web, email and file transfer.
- UDP (User Datagram Protocol) sends independent packets with no connection and no retransmission. It is lighter and faster to start, and suits DNS queries, voice and video, where a late packet is useless. If reliability is needed on top of UDP, the application must provide it.
Our guides to the TCP/IP model and common network protocols go further.
Common network attacks, how they work and how to stop them
Understanding an attack is how defenders learn what to block and what to log. The table gives the essentials, and the sections after it explain the main ones.
| Attack | What it does | Main defences |
|---|---|---|
| Denial of service (DoS) and distributed DoS (DDoS) | Overwhelms a service with requests so legitimate users cannot reach it. A DDoS uses many compromised machines at once. | Rate limiting, upstream DDoS protection or a CDN, redundancy, capacity planning |
| Man-in-the-middle (MITM) | An attacker positions themselves between two parties to read or alter their traffic | TLS everywhere, certificate checks, secure Wi-Fi, ARP inspection on switches |
| Sniffing | Capturing traffic on a network to read cleartext data such as passwords | Encrypt traffic, use switched networks, avoid cleartext protocols |
| Spoofing (ARP, DNS, IP) | Forging addresses or replies so traffic goes somewhere it should not | Dynamic ARP inspection, DNSSEC, ingress filtering, secure DNS resolvers |
| Phishing and social engineering | Tricks a person into giving credentials or running malware | User training, email filtering, MFA, reporting channels |
| Malware and ransomware | Software that steals, damages or encrypts data | Patching, endpoint protection, least privilege, offline backups |
| Password attacks | Guessing or reusing credentials, including brute force and credential stuffing | Strong unique passwords, MFA, account lockout, rate limits |
| Exploiting unpatched vulnerabilities | Using a known flaw in software or a device | Patch management, vulnerability scanning, removing unused services |
| Rogue access point or evil twin | A fake Wi-Fi network that lures users to connect | 802.1X, wireless intrusion detection, user awareness |
Denial of service and DDoS
DoS is not the "oldest" or the only attack; it is simply one that attacks availability instead of secrecy. A single machine flooding a server is DoS. When thousands of infected machines, a botnet, do it together, it is DDoS and far harder to block by address alone. Mitigation usually happens upstream, at the ISP or a DDoS protection service, because by the time the flood reaches your firewall your link may already be full.
Man-in-the-middle and sniffing
These are separate. Sniffing is passive: the attacker only listens, which works when traffic is unencrypted and the attacker can see it, for example on an open Wi-Fi network or through a compromised switch port. MITM is active: the attacker intercepts and may change messages, often by ARP spoofing on a LAN or by running a fake access point. Using HTTPS, SSH and VPNs makes both far less useful to an attacker, because intercepted data is encrypted. A browser warning about a certificate is often the first sign of a MITM attempt, so never click through it.
Spoofing
Network protocols were designed in a more trusting era. ARP has no authentication, so a device can claim an address that is not its own. On managed switches, features such as dynamic ARP inspection and DHCP snooping block this. Attackers also forge DNS answers to send users to fake sites, which DNSSEC and trusted resolvers help prevent.
Phishing, malware and passwords
These attack people and endpoints, not network protocols, but they are how most real intrusions begin. A user opens an attachment, malware runs and the attacker is inside. That is why network security cannot be separated from endpoint security and user training.
What is an IDS and an IPS?
An Intrusion Detection System (IDS) monitors traffic or hosts for suspicious behaviour and raises alerts. An Intrusion Prevention System (IPS) sits in line with traffic and can also block what it detects. Earlier text on this page called IDS an attack, which is the opposite of the truth: it is a defence.
- Network-based (NIDS/NIPS): watches traffic on a network segment, usually at a boundary or a mirrored switch port. It looks at packets at the network, transport and application layers.
- Host-based (HIDS/HIPS): runs on a single server or workstation, watching logs, files, processes and system calls.
- Signature-based detection matches known attack patterns. Anomaly-based detection flags traffic that differs from a normal baseline. Signatures are precise but miss new attacks; anomaly detection can find new ones but raises more false alarms.
How to prevent network attacks: a layered approach
- Patch regularly. Keep operating systems, network devices and applications updated. Track known flaws in the National Vulnerability Database for the software you run.
- Use firewalls and default-deny rules. Allow only the traffic a system needs, and close unused ports.
- Segment the network. Put servers, staff, guests and IoT devices in separate VLANs or zones, so one compromised device cannot reach everything.
- Encrypt in transit. Use TLS, SSH and VPNs, and WPA2 or WPA3 for Wi-Fi. Retire Telnet, FTP and plain HTTP.
- Use strong authentication. Multi-factor authentication and unique passwords stop most credential attacks.
- Apply least privilege. Users and services get only the access they need.
- Monitor and log. Send logs from firewalls, servers and devices to a central place, deploy an IDS or IPS, and have someone review alerts.
- Back up and test restores. Keep an offline copy, so ransomware cannot encrypt your only backup.
- Train people. Phishing awareness and a simple way to report something suspicious are among the highest-value defences.
- Scan and assess regularly. Vulnerability assessments find weaknesses before attackers do.
Frameworks help organise this. The NIST Cybersecurity Framework groups security work into functions such as identify, protect, detect, respond and recover, and MITRE ATT&CK catalogues the techniques real attackers use, which is valuable when you design detections.
A note on testing and the law
Security professionals test networks to find weaknesses, but only with written authorisation from the owner. In India, accessing or disrupting a computer system without permission is an offence under the Information Technology Act, 2000, even if you meant no harm. Practise in your own lab on virtual machines you control, and report real incidents to the organisation concerned and to CERT-In.
Next steps
Build a small lab with two virtual machines and a virtual switch, capture traffic, and see TCP and UDP for yourself. To learn network defence and testing properly, see the Certified Ethical Hacking CEH v13 AI course, which is built around the current CEH v13 version, or start with the computer networking course. For further reading, see networking protocols for beginners.
Related reading
Frequently Asked Questions
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Wow
0
Sad
0
Angry
0