Thursday, July 06, 2006

Configuration for allow public user to use service on server i.e. port 25, 110.

I have Red Hat Linux 9.0 on which I have 2 NIC.

NIC 1 is used for internal network connection.
NIC 2 is used for Broad band internet connection which has static IP.

Now in this server my sendmail on 25 , POP3 on 110, HTTPD on 90 Is running now I want to allow user to access this services from outside my network or on internet.

In this box I have my firewall and for that I have to reconfigure and opened port 25, 110, 90 so outside user can access it.

After opening port and checking my settings I am only able to access POP3 service.

Why ?

Because my sendmail & HTTPD is configure on my local/internal IP.

So which ever request comes inside for port 25 and port 90 I need to forward to my local/internal ip port 25 and 90.

So need to add below in my rc.local file for route the request.

Iptables –t nat –A PREROUTING –i eth1 –p tcp – -dport 25 –j DNAT - -to :25
Iptables –t nat –A PREROUTING –i eth1 –p tcp – -dport 90 –j DNAT - -to :90

After doing routing I am able to access.