By 7imontapia
I just want to be able to go to the IP/port of my droplet in a web search, and it take me to a specific website(One that I do not own) So that if the destination website were blocked by a firewall/country I can still get to it through the droplet acting like a tunnel.
Can anyone tell me how I can do this? Any tutorials please
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi @7imontapia,
There are multiple ways to achieve this. You can use a WebService like Nginx and create a proxy. Another alternative would be to go for a NAT rule in your IPtables configurations.
Let’s try it out with a Nat rule as it won’t require you to install any new software on your droplet. Below will show you how to redirect port 3124 on one machine to port 3000 on a different machine / IP address. This can be useful for firewall related reasons.
Step 1 :
iptables -t nat -A PREROUTING -p tcp --dport 3124 -j DNAT --to-destination XXX.XXX.XXX.XXX:3000
This will route traffic incoming on port 3124 to XXX.XXX.XXX.XXX on port 3000. You can put in any port or IP address you need there to replace XXX.XXX.XXX.XXX.
Step 2 :
iptables -t nat -A POSTROUTING -j MASQUERADE
We set MASQUERADE to mask the IP address of the connecting system and use the gateway IP address instead. This is necessary for it to communicate back to the gateway, then to your client.
That’s all, you should be ready to go.
Regards, KFSys
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.