Skip to content

Instantly share code, notes, and snippets.

@adampielak
Forked from williamzujkowski/ai-firewall-rules.sh
Created December 3, 2025 12:09
Show Gist options
  • Select an option

  • Save adampielak/f20ec7ecd0cf266d5c6b0e842117992b to your computer and use it in GitHub Desktop.

Select an option

Save adampielak/f20ec7ecd0cf266d5c6b0e842117992b to your computer and use it in GitHub Desktop.
Network segmentation firewall rules for AI VLAN using iptables
#!/bin/bash
# Dream Machine Professional firewall rules for AI VLAN
# Network segmentation for AI workloads
# AI VLAN Configuration
AI_VLAN="10.0.50.0/24"
INTERNAL_REPO="10.0.10.5"
# Allow: AI VLAN -> Internal model repository
iptables -A FORWARD -s $AI_VLAN -d $INTERNAL_REPO -j ACCEPT
# Allow: AI VLAN -> Specific whitelisted APIs (OpenAI, Hugging Face)
iptables -A FORWARD -s $AI_VLAN -d api.openai.com -j ACCEPT
iptables -A FORWARD -s $AI_VLAN -d huggingface.co -j ACCEPT
# Block: AI VLAN -> Home network
iptables -A FORWARD -s $AI_VLAN -d 10.0.1.0/24 -j DROP
# Block: AI VLAN -> Management network
iptables -A FORWARD -s $AI_VLAN -d 10.0.0.0/24 -j DROP
# Log: All AI VLAN traffic for monitoring
iptables -A FORWARD -s $AI_VLAN -j LOG --log-prefix "AI-VLAN: "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment