Celeb Glow
updates | March 10, 2026

Is there a way to map a network drive in windows to point to two locations under one drive name?

When I'm on my home network I have a network drive mapped for my file server. I set up port forwarding on my router and have a static ip address so I can ssh and access my files while away. Is there any way I can set up windows to detect when I'm on my local network and use that path (192.168.x.x) instead of the external ip path while using the same drive letter (E:)and vice versa?

1 Answer

One problem is determining when you are on your local network, as opposed to someone else's local network. ie: My home subnet is 192.168.1.0/24, but when I'm at work the local subnet is also 192.168.1.0/24.

I also have a number of services I host on a server at home, and I am faced with the same situation. The way that I solve it is by having a domain name for my home external IP address, and by hosting my own DNS server on my home network.

When I am not at home, mydomainname.com resolves to my public IP address, and I connect remotely through the relevant forwarded ports. On my home DNS server, I manually add a DNS record for mydomainname.com and have it point to the local address [192.168.1.x], which overrides the public DNS record.

This means I can simply use mydomainname.com for all of my scripts/configurations, and the IP address used is determined by the DNS server, based on whether I am at home or external.

Setting up a DNS server may of course add a level of complexity to the situation beyond what you are willing to deal with [understandably]. I'd recommend looking at pfSense or some other form of router/gateway firmware which makes it a whole lot easier.

As an alternative, see if you router/gateway supports a feature called "NAT-reflection". This allows you to connect using the external IP address when on the internal network, and still get a correctly routed connection. It's less elegant, but it may be adequate for your situation.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy