New PPSK functionality

Mikrotik finally added PPSK into ROS :smiley:

I wonder if anybody tested this function yet ? I tried but with no luck unfortunately.

I tested on ax3 which is acting as CAPsMAN controller but his own radios are set to local and were not used until now.

I created 3 groups:

Columns: GROUP, PASSPHRASE, VLAN-ID
# GROUP        PASSPHRASE  VLAN-ID
0 TEST_VLAN20  test1234         20
1 TEST_VLAN30  test12345        30
2 TEST_VLAN88  test123456       88

Created 3 ACLs with SSID regexp where I added SSID I use for testing:

Columns: ACTION, MULTI-PASSPHRASE-GROUP, MATCH-COUNT
#  ACTION  MULTI-PASSPHRASE-GROUP  MATCH-COUNT
;;; PPSK_VLAN20
0  accept  TEST_VLAN20                     546
;;; PPSK_VLAN30
1  accept  TEST_VLAN30                        
;;; PPSK_VLAN88
2  accept  TEST_VLAN88                      20

But then, I must input password while setting up interfaces when using WPA/WPA2-PSK. If using security profile i don’t know where to add groups I created…

Ok, so eliminating CAPsMAN from equation, I’m using my ax2 that was CAP for testing.

This is new config:

p# 2024-09-28 06:34:20 by RouterOS 7.17beta2
# software id = 
#
# model = C52iG-5HaxD2HaxD
# serial number = 
/interface bridge
add admin-mac= auto-mac=no comment=defconf name=bridge \
    vlan-filtering=yes
/interface wifi
set [ find default-name=wifi1 ] channel.band=5ghz-ax .skip-dfs-channels=\
    10min-cac .width=20/40/80mhz configuration.mode=ap .ssid=MikroTik \
    disabled=no security.authentication-types=wpa2-psk .ft=yes .ft-over-ds=\
    yes
set [ find default-name=wifi2 ] channel.band=2ghz-ax .skip-dfs-channels=\
    10min-cac .width=20/40mhz configuration.mode=ap .ssid=MikroTik disabled=\
    no security.authentication-types=wpa2-psk .ft=yes .ft-over-ds=yes
/interface vlan
add interface=bridge name=VLAN20 vlan-id=20
add interface=bridge name=VLAN30 vlan-id=30
add interface=bridge name=VLAN40 vlan-id=40
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/interface wifi datapath
add bridge=bridge comment=VLAN20 disabled=no name=datapath20 vlan-id=20
add bridge=bridge comment=VLAN30 disabled=no name=datapath30 vlan-id=30
add bridge=bridge comment=VLAN40 disabled=no name=datapath40 vlan-id=40
/ip pool
add name=dhcp_pool1 ranges=192.168.20.2-192.168.20.254
add name=dhcp_pool2 ranges=192.168.30.2-192.168.30.254
add name=dhcp_pool3 ranges=192.168.40.2-192.168.40.254
/ip dhcp-server
add address-pool=dhcp_pool1 interface=VLAN20 name=dhcp1
add address-pool=dhcp_pool2 interface=VLAN30 name=dhcp2
add address-pool=dhcp_pool3 interface=VLAN40 name=dhcp3
/disk settings
set auto-media-interface=bridge auto-media-sharing=yes auto-smb-sharing=yes
/interface bridge port
add bridge=bridge comment=defconf interface=ether2 pvid=20
add bridge=bridge comment=defconf interface=ether3
add bridge=bridge comment=defconf interface=ether4
add bridge=bridge comment=defconf interface=ether5
add bridge=bridge comment=defconf interface=wifi1
add bridge=bridge comment=defconf interface=wifi2
/ip neighbor discovery-settings
set discover-interface-list=LAN
/ipv6 settings
set disable-ipv6=yes
/interface bridge vlan
add bridge=bridge tagged=bridge vlan-ids=20,30,40
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=ether1 list=WAN
add interface=VLAN20 list=LAN
add interface=VLAN30 list=LAN
add interface=VLAN40 list=LAN
/interface wifi access-list
add action=accept comment=VLAN20 disabled=no multi-passphrase-group=VLAN20 \
    ssid-regexp=MikroTik
add action=accept comment=VLAN30 disabled=no multi-passphrase-group=VLAN30 \
    ssid-regexp=MikroTik
add action=accept comment=VLAN40 disabled=no multi-passphrase-group=VLAN40 \
    ssid-regexp=MikroTik
