Score:0

Can I acess a web server located in another subnet?

in flag

I have a Laptop and a PC. My first laptop shares the same LAN as the PC, let's say they have 192.168.1.10(Laptop) and 192.168.1.20(PC) so I can SSH into it, ping it, etc… and vice-versa.

Now, I have an app on the PC that creates a web server on a different interface and I access that web server, ONLY from my PC(192.168.1.20) with the IP 192.168.40.150.

So my question is… Is there any way I can access this web server (192.168.40.150) with my Laptop(192.168.1.10) ? Maybe some kind of SSH Tunnel… or a Proxy… IDK?

Thanks in advance.

Score:3
us flag

Yes, you just need a router. Routing traffic between subnets is literally what routers are for.

Score:0
br flag

There are several approaches to solving your question. The easiest would be to tweak the app to bind its port not just to the second interface but also to your primary interface (which has a connection to your laptop). Depending on what app it is, you may be able to do this by checking it's configuratoin options.

If that is not an option you could setup routing on your Desktop machine, that bridges the two interfaces together. Depending on your OS the approaches to this will vary.

Lastly, since you explicitly asked for it: You can also setup an SSH server on your Desktop system (that will listen on the interface the Laptop is attached to) and dial in to it from your laptop, using remote porrt forwarding to build an SSH tunnel with the specific ports the app uses for network communication. The laptop can then connect to the app using localhost as an address, as traffic will be forwarded to the Desktop system which can in turn access the app on the secondary network interface.

GBT55 avatar
in flag
I'm currently using CentOS 8, do you know how to bridge two interfaces here?
br flag
Check out the following resource: https://www.tecmint.com/create-network-bridge-in-rhel-centos-8/
in flag
CentOS 8 has already reached it's end of life and should not be used anymore.
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.