Projekte & Automatisierung

Howto Gäste WiFi

auf einem OpenWRT Router

Die Einstellungen werden nur hinzugefügt und nichts gelöscht! Evtl. müssen ifname & interface angepasst werden. Diese sind Einstellugen für den Linksys WRT1200AC. In dieser Konfiguration hat der Client im Gäste WiFi Zugriffe auf folgende Ports: 53,67-68, 80 & 443. Der Zugriff auf die Subnetze 192.168.0.0/16 wird unterbunden, somit besteht kein Zugriff auf das private Netzwerk, solange es sich in dem Bereich befindet.

nano /etc/config/dhcp 

config dhcp 'guest'
    option start '100'
    option leasetime '12h'
    option limit '150'
    option interface 'guest'

nano /etc/config/network 

config interface 'guest'
    option proto 'static'
    option ipaddr '10.0.0.1'
    option netmask '255.255.255.0'
    option ip6assign '60'


nano /etc/config/firewall

config zone
    option name 'guest'
    option forward 'DROP'
    option output 'ACCEPT'
    option network 'guest'
    option input 'DROP'

config forwarding
    option dest 'lan'
    option src 'guest'

# Allow DNS Guest -> Router
# Client DNS queries originate from dynamic UDP ports (>1023) 
config rule
    option name 'Allow DNS Queries'
    option src 'guest'
    option dest_port '53'
    option proto 'tcp udp'
    option target 'ACCEPT'
  
# Allow DHCP Guest -> Router
# DHCP communication uses UDP ports 67-68
config rule
    option name 'Allow DHCP request'
    option src 'guest'
    option src_port '67-68'
    option dest_port '67-68'
    option proto 'udp'
    option target 'ACCEPT'

nano /etc/config/wireless

config wifi-iface
    option device 'radio1'
    option mode 'ap'
    option ssid 'Access Point Guest'
    option network 'guest'
    option encryption 'psk2'
    option key 'GastZugang'

nano /etc/firewall.user

# Insert (-I) entries into your public zone's forwarding rule
## Reject all traffic
iptables -I forwarding_guest_rule -j DROP
## Reject all TCP traffic with reset flag to avoid unnessecary timeouts
iptables -I forwarding_guest_rule -p tcp -j DROP --reject-with tcp-reset

# Allow certain traffic
iptables -I forwarding_guest_rule -p tcp -m tcp --dport  0:65535 -j DROP -m comment --comment "Drop traffic on all tcp ports"
iptables -I forwarding_guest_rule -p udp -m udp --dport  0:65535 -j DROP -m comment --comment "Drop traffic on all udp ports"
iptables -I forwarding_guest_rule -p tcp -m tcp --dport 80 -j ACCEPT -m comment --comment "Allow traffic on port 80"
iptables -I forwarding_guest_rule -p tcp -m tcp --dport 443 -j ACCEPT -m comment --comment "Allow traffic on port 443"
# Reject traffic with destination LAN
iptables -I forwarding_guest_rule -d 192.168.0.0/16 -j DROP
# Reject traffic with destination VPN
iptables -I forwarding_guest_rule -d 10.0.0/24 -j DROP