/interface wifi security multi-passphrase
add disabled=no group=VLAN20 vlan-id=20
add disabled=no group=VLAN30 vlan-id=30
add disabled=no group=VLAN40 vlan-id=40
/ip address
add address=192.168.20.1/24 interface=VLAN20 network=192.168.20.0
add address=192.168.30.1/24 interface=VLAN30 network=192.168.30.0
add address=192.168.40.1/24 interface=VLAN40 network=192.168.40.0
/ip dhcp-client
add comment=defconf interface=ether1
/ip dhcp-server network
add address=192.168.20.0/24 gateway=192.168.20.1
add address=192.168.30.0/24 gateway=192.168.30.1
add address=192.168.40.0/24 gateway=192.168.40.1
/ip dns
set allow-remote-requests=yes
/ip firewall filter
add action=accept chain=input comment=\
    "defconf: accept established,related,untracked" connection-state=\
    established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=\
    invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment=\
    "defconf: accept to local loopback (for CAPsMAN)" dst-address=127.0.0.1
add action=drop chain=input comment="defconf: drop all not coming from LAN" \
    in-interface-list=!LAN
add action=accept chain=forward comment="defconf: accept in ipsec policy" \
    ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" \
    ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" \
    connection-state=established,related hw-offload=yes
add action=accept chain=forward comment=\
    "defconf: accept established,related, untracked" connection-state=\
    established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" \
    connection-state=invalid
add action=drop chain=forward comment=\
    "defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat \
    connection-state=new in-interface-list=WAN
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" \
    ipsec-policy=out,none out-interface-list=WAN
/ipv6 firewall address-list
add address=::/128 comment="defconf: unspecified address" list=bad_ipv6
add address=::1/128 comment="defconf: lo" list=bad_ipv6
add address=fec0::/10 comment="defconf: site-local" list=bad_ipv6
add address=::ffff:0.0.0.0/96 comment="defconf: ipv4-mapped" list=bad_ipv6
add address=::/96 comment="defconf: ipv4 compat" list=bad_ipv6
add address=100::/64 comment="defconf: discard only " list=bad_ipv6
add address=2001:db8::/32 comment="defconf: documentation" list=bad_ipv6
add address=2001:10::/28 comment="defconf: ORCHID" list=bad_ipv6
add address=3ffe::/16 comment="defconf: 6bone" list=bad_ipv6
/ipv6 firewall filter
add action=accept chain=input comment=\
    "defconf: accept established,related,untracked" connection-state=\
    established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=\
    invalid
add action=accept chain=input comment="defconf: accept ICMPv6" protocol=\
    icmpv6
add action=accept chain=input comment="defconf: accept UDP traceroute" \
    dst-port=33434-33534 protocol=udp
add action=accept chain=input comment=\
    "defconf: accept DHCPv6-Client prefix delegation." dst-port=546 protocol=\
    udp src-address=fe80::/10
add action=accept chain=input comment="defconf: accept IKE" dst-port=500,4500 \
    protocol=udp
add action=accept chain=input comment="defconf: accept ipsec AH" protocol=\
    ipsec-ah
add action=accept chain=input comment="defconf: accept ipsec ESP" protocol=\
    ipsec-esp
add action=accept chain=input comment=\
    "defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
add action=drop chain=input comment=\
    "defconf: drop everything else not coming from LAN" in-interface-list=\
    !LAN
add action=accept chain=forward comment=\
    "defconf: accept established,related,untracked" connection-state=\
    established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" \
    connection-state=invalid
add action=drop chain=forward comment=\
    "defconf: drop packets with bad src ipv6" src-address-list=bad_ipv6
add action=drop chain=forward comment=\
    "defconf: drop packets with bad dst ipv6" dst-address-list=bad_ipv6
add action=drop chain=forward comment="defconf: rfc4890 drop hop-limit=1" \
    hop-limit=equal:1 protocol=icmpv6
add action=accept chain=forward comment="defconf: accept ICMPv6" protocol=\
    icmpv6
add action=accept chain=forward comment="defconf: accept HIP" protocol=139
add action=accept chain=forward comment="defconf: accept IKE" dst-port=\
    500,4500 protocol=udp
add action=accept chain=forward comment="defconf: accept ipsec AH" protocol=\
    ipsec-ah
add action=accept chain=forward comment="defconf: accept ipsec ESP" protocol=\
    ipsec-esp
add action=accept chain=forward comment=\
    "defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
add action=drop chain=forward comment=\
    "defconf: drop everything else not coming from LAN" in-interface-list=\
    !LAN
/system logging
add topics=wireless
/system note
set show-at-login=no
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN

