Hi,
I have a router with only one local network (192.168.1.0/24) and use different routes for few categories of devices.
I use separate routing tables and packet marking (by MAC) to chose a proper route:
/etc/config/firewall:
---------------
config rule
option name 'iot'
option src 'lan'
option src_mac '11-22-33-44-55-66'
option dest '*'
list proto 'all'
option target 'MARK'
option set_mark '42'
But it's not convenient to separate devices by mac. I'd like to create few wifi-iface to separate devices. But I have no ideas how to mark packets from specific wifi-iface (considering they are connected to the same interface).
I know that I can use different interfaces for each wifi-iface, but I want all devices to be in the same network and the devices to use the same IP (doesn't matter which wlan they connected to).
So, is it possible to mark packets by wifi-iface? If not, is there another way to separate traffic in the same network interface or probably a better solution?
Could you please clarify what exactly you mean? Some hints how vlan could help? I know that vlans usually used to isolate networks (but if I get it right it's even not necessary for wifi). But in my case I do want to use single network.
You’re right. They are usually used to separate and isolate networks. But they do tag packets with the vlan ID and you could configure a route and your firewall so that the subnets of each network can see each other simulating one network. Essentially using it just to tag the packets for certain devices connected to a particular interface.
I guess it ultimately depends on your use case. Are you just marking packets so you can monitor their network flow? What @pavelgl and @jow mentioned is a more suitable method to mark packets, I just mentioned vlans cause I find that setting them up is very easy to do within luci. Maybe my idea is bogus and shouldn’t be done at all
Thinking about it more, you could even use the same subnet, just split up the DHCP range on each interface and use static IP’s for the interfaces out of the DHCP range. Then you wouldn’t have to create a route. You’d just have to forward each networks to the others destination zone in the firewall.
I still don't understand... The main idea is to use single network (to achieve stable ip for the same mac between different ssid, broadcast, etc.).
Did I get it right that you suggest "emulating" one /24 by using two /25 networks? If so, none of the tasks will be achieved.
Or somehow it is possible to use the same interface for vlans and not to lose information about a initial vlan? If so, could you please give me a simple example?
If you’re wanting to use just one interface, then vlans wouldn’t be the route to go. It would require two network interfaces so you can keep the traffic to those interfaces tagged with the vlan ID accordingly.