Connecting to a Dynamic Port Forwarding (SOCKS5) Session

Describes how to connect to a dynamic port forwarding (SOCKS5) session.

Before you begin, you must create a dynamic port forwarding (SOCKS5) session (also known as an SSH tunnel).

  • You must have the private key file of the SSH key pair that you used to create the session.
  • The IP address of the machine must be in the CIDR block allowlist of the bastion that hosts the session.
  • The IP address of the bastion must be permitted to access the target resource. See Allowing Network Access From the Bastion.

To dynamically connect to an Autonomous Database

  1. Open the navigation menu and click Identity & Security. Click Bastion.
  2. Under List scope, select the compartment where the bastion was created.
  3. Click the name of the bastion, and then under Sessions, create a new Dynamic Port Forwarding (SOCKS5) session to the subnet in which your database is provisioned.
  4. In the Actions menu (Actions Menu) for the session, click View SSH command.
  5. To copy the command, next to SSH command, click Copy, and then click Close.
  6. Use a text editor to replace <localPort> with the local port on the machine from which you want to connect to the bastion, replace <sessionId> with the bastion session ID, and replace <bastionHost> with the domain name where the bastion is hosted.
  7. (Optional) Add the verbose (-v) option to the SSH command for detailed information about the connection.
    Note

    Don't use the -vv or -vvv options.
  8. Use a command line to issue the customized SSH command and connect to the bastion session.

    If your private key was created with a passphrase, you are prompted to enter it twice for a Dynamic Port Forwarding (SOCKS5) session.

    After creating a connection to a Dynamic Port Forwarding (SOCKS5) session, the process will not exit. Do not close the terminal.

    If you enabled verbose output (-v), the final message after a successful connection is:

    debug1: pledge: network
  9. Open a database client such as Oracle SQL*Plus or Oracle SQL Developer, and then connect to localhost (or 127.0.0.1) and the local port you specified, <localPort>.

    Provide the name and password of an existing user on the database.

    For example:

    $ export CUSTOM_JDBC="-Doracle.net.socksProxyHost=127.0.0.1 
    -Doracle.net.socksProxyPort=1080 -Doracle.net.socksRemoteDNS=true" 
    $ sql -cloudconfig <wallet_path>.zip 
    <ADB_admin_username>/"<ADB_admin_password>
    "@<tns_alias_low>
    

If you run into any problems, see Troubleshooting Bastion.