What I noticed, with this configuration when connecting with the password from the first ACL it allows to connect but can’t obtain IP address because wifi interface gets untagged for VLAN1 instead of the correct VLAN.

When trying to connect with password from other two groups it says that it can’t authenticate.

I left old password in security, only selected WPA/WPA2.

No success for now, but after going trough ROS wiki a little bit I did few changes to my configuration:

Only one PPSK group:

[admin@MikroTik] /interface/wifi/security/multi-passphrase> p
Columns: GROUP, PASSPHRASE, VLAN-ID
# GROUP  PASSPHRASE  VLAN-ID
0 VLANS  test1234         20
1 VLANS  test12345        30
2 VLANS  test123456       40

And test security config was created:

[admin@MikroTik] /interface/wifi/security> p
Flags: X - disabled 
 0   name="PPSK" authentication-types=wpa-psk,wpa2-psk 
     multi-passphrase-group=VLANS

but still no luck… Now interfaces don’t say that password is needed when I apply security profile and when entering password router accepts it but it doesn’t untag correct VLAN. It always untag VLAN1, never VLAN it’s suppose to untag… Both wifi interfaces are set to VLAN1 and admit all

EDIT:

Little bit of snooping around, so this is output from registration table for each password:

test1234:

[admin@MikroTik] /interface/wifi/registration-table> pr d
Flags: A - authorized 
 0 A interface=wifi1 ssid="MikroTik" mac-address=FE:D9:AD:F0:3D:7F uptime=5s 
     last-activity=0ms signal=-39 auth-type=ft-wpa2-psk band=5ghz-ax vlan-id=20

test12345:

[admin@MikroTik] /interface/wifi/registration-table> pr d
Flags: A - authorized 
 0 A interface=wifi1 ssid="MikroTik" mac-address=FE:D9:AD:F0:3D:7F uptime=2s 
     signal=-24 auth-type=ft-wpa2-psk band=5ghz-ax vlan-id=30

test123456:

[admin@MikroTik] /interface/wifi/registration-table> pr d
Flags: A - authorized 
 0 A interface=wifi1 ssid="MikroTik" mac-address=FE:D9:AD:F0:3D:7F uptime=2s 
     signal=-24 auth-type=ft-wpa2-psk band=5ghz-ax vlan-id=40

So it seems that VLANs are assigned correctly but for some reason bridge don’t untag them at all.

The idea about setting vlan-id in wifi driver is that wifi driver handles the VLAN tags, not bridge (bridge only filters traffic according to existing VLAN tags). Which IMO means you have a few errors in your setup. One is use of multiple datapaths (just noticed you only have them defined but not used), one should be enough. Default wifi access is tagless, which should be fine. My own philosophy, when it comes to VLAN setup, is to go all-tagged though, in this case this means setting datapath.vlan-id on wifi interfaces.

Then you have to let bridge know which tagged VLANs should be allowed to pass wifi ports:

Of course adding wifi1 and wifi2 to all relevant VLANs, including the one used for default wifi access. If you go with untagged default wifi access, then be careful PVID setting of wifiX bridge port (default is PVID=1, which is fine but you have to be aware of it as there is no ā€œuntaggedā€ frame on bridge the switch-like entity as soon as bridge is set with vlan-filtering=yes, at least not conceptually).

I’m an idiot… I didn’t even noticed that I didn’t tag wireless interfaces to VLANs… I foolishly presumed something more complicated is wrong… I did what you suggested and now PPSK is working like it’s supposed to. :smiley: :smiley: :smiley:

Now under bridge/vlans wifi interfaces are still dynamically untagged for VLAN1 (I presume that is because I left PVID on 1 and set to admit all) but correct VLAN gets untagged and there is internet connectivity (I presume this is where wireless assign correct PVID based on password I input)

Thank you @mkx for your help :smiley: :smiley: :smiley:

If you go with untagged default wifi access, then be careful PVID setting of wifiX bridge port (default is PVID=1, which is fine but you have to be aware of it as there is no ā€œuntaggedā€ frame on bridge the switch-like entity as soon as bridge is set with vlan-filtering=yes, at least not conceptually).

I never leave any port on PVID 1 when using ā€œadmit only untaggedā€, when I’m using VLANs i never left any port on PVID1. I generally untag them for mgmt network and disable them if they are not used.

I disabled datapath i created and still everything is working like it should. How can I have only one datapath for multiple VLANs ? I didn’t know that is possible ? I can add only one VLAN per datapath.

