I am having trouble to run PwNAT successfully. The problem was created due to sample provided on official site. Here is how you should run it for case
Machine A (IP: 192.168.1.3) -> NAT A (IP: 122.x.x.x) -> Internet -> NAT B (IP: 59.x.x.x) -> Machine B (192.168.2.10)
Now if Machine A wants to connect to Machine B and want to access Machine B’s Webserver. Here is what you do
Machine B is a Server in our case so run server here:
#./pwnat.exe -s 192.168.2.10 2222
Now on Machine A run this
#./pwnat.exe -c 192.168.1.3 2222 59.x.x.x 2222 localhost 80
Let me explain which values came from what.
First for server:
If you do not define the local IP, and define something like 0.0.0.0 which is ANY IP for machine, then PwNAT do not send the correct IP through NAT A and hence NAT A never forward any incoming request to you. So server IP must be your machine main IP or LAN IP that is connected to NAT A router. IF you have multiple IP Only specific the IP that NAT A router can understand, otherwise it will fail for sure.
You can define any port by since pwnat use 2222 as default I use that
Now on client, I again define Local IP that is understand by NAT B, to avoid any confusion, but here it can be anything because it is used for Tunnel and hence it will not interact with NAT. Port is again any random port you want. Later we define the NAT B Server’ IP because we want to make sure we send Packet to that router. hence we use 59.x.x.x IP. Please note that while establishing connection PWNAT do not use any port. Now Proxy Port is 2222 this should be the same port that server is open. Otherwise connection won’t happen for obvious reason.
Localhost and port 80 is Domain or IP where you want to get connected through NAT traversal Proxy.
I will try to write a code in .NET library but for now. I will use my NMAKE complied copy of pwnat 0.3 beta version. Yes I compile it using NMAKE without Cygwin and it works superb on my windows 7 machine.
Hallo!
I have a question. What if many hosts share the same public ip adress?
Regards
I try to run Pwnat on same public ip for multiple machine and I found that we need to use complete different set of ports for each instance within same network. i.e. if a Machine A use 192.168.1.15 at 2000 then machine B with IP 192.168.1.16 should use 3000. However it is not consistent for me, i.e. I not always get connected in this case.
hello !
so the client MUST use pwnat to connect to pwnat’server too ? If yes , so that’s a big problem, ’cause if I want to make a website server on the computer behind nat , every client has to use pwnat ???
Yup! you need to have PWNAT at both end.
I’m a little confused. I have Machine1 behind NAT1 and Machine2 behind NAT2. Machine1 is hosting a page on port 8080. How would I use pwnat to access Machine1′s hosted page from Machine2?
@Corey, the above example demostrate exactly that case. so in your case you can simple change the command to run on Machine A from
pwnat.exe -c 192.168.1.3 2222 59.x.x.x 2222 localhost 80
to
pwnat.exe -c 192.168.1.3 2222 59.x.x.x 2222 localhost 8080
Hey,
Thanks for making this example, however, I want to use an SSH server on machine B. This is still possible, right?
Thanks in advance!
Yes, you can change the port from localhost 80 to localhost 22 and it should work.
Great example. I wonder… because you can specify the remote host name, could you contact other hosts on the server network? Instead of specifying “localhost 22″ to access a remote SSH server, could you specify “192.168.1.X 22″ to attempt to contact 192.168.1.X on the server’s local subnet? If so, you could essentially use a pwnat server as a port forwarding service to access the entire subnet!
Yes you can use IP address as well. However I do not agree to use PWNAT as port forwarder in realtime. It send lot of packets that make no sense in real world and it will clog your network uselessly. Plus PWNAT in my test wasn’t 100% success, so you can test and see if it is usable to you.
Can I somehow turn on verbose mode to see what happens ? I cannot connect for some reason
As far as I remember, PWNAT does the verbose of its action. Please check document for if it has any such variable.