Report this

What is the reason for this report?

Forward port 80 and 443 to another droplet via the private network.

Posted on August 23, 2015
Carl

By Carl

Hello, I happened to accidentally remove my old iptables for forwarding port 80 and 443 to another droplet on the private DO network. After googling now for a few hours I have to say I really can’t find anything related to it. From what I remember I read a tutorial here but as said I can’t find it. Maybe someone could tell me how to do it or link me to the tutorial (if it still exists).

Many thanks, Carl



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!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Okay so apparently I had the same script on another server (for whatever reason. Well I won’t complain…)

#!/bin/sh

echo 1 > /proc/sys/net/ipv4/ip_forward

iptables -F
iptables -t nat -F
iptables -X

iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 10.132.112.54:443
iptables -t nat -A POSTROUTING -p tcp -d 10.132.112.54 --dport 443 -j SNAT --to-source 10.132.113.5

The same for port 80 and so on…

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.