This project implements whitelist-based host-to-host access control in a Mininet network using Open vSwitch and OpenFlow 1.3. Only approved source and destination pairs receive forwarding rules. All other traffic is denied by a default drop rule.
- Enforces communication policy from
config/whitelist.json - Builds a single-switch Mininet topology with hosts
h1throughh4 - Installs OpenFlow rules directly on the switch without a remote controller
- Verifies both installed flows and end-to-end connectivity
- Includes unit tests for policy validation and rule generation
The policy file defines:
- the switch name
- each host's IP, MAC address, and switch port
- directional whitelist entries such as
["h1", "h2"]
For every allowed pair, the system installs:
- one ARP forwarding rule
- one IPv4 forwarding rule
It also installs a default low-priority drop rule so unmatched traffic is blocked.
config/whitelist.json: whitelist policy and host inventorysdn_acl/policy.py: policy loading, validation, connectivity expectations, flow generationsdn_acl/runtime.py: Open vSwitch command helpers for install and verificationtopology.py: Mininet topology launcherverify_access.py: live verification for flows and reachabilitytests/test_policy.py: unit tests for policy behaviordemo.sh: quick end-to-end demo scriptreport/report.md: report-ready write-up
Run this project in a Linux environment with:
- Python 3
- Mininet
- Open vSwitch
ovs-ofctlsudoaccess for Mininet and OVS commands
Typical usage assumes Mininet and OVS are already installed and working.
The whitelist is stored in config/whitelist.json.
Example:
{
"switch": "s1",
"hosts": [
{ "name": "h1", "ip": "10.0.0.1/24", "mac": "00:00:00:00:00:01", "port": 1 },
{ "name": "h2", "ip": "10.0.0.2/24", "mac": "00:00:00:00:00:02", "port": 2 },
{ "name": "h3", "ip": "10.0.0.3/24", "mac": "00:00:00:00:00:03", "port": 3 },
{ "name": "h4", "ip": "10.0.0.4/24", "mac": "00:00:00:00:00:04", "port": 4 }
],
"whitelist": [
["h1", "h2"],
["h2", "h1"],
["h1", "h3"],
["h3", "h1"]
]
}Whitelist entries are directional.
["h1", "h2"]allows traffic fromh1toh2["h2", "h1"]allows traffic fromh2toh1
For successful ping verification, both directions must be present. ICMP echo requires the request path and the reply path, so a one-way whitelist entry is not enough for end-to-end reachability.
With the sample policy:
h1 <-> h2is allowedh1 <-> h3is allowed- any communication involving
h4is blocked h2 <-> h3is blocked
Run unit tests:
python3 -m unittest discover -s tests -vStart the Mininet topology with an interactive CLI:
sudo python3 topology.pyStart the topology, install rules, and exit:
sudo python3 topology.py --no-cliRun live verification:
sudo python3 verify_access.pyRun the full demo script:
chmod +x demo.sh
./demo.shAfter launching topology.py, test reachability from the Mininet CLI:
h1 ping -c 1 h2
h1 ping -c 1 h3
h1 ping -c 1 h4
h2 ping -c 1 h3Expected results:
h1 -> h2: reachableh1 -> h3: reachableh1 -> h4: blockedh2 -> h3: blocked
Inspect installed switch rules with:
sudo ovs-ofctl -O OpenFlow13 dump-flows s1verify_access.py checks two things:
- Expected flow matches appear in the switch flow dump.
- Actual host-to-host connectivity matches the whitelist policy.
If verification fails, the script prints each mismatch and exits with a non-zero status.
- The topology uses one Open vSwitch bridge in secure fail mode.
- Rules are installed directly on the switch, so no external controller is required.
- Only ARP and IPv4 traffic for approved host pairs is forwarded.
- Unmatched traffic is dropped by the default rule.
Submission material is available in report/report.md. Supporting notes for report assets are in report/README.md.