Do you actually have to add multiple VLAN IDs in datapath? My impression is that datapath VLAN ID is a default, but if other mechanisms set it differently (e.g. ppsk settings or radius reply) then wifi-qcom (the non-ac) driver will apply that exception to appropriate frames. Resulting tagged (or untagged without vlan-id set on datapath) frames will flow over configured bridge (as per single datapath config). And we already know now how to properly configure bridge port now, right?
I always had an impression that things under /interface/wifi/datapath were only profiles and only got used if one of wifi interfaces (either physical or virtual) was explicitly configured to use one of them. And it’s only possible to assign one profile of a kind to any interface IIRC.

What I don’t even imagine is how all of this would be provisioned via CAPsMAN. It could be that that wouldn’t be a problem either if bridge on CAP isn’t vlan-enabled (and it hence simply doesn’t care about 802.1Q headers) … meaning that a single datapath is enough.

vlan-id (none | integer 1..4095)
Default VLAN ID to assign to client devices connecting to this interface (only relevant to interfaces in AP mode).
When a client is assigned a VLAN ID, traffic coming from the client is automatically tagged with the ID and only packets tagged with with this ID are forwarded to the client.
Default: none

802.11ac chipsets do not support this type of VLAN tagging , but they can be configured as VLAN access ports in bridge settings.

Guess you are right here, only one datapath seems to be required and that default VLAN can be 1, then when client get VLAN ID by for eg. PPSK then only packets with that VLAN ID will be forwarded.

In my case datapath is clearly not needed and i didn’t test capsman yet… I have spare hap ax lite that could act as a CAP for testing purposes.

Tested PPSK with CAPsMAN and it’s working like a charm. Only modification is to tag port where CAPs are connected, create datapath with PVID1 and interface bridge and add that into configuration.

How does /interface/bridge/vlan/print look like on CAP device?

On CAP device it’s empty

Ah, so bridge is ignorant about VLANs on CAP device … just as I thought. So as long as L2MTU is higher than around 1518, it’ll blindly pass ethernet frames left and right without ever looking at VLAN ID in 802.1Q headers … which means you have to be careful about vlan-id setting on datapath (it might mean that wifi-qcom driver will tad frames with VLAN ID 1 and that wouldn’t go nicely with default settings or router where everything has pvid set to 1).

What do you suggest in such case then ? That would be the case when user don’t use VLANs at all. Is datapath even needed in that case ?

You always need one datapath (simply to add CAPsMAN-provisioned wifi radio to CAP’s bridge) … either as datapath profile or static datapath. settings on wifi interface directly (which with CAPsMAN-provisioned CAPs isn’t an option obviously). And I guess if CAP is simply configured to be CAPsMAN-driven CAP (e.g. by pressing the button at the right moment for the right duration), then it doesn’t matter how bridge is configured. In worst case user will connect some PCs to free ether ports and if those PCs will be running windows (with their inadequate NIC drivers who simply strip off 802.1Q headers), they might get confused a bit (e.g. they might end up with multiple IPv6 prefixes, some of them not being usable due to wrong VLAN).
OTOH if admin wants/needs something less straight-forward on CAP location, then admin will have to manually configure bridge anyway. In this case it’s probably safe to enable vlan-filtering on bridge … and it would be interesting to see if wifi interface is added to bridge (by CAPsMAN) together with correct tagged VLAN membership. If not, then it might be necessary to manually add wifi interface to correct VLANs (but I don’t know how that would survive reboots).

So it seems we’ll need some more experimenting (somehow I feel you’re eager to do it yourself :wink:)

Enabling VLAN filtering on CAPs bridge results in this:

[admin@MikroTik] > interface bridge pr d
Flags: X - disabled, R - running 
 0 R ;;; defconf
     name="bridgeLocal" mtu=auto actual-mtu=1500 l2mtu=1560 arp=enabled 
     arp-timeout=auto mac-address=78:9A:18:0C:1B:DB protocol-mode=rstp 
     fast-forward=yes igmp-snooping=no auto-mac=no admin-mac=78:9A:18:0C:1B:DB 
     ageing-time=5m priority=0x8000 max-message-age=20s forward-delay=15s 
     transmit-hold-count=6 vlan-filtering=yes ether-type=0x8100 pvid=1 
     frame-types=admit-all ingress-filtering=yes dhcp-snooping=no 
     port-cost-mode=long mvrp=no max-learned-entries=auto



