How to create SSH tunnels to get around Firewall
I normally have access to unix/linux systems through ssh (port 22) but firewall access is often disabled for ports like TNS (1521/1526), Emagent(1158), Grid (5500). How do you connect to those ports if you don’t have direct access through firewall ? … Use SSH tunneling.
1. Locate Source (Windows Desktop), Destination Unix server IP address and port number you wish to connect at Destination
I am trying to connect to destination oracle server (192.168.1.100) using TNS port 1529
2. Open putty and add following configuration
Add server and port details
C:\>telnet localhost 1529
Connecting To localhost…Could not open connection to the host, on port 1529: Connect failed
3. Now startup putty session and ssh login at Remote server.
run “netstat -an” on windows desktop to see any sessions with port 1529 are listed
Now try “telnet localhost 1529″ to see if it’s all working as it should.
4. Configure connection detail to port on your local machine which will create a tunnel to the destination server.
I am using TORA so I have directed port 1529 at my local machine , this is very important.
I am now able to connect to Target Oracle database thru my ssh tunnel successfully.
5. Let’s use “netstat -anp” at server to see connections from source desktop.
192.168.1.100 (Remote Oracle Server) & 192.168.1.121 (my Desktop)
[oracle@~]$ netstat -anp | grep 192.168.1.121
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 ::ffff:192.168.1.100:22 ::ffff:192.168.1.121:3970 ESTABLISHED -
tcp 0 0 ::ffff:192.168.1.100:22 ::ffff:192.168.1.121:3807 ESTABLISHED -
6. At desktop run “netstat -an” to see established sessions.