Red Hat Topics - help iptables

This is Interesting: Free IT Magazines  
Home > Archive > Red Hat Topics > September 2005 > help iptables





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author help iptables
junaidaslam

2005-08-29, 7:47 am

salam!!

My problem is i want to have one real ip. i want to re- direct all my
traffic comming on port 22 to 192.168.1.202 and trafic for port 21 to
192.168.1.203 where both the machines are within lan and on server i am
using squid.

Pleas help and if possible provide the iptable rule for this purpose
right now i am using but it is not working

tables -t nat -A PREROUTING -i eth1 -p udp --dport 21 -j DNAT
--to-destination 192.168.1.203

plz help!

Junaid

Duane Evenson

2005-09-18, 7:45 am

On Mon, 29 Aug 2005 00:53:43 -0700, junaidaslam wrote:

> salam!!
>
> My problem is i want to have one real ip. i want to re- direct all my
> traffic comming on port 22 to 192.168.1.202 and trafic for port 21 to
> 192.168.1.203 where both the machines are within lan and on server i am
> using squid.
>
> Pleas help and if possible provide the iptable rule for this purpose
> right now i am using but it is not working
>
> tables -t tables -t nat -A PREROUTING -i eth1 -p udp --dport 21 -j DNAT
> --to-destination 192.168.1.203
>
> plz help!
>
> Junaid

Your iptables rule looks OK. I assume its just a cut-and-paste error that
has yo displaying tables instead of iptables. I also assume eth1 is your
internet interface. I would include an extra option: "-d <gateway_IP>". So
it would look like:
iptables -t tables -t nat -A PREROUTING -i eth1 -p udp -d <gateway_IP>
--dport 21 -j DNAT --to-destination 192.168.1.203

Duane Evenson

2005-09-18, 7:45 am

On Sun, 18 Sep 2005 07:53:20 +0000, Duane Evenson wrote:

> On Mon, 29 Aug 2005 00:53:43 -0700, junaidaslam wrote:
>
> Your iptables rule looks OK. I assume its just a cut-and-paste error that
> has yo displaying tables instead of iptables. I also assume eth1 is your
> internet interface. I would include an extra option: "-d <gateway_IP>". So
> it would look like:
> iptables -t tables -t nat -A PREROUTING -i eth1 -p udp -d <gateway_IP>
> --dport 21 -j DNAT --to-destination 192.168.1.203


PS you do have ip_forward turned on?
echo 1 > / proc/sys/net/ipv4/ip_forward
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com