4

I have this old code that runs tests against an SQL Server with a specific hardcoded IP on my network 192.168.X.Y, however I want to run such tests against my local server at 127.0.0.1.

How can I tell windows that whenever he receives a request for 192.168.X.Y it should be forwarded to my localhost?

I only have windows 10 installed, so its not technically a DNS server, so I cannot forward it. But I assume there should be like a list of hostnames as in Linux

1 Answers1

4

The hosts file in windows is located at c:\Windows\System32\Drivers\etc\hosts.

If you are using DNS you could map the domain name there to 127.0.0.1.

Alternatively you could configure port forwarding to forward traffic destined for 192.168.x.y on port 3306 to 127.0.0.1 on port 3306 using syntax similar to the below command.

netsh interface portproxy add v4tov4 listenaddress=192.168.x.y listenport=3306 connectaddress=127.0.0.1 connectport=3306

There is a post here where someone was trying to achieve something similar that you may find useful.

Windows 10 - NAT - Port forwarding & IP masquerade