Brian
Brian

Reputation: 13593

How can I open the web app inside a server in my company from my home?

There are 2 Linux servers in my company (Let's call them A, and B).

A and B are located in a Local Area Network. They don't have public IP addresses. They can send packets to each other using private IP addresses such as 172.27.X.X.

My company only allows us to establish a VPN connection to server A using AnyConnect when we are at home.

Now there's a web app hosting on server B. How can I open the web app using my browser when I'm at home?

The web app on server B listens to port 80 and 443.

I'm able to view web apps on server A when the VPN connection is established. But don't know if it's possible to use server A to get access to the web app on server B.

Upvotes: 1

Views: 579

Answers (1)

Thomas Kainrad
Thomas Kainrad

Reputation: 2830

The most common solution to this is SSH port forwarding AKA SSH tunneling.

To build a tunnel from your local port 8080 to port 80 on remote server B through remote host A, simply do:

ssh -L 8080:<host-B-IP>:80  username@<host-A-IP>

For port 443 on server B:

ssh -L 8443:<host-B-IP>:443  username@<host-A-IP>

Afterwards, you can just open the website using localhost:8080 or localhost:8443.

Upvotes: 1

Related Questions