EDIT: actually this won't work unless the other hosts also have corresponding route (i.e., for 192.168.88.0/24
) added or have a shorter netmask (e.g. 255.255.0.0
). The real solution for such problem is a secondary IP/netmask which is something possible in Windows. Also, it's confusing that you mentioned cannot use static IP
, which seems to contradict with the remaining part of the story you told.
earlier i have done it by changing adapter settings to static and assigning some IP from 192.168.20.X, and then i can access any of devices there
If you are talking about changing settings of the same adapter that gets 192.168.88.130 assigned by DHCP
, that probably means that there are actually more than one IP subnets being used by the different hosts in the broadcast domain the adapter is attached to.
In that case you can simply add a direct route:
route add 192.168.20.0 mask 255.255.255.0 192.168.88.130
Note that the command given above assumes that the adapter is currently assigned with the IP 192.168.88.130
. Only by specifying the assigned IP as the gateway param, you'll be adding a direct route (which would have on-link
in its gateway field when you run route print
).
You can use -p
//p
(They both work on Windows; TIAS) to add a persistent route (AFAIK that means you won't need to run the command after every reboot), but I am not familiar with Windows enough to tell whether:
- Windows actually resolves the gateway param to some identifier of the corresponding adapter upon the execution of the
route add
command, or
- (it is so silly that) it actually stores the address into its route table and resolve upon routing decisions.
If it does the latter, it would mean the route will become invalid once the adapter is assigned with a different IP. If you literally get the same IP all the time anyway (because of DHCP reservation or so), you probably don't have to worry about that. Otherwise, you may need to remove the invalid route and re-add a valid one whenever the IP changes.
Ref.: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/route_ws2008