Score:0

Access subnet from another subnet

bd flag

I have ipv4 address 192.168.88.130 assigned by DHCP (cannot use static IP).

I have to access devices on 192.168.20.X by changing adapter settings to static and assigning some IP from 192.168.20.X, and then i can access any of devices there.

Is there a way to access the other network without changing the network adapter ipv4 address?

joeqwerty avatar
cv flag
**Is there any way to do it without changing adapter ipv4 every time** - Set up a router between the two networks.
Score:0
in flag

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

gmijo47 avatar
bd flag
May i be able to accomplish this using virtual adapter?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.