i need port forwading i have installed linux debian 9 and vpn server pptp i need forward port 8270 to 192.168.254.2:8270 how to ?
i try with this butnot working
sysctl net.ipv4.ip_forward = 1 iptables -A PREROUTING -t nat -i eth0 -p tcp –dport 8270 -j DNAT –to-destination 192.168.245.1:8270 iptables -A FORWARD -p tcp -d 192.168.245.2 –dport 8270 -j ACEPTA iptables -A POSTROUTING -t nat -s 192.168.245.2 -o eth0 -j MASQUERADE
intente de esta otra manera:
sysctl net.ipv4.ip_forward = 1 iptables -t nat -A PREROUTING -p tcp –dport 8270 -j DNAT –to-destination 192.168.245.2:8270 iptables -t nat -A POSTROUTING -j MASQUERADE
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!
Heya,
Just came across this answer and decided to write some general guidelines for anyone who comes across this in the future despite the old question.
To troubleshoot your problem, let’s start with some basic checks:
sysctl configuration.Here’s a corrected example of how you should set your iptables:
- sysctl net.ipv4.ip_forward=1
- iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 8270 -j DNAT --to-destination 192.168.254.2:8270
- iptables -A FORWARD -p tcp -d 192.168.254.2 --dport 8270 -j ACCEPT
- iptables -t nat -A POSTROUTING -s 192.168.254.2 -o eth0 -j MASQUERADE
Remember to replace eth0 with the right interfaces in your case.
Also, ensure to make these changes permanent, as they will be lost after a reboot if not saved. You can use iptables-persistent to make the changes permanent.
Here’s a link to the related DigitalOcean documentation
Hope that this helps!
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.