1

i have a requirement to have the SSH connectivity of the remote server in the azure network to our on prem network. Since the direct connectivity between both the networks are not available, i am trying to use IP tables to forward 22 traffic from server 1 to server 3.

Server 1 (on prem) --> server 2 (Azure DMZ network) --> server 3 (Backend application server)

though i can first log in to server2 and then take ssh from server 2 to server3, this approach wont work for our application requirement. Our application requirement is that we need direct SSH access from server1 to server 3.

ex: in putty if i use user@server2 IP it should redirect and connect the SSH session for server 3.

currently i tried doing it with IP tables to forward all 22 traffic f server 2 to server 3. In this approach through i see the packets forwarding. i am not getting the SSH session of server 3 from server 1 using server 2 IP.

note: In server i have changed the SSHd config file to have SSH running on different port to allow 22 port forwarding.

Please let me know if its possible in ubuntu such forwarding, if yes please guide me on the steps.

  • Does this answer your question? [Access remote multiple servers behind NAT](https://askubuntu.com/questions/1005337/access-remote-multiple-servers-behind-nat) – pa4080 May 25 '21 at 08:04
  • I think, you need to set `GatewayPorts yes` in `sshd_config`. Look at scenario 2 within the proposed duplication. – pa4080 May 25 '21 at 08:10
  • thanks for the suggestion, i have enabled the GatewayPorts yes in the sshd_config as mentioned. But still couldnt take ssh session of server 3 via server 2 SSH port forwarding – Parames Waran May 25 '21 at 09:07
  • You should be able to do it. Please edit your question adding the iptables rules used so far. You mentioned you can see the packets forwarding, but did you provide a return path from server 3 to server 1? Are the various server IP addresses static or dynamic? – Doug Smythies May 25 '21 at 14:35

0 Answers0