Network Security: Introduction
A small company network has eight machines, one firewall and a policy document that says "only the web server is reachable from the Internet". Is that true? Nobody knows until somebody checks: lists every device, finds every listening service, reads the firewall rules in the order the firewall reads them, and tests the claim from outside and from inside. That check is a network security assessment, and keeping its results true day after day is network defence. This course teaches both, from the side of the people who own the network.
Networking for Security taught you to read packets and to run the analyst's tools. Here you use them to answer the owner's questions: What do we have? What does it expose? Who can reach what? Would we notice an intruder? What do we fix first?
The lab network of this course
Every example, transcript and exercise uses the same fictional network, 10.10.0.0/24 in the domain lab.test. It exists only on paper and in the simulations; you never scan it, and nothing in this course sends a packet to any real host.
| Host | Address | Role | Services (as documented) |
|---|---|---|---|
fw.lab.test |
10.10.0.1 | gateway and firewall | SSH for admins |
ws05.lab.test |
10.10.0.5 | staff workstation | none |
www.lab.test |
10.10.0.10 | public web server | 80, 443, SSH 22 |
admin01.lab.test |
10.10.0.21 | administrator's workstation | none |
mail.lab.test |
10.10.0.25 | mail server | 25, 587, 143 |
db.lab.test |
10.10.0.30 | PostgreSQL database | 5432 |
prn40.lab.test |
10.10.0.40 | network printer | 80, 9100 |
ns.lab.test |
10.10.0.53 | internal DNS | 53 |
files.lab.test |
10.10.0.60 | file server | 445 |
The table is "as documented". Part of the job is to find where reality differs: the figure already shows Telnet on the printer and FTP on the file server, which nobody wrote down. Outside addresses come from the documentation ranges 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 (RFC 5737).
What you will be able to do
| Section | Questions it answers | What you run |
|---|---|---|
| Discovery and inventory | What devices and services exist? How do scanners decide "open", "closed", "filtered"? How noisy is a scan? | inventory merging in pandas, Nmap connect scans and XML output on loopback, a reachability graph in NetworkX, TLS review with OpenSSL and Nmap scripts |
| Common network weaknesses | The seven classic weaknesses, each with how to find it and how to fix it | a Python checker for each, on the lab inventory |
| Segmentation and zero trust | Zones, DMZs, VLANs and ACLs, microsegmentation, NIST SP 800-207, bastions | the subnet lab, a flow-policy checker |
| Firewalls | Stateless vs stateful, nftables rule order, shadowing, egress, logging, host and cloud firewalls | the firewall-rules lab, nft -c syntax checks, a shadowed-rule finder |
| VPNs and remote access | IPsec/IKEv2, WireGuard, OpenVPN, split tunnelling, hardening | X25519 key pairs in Python, a config linter |
| Intrusion detection | Signatures vs anomalies, Suricata/Snort rules, Zeek logs, tuning | a tiny rule matcher, pandas on synthetic Zeek logs |
| Vulnerability scanning | Greenbone/OpenVAS and Nessus, false positives, CVE and CVSS, prioritisation | scanner transcripts, a prioritisation script |
| The assessment workflow | Scope → inventory → review → validate safely → impact → remediation → retest | one worked assessment of the lab network |
How the examples run
```python runexamples run in your browser (Pyodide) on data written into the example: DHCP leases, ARP tables, Zeek logs, rule lists. Edit them and run them again.```bash runblocks are recorded sandbox sessions: real Nmap, Ncat, OpenSSL andnftruns, as an ordinary user, in a container with no network except loopback. A session that scans starts its own services on127.0.0.1and scans only those.- Tools that can't run there (loading firewall rules, live captures, Suricata, Zeek, Greenbone, Nessus, VPN daemons) appear as plain
```consoletranscripts labelled lab session, with the scope stated, on lab addresses. - The
firewall-rules,subnetandtcp-handshakelabs animate the mechanisms.
Here is the first check of the course: a web server and a forgotten debugging listener start in the sandbox, and a connect scan finds both.
python3 -m http.server 8080 --bind 127.0.0.1 >http.log 2>&1 &
ncat -lk 127.0.0.1 4444 >/dev/null 2>&1 &
for i in $(seq 50); do [ "$(ss -Htln | wc -l)" -ge 2 ] && break; sleep 0.1; done
echo "documented: 8080"
nmap -sT -p 22,4444,8080 127.0.0.1 | grep '/tcp'
kill %1 %2documented: 8080
22/tcp closed ssh
4444/tcp open krb524
8080/tcp open http-proxy
The documented service is there; so is an undocumented one on 4444. Comparing what should be with what is is the core move of every assessment in this course.
The rules this course keeps
- Authorization first. Scanning, capturing or testing networks you don't own or don't have written permission for can be a crime. The next lesson, Scope and Authorization for Network Assessments, builds on Authorization, Scope and Rules of Engagement and the law lessons of Security Foundations.
- Mechanism → detection → fix. Every weakness is shown with how you find it and how you remove it.
- Only toy targets. Sessions scan only services they start on
127.0.0.1; everything else is simulation, synthetic data or a labelled transcript on lab addresses.
Before you start
You need the material of Networking for Security: TCP and its handshake, ports, DNS, the tools nmap, ss, tcpdump and nft. Linux firewall administration is in Linux Administration (nftables, ufw and firewalld); this course reviews rulesets rather than teaching the syntax from zero. The one-page overview Network Defense in the survey course is a good warm-up.
Test yourself
What is the core move of a network assessment, as shown by the first session?
- Exploiting every open port
- Comparing what is documented with what is actually reachable
- Turning the firewall off to see everything
- Counting the number of hosts
Which hosts do the sandbox sessions in this course scan?
- The lab network 10.10.0.0/24
- Any host the learner owns
- Only services the session itself started on 127.0.0.1
- Public test servers
Why are Suricata and Greenbone shown as transcripts instead of sessions?
- They are illegal
- They need capabilities, live traffic or services the sandbox doesn't have
- They have no command line
- They only run on Windows