Solved

Simple port forwarding on Ubuntu Linux 12.04

Posted on 2013-01-17
2
1,552 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

726 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