"Hey, come check out my blog where I talk about programming and space!"
Port forwarding is where you connect to a port on a gateway machine and it automatically forwards you to another port on another machine. It can be useful in a very wide range of situations, including bypassing firewalls or redirecting traffic from a public network to a private network (or vice-versa). Combined with lines in your windows\system32\drivers\etc\hosts file you can even redirect where outgoing connections go. A number of people have asked me to update my trivial port forwarding utility to be a little more user friendly. This is the result. You can download it here and if you want, here's the code. Apart from its obvious graphicalness, this version allows you to set up any number of port redirections. You can see how many connections are being redirected and you can disconnect them if you feel the need. You can save the redirections you have setup and load them again later. If you'd prefer the old command line utility, here's the old source code and windows binary. usage: trivial_portforward [port to listen on] [ip of host to connect to] [port to connect to].
Note: that's ip address, not host name. If you want host names, add your own dns lookup code or use the fancy graphical version.
fed says: great, thanks Des says: so great, mucho thanks!!! I have a question. How many threads (connections) this module can handle? And how can I start this as windows service? KolobocK says: thanks for code! but trivial sources and binary are not available :( also could you please put here header file for portforward.cpp (portforward.h)? [oops, done]. Hector Garcia (hec50@hotmail.com) says: This program is pretty cool, but I tried to use it over Windows Xp 64 bits and it didn´t work, do you know any other program like this that works over Xp 64 bits? Thanks in advance... QuantumG says: I use it on xp64, no problems. xerces8 says: The gui version fails on my WinXP 32bit too. The CLI versions works thou Jon Ashley (jonathan.ashley@ praxis-his.com) says: That's a really nice little tool! It looks as though it might solve a problem for me. Can you please tell me what licence it is under? Thanks. Albert Bloomfield says: I think you should be calling shutdown() in your code somewhere. Anyway it didn't work right for me until I put in some calls to shutdown() before you close the sockets. Troy says: is there a way to specify which local ip to use if the system has multiple? Pedro says: Around portfoward.cpp:660, function dnslookup(), the line return (a << 24) | (b << 16) | (c << 8) | d; // network order I think that should be: return (d << 24) | (c << 16) | (b << 8) | a; foo says: test thirdwheel says: Hey, great tool, thanks. One problem though, I have it route requests to a port (say, 8123) to port 22 of a VM (ip address 192.168.0.5) - I can connect to it directly but not through the tunnel entry. It registers the connection but when it tries to connect, it times out. I'm running Windows XP SP2. The VM is attached to an MS Loopback adapter. thirdwheel says: I just tried the command line tool, and it worked fine... wtf thirdwheel says: Hey, what did you use to compile this? I compiled it using mingw and it came out 18k smaller... and that was with static linking... thirdwheel says: hey Troy, I've made a change to the command line version of this program that allows you to specify an IP address. If you have mingw, you can get the patch at http://milo.thats-too-much.info/patches/trivial_portforward-sourceip.patch - GUI version change to come thirdwheel says: I found the problem with the GUI version. Windows Firewall needed an exception to let it in. Gary Holmes says: Is this suppose to forward ports on a router? I had my friend who has a router try it (on Vista) and it didn't work. Thanks. Theo says: Just wanted to say Pedro's comment above is correct. Network order means less significant byte first, so you should have (d << 24) | (c << 16) | (b << 8) | a. That's why it doesn't work for some - if you enter a host name, the address is given by the winsock library, but if you enter an ip, it is miscalculated when trying to connect. QuantumG says: Thanks Theo, should be fixed now. Anonymous says: Hello, is it possible that I can use it as Windows service.. I have a Win 2003 Server and I would like to make some port forward to local PCs and I would like that the program would be started automatically when you restart the PC QuantumG says: Learn to code, I'm not your bitch. Anonymous says: I had a problem to access a site and only vpn connection on other pc(same LAN) was able to access that. this tool works fine for this situation. anti says: Is it possible for you to provide a .zip file for the trivial port forward command line tool instead of just the cpp file? QuantumG says: Just compile it with: cl.exe trivial_portforward.cpp ws2_32.lib Or, make a standard console application project and copy the code in. You should be able to figure that out. Anonymous says: GREAT!!! Anonymous says: a question: the GUI accepts command line parameters? i.e. useful for autorun... canty says: Simple to use, effective and powerfull. Thanks a lot!!! vad says: THE BEST!!! THNX! Anonymous says: tnx! Accio says: Damn that's awesome! THANKS Mike G says: Hello, is there a way to send real ip to forwarded port coz it shows up forwarders ip on destination el-Barto says: Hey Mike, that's what it is for. (And also the reason I got this cool tool in the first place) And QuantumG; Thanks, great Tool! sdd says: dff iwantantono says: windows 2000 server cannot run this program why. can u tell me. in not good in english Gang says: Great tool! Thanks. Lanti says: i don't get how to port forwarding for turkojan any tutorial :S please Lanti says: i don't get how to port forwarding for turkojan any tutorial :S please Mungo says: I love small programs like this one ... works fine Tim says: This is a great tool! Works so easily! Thanks! Nir says: Great !!!! (saved my butt during a night work .. :) must not tell security I ever used it) KG says: Great tool, good work! szabi says: Having parameters would be nice, like the name of the file to be loaded - pretty useful though :) MGP says: Ah, finally a port forwarder that just works _O_ All of them are either payware, buggy like shit or loaded with stuff I don't need. Though, maybe you can change the 'Stopped' status thing, I spent 10 minutes looking how to turn it on until I discovered you just need to open a connection :P Btw, add a Paypal donation button, I'll use it coobic says: Listen with specicifed address is required. Please :) qryzhephenetour says: thirdwheel says: I've got specific address for the command line tool - I just need to recreate the patch. As for the GUI tool - that's coming. layhesisoma says: psychtasunmibo says: chisabodotsto says: cocksovibreiwai says: Michael says: Thank you! you saved my day:) deuverlopider says: Anonymous says: Yuck..! Port Forwarding is a virus guys.... Mr Scotty says: Looked @ the port forwarder and have some suggestion to improve it. First a small bug When you have 2 or more forwards saved and you load them only the first is loaded. and the destionation port has the next localport concatenated Solution put a \\n after each line you save. Improvements: 1. I used it in combination with UltraVNC and had some performance degradation. (as happens with other forwarding tools also) To have a better performance i increased the send and receive buffers and i set TCP_NODELAY (as UltraVNC does). For the application it would be nice to have this configurable for each redirection. Maybe also an application wide default. 2. Have a default configuration which is loaded when you start the application. 3. Run it as a service so you don't need to login to have it working 4. When minimized have a tray icon and start it minimized (option?) 5. As suggested before have a parameter telling which settings to load. Hope you can use the suggestion to make this GREAT tool even beter. Thx for sharing it with the rest of the world. Marco says: Nice, Nice! Would be cool if we can start the tool with a file parameter, so that it automatically loads the *.txt config file. That gives us the possibility to use it in the autostart-function of windows anon says: Would be nice, but it seems to have a maximum packet size (or some bug), so it just breaks too long request replies. :( ankara says: Fixed save_redirs function. Apply the following change: - sprintf_s(buf, sizeof(buf), "%i %s %i", info->lport, info->dest_host, info->dport); + sprintf_s(buf, sizeof(buf), "%i %s %i\\n", info->lport, info->dest_host, info->dport); ankara says: Oups.. In the previous post make sure to use just one backslash.. forum added the second one. ankara says: Don't bother using this tool. Use netsh.exe. It is standard, and works! netsh netsh > interface portproxy netsh interface portproxy > add v4tov4 listenport=8080 connectaddress=192.168.1.28 connectport=8080 That's all! :) Anonymous says: it crashes for me Anonymous says: but thx ;-) MJ from Spain says: I imagine the gui interface can't load configuration file from command line; I tried to recompile it but had problems importing project with WxDev-cpp. I had to recompile trivial_portforward.cpp for win2000 as downloaded binary used too much resources and was hunging the system. Recompiled exe works just fine. Great tool!! thanks a lot. Daniil Harik says: Working fine on Windows 7 :) Thank bethanntub says: I have read a good joke in internet ;) How do you get holy water? Boil the hell out of it. ___________________________ vpxl namsoo jeon(namsoo.jeon@samsung.com) says: Thanks. It is very useful program to me. Can you please tell me what licence it is under? I'd like to use this program to our program. Joonas says: Thank you for this simple yet useful tool developer says: f-secure says it has a trojan in it. Alexsandro_xpt says: Man, thank you! You save my day with this app. budi says: many thanks Bb says: Tnx. Very well. But, how can i redirect UDP packets? Because, it's program redirect only TCP traffic. Bb says: Tnx. Very well. But, how can i redirect UDP packets? Because, it's program redirect only TCP traffic. Scott says: Freaking awesome. Works out of the box, does exactly what I need. Here's a little background: Requirement is to have a VMware client access our DB via a Cisco SSL VPN. This works fine on XP SP3: [VM] - [vmware NAT] - [Windows XP] - [SSL VPN] - [database]. On the XP machine, I access the VM web interface using its NATted IP. However, on Windows 7 (new dev environment), VmWare NAT is broken. Enabling ICS "fixes" NAT (vmware needs to figure out real fix), but ICS also breaks the VPN. So this VM cannot run on Windows 7 host. No problem... run the VM on the old XP laptop connected to network. But how to connect to NATted web interface? In Windows XP itself, the only way is ICS (which is ruled out by reasons above). So, we needed another service to forward HTTP requests. Here's where you app came in and it works great. Anyone else seeing this in a Google search: forget ICS, install this app instead, and you can use VM, NAT, and SSL VPN. Anonymous says: coming up as >>> File name: "winmail.dat->portforward.exe-" Virus name: "Win-Trojan/Xema.variant" Anonymous says: why is the exe coming up as having Win-Trojan/Xema.variant ? Anonymous says: why is the exe coming up as having Win-Trojan/Xema.variant ? thirdwheel says: because some dumbfuck at F-Secure et al thought that this program creates backdoors. This is what happens when you outsource your ability to know what's good. dave says: good software, but what about UDP? vaibhav says: how do i run it minimized with command line or automatic load on start. i need only one entry in it. tried the old one but it doesn't work for me (Win 7) Yngvar Kristiansen says: Greatly appreciated, thanks for sharing this! Anonymous says: wonderful .. for past one month i was looking for a program like this..all i was getting was for routers and firewalls..thank god and u wolfe716 says: Built a native x64 Windows binary (GUI) and works fine for me under Windows 7 and Server 2008 R2. Steve says: Greate! Exactly what I was looking for! =) Thanks! palante says: WARNING. I can't download this tool. My corporate network tells me there is a VIRUS in this. Just watch it. txomon says: it is not a virus, it tells you it recognises it as a application that redirects ports... xD I would be interested in makin a windows service. And, for running it in windows server 2000 (the 2nd version), you may download some dlls, avaiable in ddl-files. It is caused due to Visual C++ is used to do the application. You can find me putting txomon in google (I'm the first one) fab says: Thanks a lot!! Anonymous says: Simple solutions to real problems. Nime says: Be sure: Host machine's gateway is "gateway machine", otherwise port forwarding does not work. Satish says: This works very well. Had been fighting with setting up port forwarding using open ssh and putty and with this could do it in 10 secs. Brilliant eka808 says: just great tool, than'ks :-) k30 says: thanks for the great tools. it works. irix says: can you do UDP port forwarder? Victor says: Can you put this in the start folder so if the server is rebooted it will start the program AND load the port forwarding piece? I need this to work that way and can't figure it out Marcelo Honorato says: Parabéns! Simples e bastante funcional! Nev says: tooo goood Jim says: This rocks. Thanks for creating this! Raj says: Hi, thanks for the tool. But how do I configure this for the remote host if the remote host needs a username and password to connect...Otherwise the connection isn't successful. Thanks. Adam says: Great tool. Saved my life... andree says: Awesome :) Dawie Zeeman says: I have Windows Home server and WIMAX with no router - Home Server does not support ICS, so I have to use ICS on my Vista machine for shared Internet connectivity. The problem WAS that I could not access my Home Server from outside; since I could not forward port 443 - That was till I found your app! The gui version works perfect for me and I am really greatful for this!! Dawie Zeeman says: I have Windows Home server and WIMAX with no router - Home Server does not support ICS, so I have to use ICS on my Vista machine for shared Internet connectivity. The problem WAS that I could not access my Home Server from outside; since I could not forward port 443 - That was till I found your app! The gui version works perfect for me and I am really greatful for this!! |