Different VLAN same subnet


I'm making a setup with 20 different vlans and every vlan will have 1 device in it with the same ip. and i want to use 1 pc to acces all 20 devices. I was thinking on doing a port forward and then forwarding it to each vlan. Example port 10 forwards to port 22 on vlan 10 ip port 11 forwards to port 22 on vlan 11 ip but this is not working as expected. is this possible to do? working with different virtual ip's would also be an option for me... any idees?

What is your ideal working end result? i.e. what are you trying to achieve (in a conceptual sense, rather than the technical specifics).

Why are you assigning the same IP to each device and trying to separate them with VLANs?

We buy routers in bulk and program them via ssh. And by default these router only have ssh acces on lan side.

You will one with one device trying to reach 20 devices with the same IP address... I do not see how this could work.

I was hoping the router could nat this and port forward the data to the correct interface. But for the moment it is routing in ip based and in the routes you can select the interface. So i was thinking of an virtual ip for each vlan that could solve this like an snat or masquerating but i dont seem to connect all the ends. maybe diferent proxies could solve this. or i need to make 20 virtual nat routers for each vlan
because 20 different nat routers with a simple port forward would work. example router 1 port 22 forwards to vlan 10 ip port 22 router 2 would have ip port 22 forward to vlan11 ip

But if it would be possible to do this with 1 openwrt would be cleaner than 20 opewrt vm's/dockers

Are you able to give each VLAN its own local IP address within the subnet? If you need to use the same local IP address then it will be much harder to implement.

With different local IP addresses it should be enough to give each VLAN it's own routing table. Then you should be able to connect to on a specific VLAN by using the correct source address. That can be accomplished for example with the "-b" option of the ssh command you run on OpenWrt.

1 Like

What is did was that vlan10 has ip and vlan11 has ip but i dont see how i can make different routing tables for each vlan.

i found this:https://openwrt.org/docs/guide-user/network/routes_configuration

i can try to do a setup with this static tables for each vlans separate ip. this could possible work

If you use luci then it's in the advanced setting. In uci it's ip4table. And when using this setting OpenWrt will automatically add the ip rule you need.

1 Like

Router do not know about ports, different layers.