Redirect using ipchain

Posted on 2002-04-08
Last Modified: 2010-05-18
Dear experts,
How to redirect the request cominig from x.x.x.x to the firewall server for port xxxx to x.x.x.x.:xx which is available in my internal network.  Using ipchain    command and then how to get the ipmasqadm package from where.

With advance thanks,
Question by:km_saran
  • 3

Expert Comment

ID: 6927426
so lemme get this straight? you need to get say a web port (80) to redirect back from the firewall into the internal network to a certain port? so that all requests on such port go through it?

Expert Comment

ID: 6927432
if the above is what you are trying to do this would do it, substitute hostnames and ports

iptables -t nat -A PREROUTING -i eth0 -s ! <OTHER_HOST> -p tcp --dport <REQUEST_PORT> -j DNAT --to <OTHER_HOST>:<PORT_TO>

iptables -t nat -A POSTROUTING -o eth0 -s <local-network> -d <OTHER_HOST> -j SNAT --to <THIS_HOST>

iptables -A FORWARD -s <local-network> -d <OTHER_HOST> -i eth0 -o eth0 -p tcp --dport <PORT_TO> -j ACCEPT

Accepted Solution

escheider earned 20 total points
ID: 6935749
dabomb, hes using ipchains, not iptables

download ipmasqadm from

compile it, and install --

then in your firewall script add the following

ipmasqadm portfw -a -P tcp -L <externalip> 80 -R <internalip> 80

Where externalip is the ip of your external interface and internalip is the machine you want to forward requests to.  Ive used port 80 in the example to forward http requests

Expert Comment

ID: 6935948
oh, escheider's right, well either way would do it, iptables is for the newer or older kernels one of the two, it depends on which kernel version is on that disk, and it may be that one of the two is already installed.

Expert Comment

ID: 9078514
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

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

Suggested Solutions

Title # Comments Views Activity
linux dns for internal resolve 2 59
IPA - change main server? 3 149
installed old nagios.... 13 153
Help needed with BIND9 DNS on Ubuntu. 22 102
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

860 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