using 2 different subnet maks and should ping each other to access the end product.
Please give me more detailed instruction, how to configure in this situation.
Didn’t we do this before here?
And we concluded this was not a mask issue but a routing issue, and instructions were given to OP about how to fix it...
Yes, as others have said, its a routing issue. Lets explain with the example of my home network. On my openwrt router the "ip route" command gives:
ip r default via 184.108.40.206 dev pppoa-wan 192.168.2.0/24 dev br-lan scope link src 192.168.2.1 192.168.7.0/24 via 192.168.2.111 dev br-lan 220.127.116.11 dev pppoa-wan scope link src 18.104.22.168
The interesting one is the 192.168.7.0/24 - that is not on the directly attached network of the router, but the routing instruction says that packets for that address should be sent to 192.168.2.111 - which is on the directly attached network.
Now on machine 192.168.2.111 "ip route" gives:
ip r default via 192.168.2.1 dev eth0 proto dhcp src 192.168.2.111 metric 1024 192.168.2.0/24 dev eth0 proto kernel scope link src 192.168.2.111 192.168.2.1 dev eth0 proto dhcp scope link src 192.168.2.111 metric 1024 192.168.7.0/30 dev usb0 proto kernel scope link src 192.168.7.1 192.168.7.16/30 dev usb1 proto kernel scope link src 192.168.7.17
So notice it has 192.168.7.* networks on two external networks, actually two usb ports that do ethernet over usb. Note they are very restricive /30 networks, there is only 1 machine at the end of each.
Now doing this I can route packets to the 192.168.7.* machines from anywhere on my network, even if not attached. Its becuase the default route via the openwrt router, know how to route packets to those machines.
I've always added routes by hand (language is clearer to me) so use commands like
ip r add 192.168.7.0/24 via 192.168.2.111. what you need to check is that each machine on your network knows how to route packets ...
You also need to think what 192.168.2.5 means when it says it has no gateway. This means that its subnet mask means that the only machine that exist to it are 192.168.2.0/24; so it knows that packets to that it can send out on the subnet; but that machine has no knowledge of how to send packets to any other address, e.g. it has no knowledge of 192.168.58.81 - so it could not respond to ping from that machine. Hence you will need to cure that problem on 192.168.2.5, so it knows how to route general packets; if you don't do this you are stuck on the 192.168.2.0/24 subnet ...
Please don't double post.