[admin@MikroTik] > interface bridge port pr  
Flags: I - INACTIVE; D - DYNAMIC; H - HW-OFFLOAD
Columns: INTERFACE, BRIDGE, HW, PVID, PRIORITY, HORIZON
#     INTERFACE  BRIDGE       HW   PVID  PRIORITY  HORIZON
;;; defconf
0   H ether1     bridgeLocal  yes     1  0x80      none   
;;; defconf
1   H ether2     bridgeLocal  yes     1  0x80      none   
;;; defconf
2 I H ether3     bridgeLocal  yes     1  0x80      none   
;;; defconf
3 I H ether4     bridgeLocal  yes     1  0x80      none   
4  D  wifi1      bridgeLocal          1  0x80      none

And this is when I force my device to connect to CAP (by disabling local wireless interfaces on CAPsMAN) and after tagging bridgelocal and ether1 for VLANs i have:

[admin@MikroTik] > interface bridge vlan pr d
Flags: X - disabled, D - dynamic 
 0 D ;;; added by pvid
     bridge=bridgeLocal vlan-ids=1 tagged=wifi1 
     untagged=bridgeLocal,ether2,ether1 mvrp-forbidden="" current-tagged=wifi1 
     current-untagged=bridgeLocal,ether2,ether1 

 1   bridge=bridgeLocal vlan-ids=20,30,40 tagged=bridgeLocal,ether1 untagged="" 
     mvrp-forbidden="" current-tagged=bridgeLocal,ether1 current-untagged="" 

 2 D ;;; added by wifi
     bridge=bridgeLocal vlan-ids=30 tagged=wifi1 untagged="" mvrp-forbidden="" 
     current-tagged=wifi1 current-untagged=""

Tested with all VLANs, works like a charm.

One thing I noticed. When I forget network (so I can connect with another password) first time entering password it displays an error on the phone to enter password again. When I enter password second time it connects immediately.

So it seems we’ll need some more experimenting (somehow I feel you’re eager to do it yourself > :wink:> )

Of course, my goal is always to learn more, otherwise I would use some other brand that is plug and play but where is the fun in that… :laughing:

I can think of several reasons for that but not necessarily any of them is actually true:

  • PPSK machinery has to add wifi interface to a new VLAN ID … and bridge (having RSTP enabled) takes a few seconds to actually enable it. During that time, wifi station times out waiting for anything meaningful to happen
    After a station with non-default PSK (and hence custom VLAN ID) connects to AP, does wifi interface become member of that non-default VLAN?
  • wifi driver VLAN handling machinery misses a few early frames to be handled by non-default VLAN ID
    I’m not sure how this would explain the fact that second entering of password then works
  • etc.

I guess the most probable cause is the last item from my list above :wink:

It’s always so fun when somebody else does the testing … not. :neutral_face:

No, error message is displayed almost immediately so nothing is visible in bridge/vlans.

Anything else to test ? :laughing:

I was asking about the state of CAP after second try (you wrote that client succeeds to connect after you enter passphrase second time) …

No, there is nothing visible on CAP or CAPsMAN VLANs, wireless interface never show up when this error occurs. It’s probably to fast to show in winbox.

Let me rephrase my last question …

If I understand your comment in one of previous posts, this is what happens:
When you try to connect station using ā€œnon-standardā€ password, connection initially fails. When you try to do it second time (a few seconds later), entering very same non-standard password, connection actually succeeds. So then your wifi connection works.

Or did I get things wrong?

After that, what does /interface/bridge/vlan/print show? Still nothing about wifi interface and VID belonging to that non-standard password?

What do you mean by ā€œnon-standardā€ password ?

So I have three passwords, test1234 for VLAN20, test12345 for VLAN30 and test123456 for VLAN40.

If I go to forget network so I can connect with another password, select SSID, phone prompts me to input password, I input another password and first try I get following on my phone:

WhatsApp Image 2024-10-03 at 06.19.19_46b4a7a4.jpg
And in logs I get this:

 
2024-10-03 06:14:14 wireless,debug FE:D9:AD:F0:3D:7F@cap-wifi1 associated, signal strength -20
2024-10-03 06:14:14 wireless,debug FE:D9:AD:F0:3D:7F@cap-wifi1 disassociated, connection lost, signal strength -18

/interface/bridge/vlan/print shows that wifi1 is tagged for vlan1 until I input password again, then it gets untagged for the correct VLAN.

I waited about a minute after forgetting network before connecting again and same thing happens.

What I also noticed, devices were turned off for the night and when I plugged them in on hap ax lite dhcp client was missing and connection couldn’t be established… rebooting hap ax solved the problem…