LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   SSH Redirection in Intranet (https://www.linuxquestions.org/questions/linux-networking-3/ssh-redirection-in-intranet-670494/)

ajayan 09-17-2008 07:20 AM

SSH Redirection in Intranet
 
Dear All i am new to iptables.i have a network starting from (192.168.0.1-192.168.0.10).Now i want to redirect ssh requests from all local machines to 192.168.0.6, to machine 192.168.0.7.ie
when i execute command (ssh 192.168.0.6) will lead me to 192.168.0.7.pls give me a reply

datopdog 09-18-2008 02:05 AM

On 192.168.0.6 you need these rules

Code:

iptables -t nat -I PREROUTING -p tcp --dport 22 -d 192.168.0.6 -j DNAT --to-destination 192.168.0.7
iptables -t nat -I POSTROUTING -p tcp --dport 22 -d 192.168.0.7 -j SNAT --to-source 192.168.0.6


ajayan 09-18-2008 05:35 AM

Quote:

Originally Posted by datopdog (Post 3284093)
On 192.168.0.6 you need these rules

Code:

iptables -t nat -I PREROUTING -p tcp --dport 22 -d 192.168.0.6 -j DNAT --to-destination 192.168.0.7
iptables -t nat -I POSTROUTING -p tcp --dport 22 -d 192.168.0.7 -j SNAT --to-source 192.168.0.6


Ok very very thanks.That's Working !!!!!!!!!!!!!!!.That helped me lot


All times are GMT -5. The time now is 12:13 PM.