LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Redirect iptables (https://www.linuxquestions.org/questions/linux-networking-3/redirect-iptables-814191/)

smart_shell 06-15-2010 01:00 AM

Redirect iptables
 
Hi,
We have the network, 10.19.0.0/24 GW(10.19.0.222 centos) and two irc servers
one 10.19.0.7
two 10.19.0.222
I need to change connection from 10.19.0.220:6667 to 10.19.0.7:6667 on GW(10.19.0.222 iptables FW).
i did:
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 6667 -j DNAT --to-destination 10.19.0.7:6667
iptables -t nat -A POSTROUTING -p tcp --dst 10.9.0.7 --dport 6667 -j SNAT --to-source 10.19.0.222
but no result.
Please help.
Thnx

vehl_g1 06-15-2010 07:46 AM

Quote:

Originally Posted by smart_shell (Post 4003865)
Hi,
We have the network, 10.19.0.0/24 GW(10.19.0.222 centos) and two irc servers
one 10.19.0.7
two 10.19.0.222
I need to change connection from 10.19.0.220:6667 to 10.19.0.7:6667 on GW(10.19.0.222 iptables FW).
i did:
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 6667 -j DNAT --to-destination 10.19.0.7:6667
iptables -t nat -A POSTROUTING -p tcp --dst 10.9.0.7 --dport 6667 -j SNAT --to-source 10.19.0.222
but no result.
Please help.
Thnx

Just use this command, it's send all requests from eth0 with dst port 6667 to 10.19.0.7 and check the 10.19.0.7 to listen that port .
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 6667 -j DNAT --to-destination 10.19.0.7

smart_shell 06-15-2010 10:17 PM

Sorry guys, i had to add the rule for FORWARD. Now everything work fine. Thnx


All times are GMT -5. The time now is 02:15 PM.