OpenWRT und VLAN

Den schulischen APs der Reihe nach beizubringen, dass sie nun VLAN können und dass

  • auf Grau der AP verwaltet wird und hierbei seine IP vom grauen DHCP erhält,
  • Blau unser öffentliches Netz ist (HotSpot Authentifizierung),
  • auf Pink irgendwann in ferner Zukunft das Lehrernetz gefunden werden soll (mit Radius-Auth – man darf ja noch träumen)
  • und in Grün das interne Netz für die Laptops läuft, die ihre IP vom Schulserver erhalten,

war die Aufgabe. Dies auf der Oberfläche eines jeden APs einzeln zusammen zu klicken dauert viel zu lange. Also kopiert man sich die Konfiguration von einem funktionierenden AP auf alle anderen, bootet diese insgesamt zwei mal neu und voila – es tut.

Erst einmal VLAN ermöglichen:

opkg install kmod-macvlan

Dann neu booten. Mit ifconfig angesehen soll es am Ende so aussehen:

    br-blue Link encap:Ethernet HWaddr 64:70:02:78:1D:5F
    inet6 addr: fd34:cf26:d77b::1/60 Scope:Global
    inet6 addr: fe80::6670:2ff:fe78:1d5f/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:100 errors:0 dropped:0 overruns:0 frame:0
    TX packets:166 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:9114 (8.9 KiB) TX bytes:14396 (14.0 KiB)

    br-green Link encap:Ethernet HWaddr 64:70:02:78:1D:5F
    inet6 addr: fd34:cf26:d77b:10::1/60 Scope:Global
    inet6 addr: fe80::6670:2ff:fe78:1d5f/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:2354 errors:0 dropped:0 overruns:0 frame:0
    TX packets:166 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:749902 (732.3 KiB) TX bytes:14396 (14.0 KiB)

    br-grey Link encap:Ethernet HWaddr 64:70:02:78:1D:5F
    inet addr:192.168.0.139 Bcast:192.168.0.255 Mask:255.255.255.0
    inet6 addr: fd34:cf26:d77b:20::1/60 Scope:Global
    inet6 addr: fe80::6670:2ff:fe78:1d5f/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:1847 errors:0 dropped:0 overruns:0 frame:0
    TX packets:1689 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:175780 (171.6 KiB) TX bytes:431449 (421.3 KiB)

    br-pink Link encap:Ethernet HWaddr 64:70:02:78:1D:5F
    inet6 addr: fe80::6670:2ff:fe78:1d5f/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:1773 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:0 (0.0 B) TX bytes:574414 (560.9 KiB)

    eth0 Link encap:Ethernet HWaddr 64:70:02:78:1D:5F
    inet6 addr: fe80::6670:2ff:fe78:1d5f/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:9283 errors:0 dropped:167 overruns:0 frame:0
    TX packets:7976 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:1947524 (1.8 MiB) TX bytes:5061428 (4.8 MiB)
    Interrupt:4

    eth0.1 Link encap:Ethernet HWaddr 64:70:02:78:1D:5F
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:2335 errors:0 dropped:0 overruns:0 frame:0
    TX packets:1729 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:211878 (206.9 KiB) TX bytes:434729 (424.5 KiB)

    eth0.2 Link encap:Ethernet HWaddr 64:70:02:78:1D:5F
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:4566 errors:0 dropped:0 overruns:0 frame:0
    TX packets:801 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:1141302 (1.0 MiB) TX bytes:80814 (78.9 KiB)

    eth0.3 Link encap:Ethernet HWaddr 64:70:02:78:1D:5F
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:2208 errors:0 dropped:0 overruns:0 frame:0
    TX packets:3708 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:410171 (400.5 KiB) TX bytes:3944129 (3.7 MiB)

    eth0.4 Link encap:Ethernet HWaddr 64:70:02:78:1D:5F
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:1734 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:0 (0.0 B) TX bytes:569420 (556.0 KiB)

    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    inet6 addr: ::1/128 Scope:Host
    UP LOOPBACK RUNNING MTU:65536 Metric:1
    RX packets:6 errors:0 dropped:0 overruns:0 frame:0
    TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:288 (288.0 B) TX bytes:288 (288.0 B)

    wlan0 Link encap:Ethernet HWaddr 64:70:02:78:1D:5F
    inet6 addr: fe80::6670:2ff:fe78:1d5f/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:595 errors:0 dropped:0 overruns:0 frame:0
    TX packets:2903 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:63160 (61.6 KiB) TX bytes:940426 (918.3 KiB)

    wlan0-1 Link encap:Ethernet HWaddr 66:70:02:78:1D:5F
    inet6 addr: fe80::6470:2ff:fe78:1d5f/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:3617 errors:0 dropped:0 overruns:0 frame:0
    TX packets:1995 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:3938021 (3.7 MiB) TX bytes:460510 (449.7 KiB)

Einmal /etc/config/network anpassen:

    config interface 'loopback'
    option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'

    config globals 'globals'
    option ula_prefix 'fd34:cf26:d77b::/48'

    config interface 'grey'
    option ifname 'eth0.1'
    option type 'bridge'
    option proto 'dhcp'
    option ip6assign '60'

    config interface 'green'
    option ifname 'eth0.2'
    option type 'bridge'
    option ip6assign '60'

    config interface 'blue'
    option ifname 'eth0.3'
    option type 'bridge'
    option ip6assign '60'

    config interface 'pink'
    option ifname 'eth0.4'
    option type 'bridge'
    option proto 'dhcp'
    option ip6assign '60'

    config switch
    option name 'switch0'
    option reset '1'
    option enable_vlan '1'

    config switch_vlan
    option device 'switch0'
    option vlan '1'
    option vid '1
    option ports '0t 1t 2t 3t 4t 5t'

    config switch_vlan
    option device 'switch0'
    option vlan '2'
    option vid '2'
    option ports '0t 1t 2t 3t 4t 5t'

    config switch_vlan
    option device 'switch0'
    option vlan '3'
    option vid '3'
    option ports '0t 1t 2t 3t 4t 5t'

    config switch_vlan
    option device 'switch0'
    option vlan '4'
    option vid '4'
    option ports '0t 1t 2t 3t 4t 5t'

Und /etc/config/wireless anpassen:

    config wifi-device 'radio0'
    option type 'mac80211'
    option hwmode '11ng'
    option path 'platform/ath9k'
    list ht_capab 'SHORT-GI-40'
    list ht_capab 'DSSS_CCK-40'
    option country 'US'
    option txpower '27'
    option channel '4'

    config wifi-iface
    option device 'radio0'
    option network 'green'
    option mode 'ap'
    option ssid 'intern'
    option encryption 'psk2'
    option key 'geheim'

    config wifi-iface
    option device 'radio0'
    option mode 'ap'
    option encryption 'none'
    option ssid 'public'
    option network 'blue'

Die DNS Dienste auf dem AP wegwerfen, weil der DNS zentral läuft (auf Schulserver oder auf dem grauen Server für die Infrastruktur):

/etc/init.d/dnsmasq stop
killall dnsmasq # nur zur Sicherheit
/etc/init.d/dnsmasq disable

Dann noch einmal neu booten und vor Ort testen, nachdem man die VLAN Einstellungen auch auf den Switches so angepasst hat, dass man seinen AP wieder findet.