Solved

Simple port forwarding on Ubuntu Linux 12.04

Posted on 2013-01-17
2
1,534 Views
Last Modified: 2013-01-17
Hi all!

I want to test port forwarding and therefore I've added to a computer with two NICs this configuration:


# Port forwarding smtp
iptables -t nat -A PREROUTING -p TCP -d MYLOCALIP --dport 25 -j DNAT --to SMTPIP:25
iptables -t nat -A PREROUTING -p UDP -d MYLOCALIP --dport 25 -j DNAT --to SMTPIP:25

iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
iptables -A FORWARD -i eth1 -j ACCEPT


eth0 has a public ip and the gateway to get to internet
eth1 has LAN ip

I've tried a windows xp outlook client setting its smtp to this MYLOCALIP but it won't work.

What am I doing wrong?

If it can be of any help my ISP requires username and password and this has been configured correctly on outlook.
0
Comment
Question by:ltpitt
  • 2
2 Comments
 
LVL 1

Accepted Solution

by:
ltpitt earned 0 total points
ID: 38787349
Here's the solution:


iptables -t nat -A POSTROUTING -j MASQUERADE
iptables -t nat -A PREROUTING -p tcp --dport 25 -j DNAT --to-destination SERVERIP:25
iptables -t nat -A PREROUTING -p tcp --dport 110 -j DNAT --to-destination SERVERIP:110
0
 
LVL 1

Author Closing Comment

by:ltpitt
ID: 38788034
It perfectly works
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
fsstat very high only on nfs client side rhel 10 104
linux, squid server 23 53
Linux : when to add the entries in /etc/hosts file 22 95
IPA - change main server? 3 133
I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question