Redirect the traffic of a public IP to an internal one in Windows

0

I want to know if there is a way to redirect all incoming and outgoing traffic of a public IP (Say 136.0.98.197) to an internal IP (Say 192.168.1.100), so that the incoming packets of the public IP go to the internal one, and the outgoing packets of the internal IP go to the public one.

The public IP belongs to my own PC, so there is no worry about security problems.

Here is a solution for Linux by iptables. I am not sure if this solution do the job for outgoing traffic and I also want to do this for Windows not Linux. There maybe some equivalent commands for netsh or powershell, but I am not much of a network technician!

user2548538

Posted 2017-06-26T21:16:24.237

Reputation: 101

If you want to forward traffic to 192.168.1.100 from `136.0.98.197 it has to be all traffic on that given port or (all ports in the case of a DMZ). You also would need a network device with this compatibility – Ramhound – 2017-06-26T21:19:26.243

Answers

0

I have used the following in the past.

netsh interface ipv4 add route 192.168.1.100/32 metric=10 12 136.0.98.197

192.168.1.100/32 is the destination.

12 is the interface name/number

136.0.98.197 is the gateway to get to the internal IP. I have used the IP you have given above as the example.

For outbound, the default gateway could take care of that, or you could do the opposite and use 0.0.0.0/0

NetSH TechNet

*note 2008R2 and 2012 seemed to change the way to do it. In the gateway section, for 2008 use the IP address of the server/NIC instead of the gateway IP. Not sure if the NetSh documentation reflects this change though.

Thanks, Tim.

Tim Haintz

Posted 2017-06-26T21:16:24.237

Reputation: 321

didn't work! let me clarify, for example 172.217.9.14 is the IP of Google.com. I want to map this IP to 192.168.1.1, so that, when I enter 192.168.1.100 in Internet Explorer, it would be directed to Goolge.com. – user2548538 – 2017-06-27T13:47:30.850