Click to See Complete Forum and Search --> : iptables - Is this scnario possible


linuxmeout
05-15-2007, 02:59 PM
I have been try to enable TCP forwarding on the OS .. But have failed miserably. I wanted to know if the following scnario is possible - Please help before I go crazy

-- originating pc (pC1) ip = 199.1.1.4

-- dual nic linux box (linux-1) ip = 199.1.1.5
ip = 198.1.1.3

-- destination server (server-1) ip = 198.1.1.4

-- In short I need to get from (PC-1) over port 8600 to connct to server-1

Can I set up iptables policies on the linux box to achieve this?
I assume I need to set up routing and enable routing ?
Anyone has experience with this please help me out ?


Cheers
Tom

je_fro
05-15-2007, 07:13 PM
iptables -A FORWARD -j ACCEPT -p tcp --dport 8600
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 8600 -j DNAT --to 198.1.1.4

bwkaz
05-16-2007, 07:08 PM
Also:

echo "1" >/proc/sys/net/ipv4/ip_forward

otherwise the kernel won't route the packets.

linuxmeout
05-18-2007, 09:16 AM
Thanks for yoru reply.
Sorry I've been away from work on Emergency.
Will give this a shot and let you know

Cheers