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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now