Communication between two overlay networks

I have a swarm setup with docker 20.10.15. There’s one overlay network created 10.0.1.0/24 already, say olnet1. That has already got about 100+ services. Hence there’s an IP address availability problem. So, I created another overlay network say olnet2 10.0.4.0/24.

I exec into a container in olnet2 and when ping a container in olnet1, I don’t receive a response. But if I connect a container/ service to both the networks, then the communication works.

I need the container to be attached to only one network as I already have IP availability problem in olnet1. So, is there any method available to enable communication/ trust between two separate overlay networks with containers being attached to only one of the overlay network.

I have to explore the possibilities of IP table rules, but if there’s something that anyone has already done, please let me know.

This is how it works out of the box, there is no routing amongst container networks. Please keep us posted if you find a solution for this scenario!