Sandbox-Umgebung zum Testen von OpenWRT x86 in Docker auf vm-600.
Ziel: Firewall-Konzepte, DHCP, VLANs und NAT verstehen bevor die echte VM aufgesetzt wird.
Status: ✅ Vollständig getestet — DHCP, VLANs, Firewall-Zonen verifiziert
Zuletzt aktualisiert: 2026-03-22
OpenWRT wurde erfolgreich auf vm-600 in Docker gestartet:
| Parameter | Wert |
|---|---|
| Image | openwrt/rootfs:x86-64 (SNAPSHOT r33495-2f74f9188f) |
| Kernel | 6.12.63 (Host-Kernel via privileged) |
| Start | docker run -d --name openwrt-test --privileged openwrt/rootfs:x86-64 /sbin/init |
| Status | ✅ Startet sauber, alle Dienste (dnsmasq, netifd) aktiv |
| Test | Ergebnis | Details |
|---|---|---|
| DHCP statische Lease (UCI) | ✅ | uci set dhcp.host.mac/ip funktioniert |
| VLAN (DSA bridge-vlan) | ✅ | network.vlanX=bridge-vlan korrekt gesetzt |
| DHCP Pool pro VLAN | ✅ | Jedes Interface bekommt eigenen Pool |
| Firewall-Zonen pro VLAN | ✅ | Named zones mit network-Liste |
| Inter-VLAN Forwarding | ✅ | forwarding src/dest Syntax verifiziert |
OpenWRT SNAPSHOT (und aktuelle Stable-Versionen) verwenden fw4/nftables, nicht mehr iptables!
# Korrekter Befehl für Firewall-Regeln:
nft list ruleset
# NICHT mehr:
# iptables -L -n -v (veraltet, zeigt nichts)
OpenWRT bietet offizielle x86/64 Images die in Docker lauffähig sind.
Der Container simuliert einen Router mit LAN/WAN-Interfaces — ideal für Tests.
Einschränkungen in Docker:
# Offizielles OpenWRT x86/64 Docker Image (SNAPSHOT)
sudo docker pull openwrt/rootfs:x86-64
# Schnellstart für Tests (privileged für nftables/networking)
sudo docker run -d --name openwrt-test --privileged openwrt/rootfs:x86-64 /sbin/init
# In Container einloggen
sudo docker exec -it openwrt-test /bin/sh
/etc/config/network)config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0'
config interface 'lan'
option device 'br-lan'
option proto 'static'
list ipaddr '192.168.1.1/24'
Hinweis: In Docker läuft kein wan Interface — nur lan (eth0 als Bridge).
/etc/config/firewall)config defaults
option syn_flood 1
option input REJECT # Default: alles ablehnen
option output ACCEPT
option forward REJECT
config zone
option name lan
option input ACCEPT # LAN: alles erlaubt
option output ACCEPT
option forward ACCEPT
config zone
option name wan
option input REJECT # WAN: nur Replies
option masq 1 # NAT/Masquerading aktiv
option mtu_fix 1
config forwarding
option src lan
option dest wan # LAN → WAN: erlaubt
/etc/config/dhcp)config dhcp 'lan'
option interface 'lan'
option start '100' # Range: 192.168.1.100 - 192.168.1.250
option limit '150'
option leasetime '12h'
# Alle nftables-Regeln anzeigen
nft list ruleset
# Nur NAT-Tabelle
nft list table ip nat
# Firewall via UCI anzeigen
uci show firewall
| Chain | Hook | Bedeutung |
|---|---|---|
input |
filter/input | Eingehend an Router selbst |
forward |
filter/forward | Routing zwischen Interfaces |
output |
filter/output | Vom Router ausgehend |
input_lan / input_wan |
- | Zonen-spezifische Regeln |
forward_lan |
- | Weiterleitung aus LAN |
# Statische Lease für Server
uci set dhcp.myserver=host
uci set dhcp.myserver.name='vm-600'
uci set dhcp.myserver.mac='AA:BB:CC:DD:EE:FF'
uci set dhcp.myserver.ip='192.168.1.100'
uci commit dhcp
# DHCP für Management-VLAN (Interface: mgmt)
uci set dhcp.mgmt=dhcp
uci set dhcp.mgmt.interface='mgmt'
uci set dhcp.mgmt.start='100'
uci set dhcp.mgmt.limit='50'
uci set dhcp.mgmt.leasetime='1h'
# DHCP für Server-VLAN
uci set dhcp.servers=dhcp
uci set dhcp.servers.interface='servers'
uci set dhcp.servers.start='10'
uci set dhcp.servers.limit='100'
uci set dhcp.servers.leasetime='24h'
uci commit dhcp
Wichtig: option interface muss dem UCI-Namen des Network-Interface entsprechen (nicht dem Device-Namen).
OpenWRT verwendet seit 21.02 DSA (Distributed Switch Architecture) für VLANs.
Kein altes config switch mehr — stattdessen bridge-vlan.
# VLAN 10 auf br-lan Bridge
uci set network.vlan10=bridge-vlan
uci set network.vlan10.device='br-lan'
uci set network.vlan10.vlan='10'
uci add_list network.vlan10.ports='eth0:t' # :t = tagged
# Interface für VLAN 10
uci set network.mgmt=interface
uci set network.mgmt.device='br-lan.10'
uci set network.mgmt.proto='static'
uci set network.mgmt.ipaddr='10.10.10.1'
uci set network.mgmt.netmask='255.255.255.0'
# VLAN 20 (DMZ)
uci set network.vlan20=bridge-vlan
uci set network.vlan20.device='br-lan'
uci set network.vlan20.vlan='20'
uci add_list network.vlan20.ports='eth0:t'
uci set network.dmz=interface
uci set network.dmz.device='br-lan.20'
uci set network.dmz.proto='static'
uci set network.dmz.ipaddr='172.16.10.1'
uci set network.dmz.netmask='255.255.255.0'
uci commit network
| Suffix | Bedeutung |
|---|---|
eth0 (kein suffix) |
Untagged (Access-Port) |
eth0:t |
Tagged (Trunk-Port) |
eth0:u |
Explizit Untagged |
# Zone für Management-VLAN
uci set firewall.mgmt_zone=zone
uci set firewall.mgmt_zone.name='mgmt'
uci set firewall.mgmt_zone.input='ACCEPT'
uci set firewall.mgmt_zone.output='ACCEPT'
uci set firewall.mgmt_zone.forward='REJECT'
uci add_list firewall.mgmt_zone.network='mgmt'
# Zone für Server-VLAN
uci set firewall.servers_zone=zone
uci set firewall.servers_zone.name='servers'
uci set firewall.servers_zone.input='ACCEPT'
uci set firewall.servers_zone.output='ACCEPT'
uci set firewall.servers_zone.forward='REJECT'
uci add_list firewall.servers_zone.network='servers'
# Inter-VLAN Forwarding: mgmt → servers erlaubt
uci set firewall.mgmt_to_srv=forwarding
uci set firewall.mgmt_to_srv.src='mgmt'
uci set firewall.mgmt_to_srv.dest='servers'
uci commit firewall
# Port-Forward: WAN Port 8080 → LAN 192.168.1.148:80
uci add firewall redirect
uci set firewall.@redirect[-1].name='Test-HTTP'
uci set firewall.@redirect[-1].target='DNAT'
uci set firewall.@redirect[-1].src='wan'
uci set firewall.@redirect[-1].dest='lan'
uci set firewall.@redirect[-1].proto='tcp'
uci set firewall.@redirect[-1].src_dport='8080'
uci set firewall.@redirect[-1].dest_ip='192.168.1.148'
uci set firewall.@redirect[-1].dest_port='80'
uci commit firewall
/etc/init.d/firewall restart
# Prüfen ob Regel angelegt wurde:
uci show firewall | grep redirect
Für Tests mit echtem WAN-Interface:
# docker-compose.yml
services:
openwrt:
image: openwrt/rootfs:x86-64
container_name: openwrt-test
privileged: true
networks:
openwrt-wan:
ipv4_address: 172.20.0.2
openwrt-lan:
ipv4_address: 192.168.1.1
restart: unless-stopped
networks:
openwrt-wan:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/24
openwrt-lan:
driver: bridge
ipam:
config:
- subnet: 192.168.1.0/24
gateway: 192.168.1.1
| Aspekt | OPNsense | OpenWRT |
|---|---|---|
| UI | Web-GUI (Bootstrap) | LuCI (minimalistisch) |
| Konfiguration | XML-basiert | UCI (Unified Configuration Interface) |
| Firewall | pf (BSD) | nftables/fw4 (ab 22.03+) |
| DHCP | ISC dhcpd | dnsmasq |
| Paketmanager | pkg (FreeBSD) | opkg |
| VLANs | GUI-Wizard | UCI + DSA (ab 21.02) |
| Logs | /var/log/ persistent | /tmp/ (RAM, nicht persistent!) |
| Port-Forward-Syntax | GUI-Wizard | uci add firewall redirect |
| NAT-Prüfung | pfctl -s nat | nft list table ip nat |
| VLAN-Konfig | GUI: Interfaces → VLANs | uci set network.vlanX=bridge-vlan |
| DHCP pro VLAN | GUI: Services → DHCP | uci set dhcp.name.interface='vlan_iface' |
sudo docker stop openwrt-test && sudo docker rm openwrt-test
# Image behalten für Stufe 2 oder löschen:
sudo docker rmi openwrt/rootfs:x86-64
Nach erfolgreichem Docker-Test → Stufe 2:
openwrt/rootfs