IP Forwarding using IPtables

I want to do IP forwading using IPtables task is:

I have to forward the request to a machine -- if the request is for a specific IP address

(its NOT -from a specific address of host )

Do you mean you have a machine with a default policy of disallowing forwarding and you just want to allow any packets coming in from anywhere that are destined to go to eg. a.b.c.d?

iptables -I FORWARD -d a.b.c.d -j ACCEPT
iptables -I FORWARD -s a.b.c.d -j ACCEPT

or do you want more sophisticated behaviour like:

iptables -I FORWARD -p tcp -d a.b.c.d -j ACCEPT
iptables -I FORWARD -s a.b.c.d -m state --state RELATED,ESTABLISHED -j ACCEPT

Maybe even restricting the traffic further to only certain ports or interfaces.

Or do you mean the packets meant for a.b.c.d should be redirected to some other address?

It is hard to know what rules will work for you since it will depend on what rules already exist in your tables and how your machine is connected to other networks so I'm just guessing.

See Also
Unix Administrator Career Path

Have a Unix Problem
Do you have a UNIX Question?

Unix Books :-
UNIX Programming, Certification, System Administration, Performance Tuning Reference Books

Return to : - Unix System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.