{"id":748,"date":"2016-07-21T11:58:10","date_gmt":"2016-07-21T06:28:10","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=748"},"modified":"2026-09-07T17:27:35","modified_gmt":"2026-09-07T11:57:35","slug":"port-forwarding-using-proxypass-in-local-machine","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/port-forwarding-using-proxypass-in-local-machine\/","title":{"rendered":"Port forwarding using proxypass in local machine"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In some network environments, a local machine may not have direct access to a remote server, while a jumpbox has access to both the local network and the remote server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">SSH local port forwarding can be used in this situation. It creates a secure tunnel from a port on the local machine through the jumpbox to a specific port on the remote server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This allows you to connect to the remote service using the local machine&#8217;s loopback address, such as <code>127.0.0.1<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before setting up SSH port forwarding, make sure:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>SSH access is available to the jumpbox.<\/li>\n\n\n\n<li>The jumpbox can connect to the destination server.<\/li>\n\n\n\n<li>The required destination port is accessible from the jumpbox.<\/li>\n\n\n\n<li>You have valid SSH credentials for the jumpbox.<\/li>\n\n\n\n<li>The selected local port is not already being used.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Implementation<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Understand the SSH Port Forwarding Command<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Use the following SSH command:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ssh -L &lt;SOURCEPORT>:&lt;IPADDRESS>:&lt;DESTINATIONPORT> userid@&lt;JUMPBOXIPADDRESS><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Where:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>SOURCEPORT<\/strong> \u2013 Port opened on your local machine.<\/li>\n\n\n\n<li><strong>IPADDRESS<\/strong> \u2013 IP address of the remote destination server.<\/li>\n\n\n\n<li><strong>DESTINATIONPORT<\/strong> \u2013 Port of the service running on the remote server.<\/li>\n\n\n\n<li><strong>JUMPBOXIPADDRESS<\/strong> \u2013 IP address of the jumpbox that can access the remote server.<\/li>\n\n\n\n<li><strong>userid<\/strong> \u2013 SSH username used to connect to the jumpbox.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Once the SSH session is established, connections to the local source port are forwarded through the SSH tunnel to the destination server.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Configure RDP Port Forwarding<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For example, suppose you need to access the RDP service on a remote Windows server, but your local machine cannot directly reach the server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">RDP normally uses port <code>3389<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Run the following command from your local machine:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ssh -L 3389:&lt;IPADDRESS>:3389 root@&lt;JUMPBOXIP><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This creates the following connection path:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Local Machine\n127.0.0.1:3389\n       |\n       | SSH Tunnel\n       v\n   Jumpbox\n       |\n       | Port 3389\n       v\nRemote Server\n&lt;IPADDRESS>:3389<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Access the Remote RDP Service<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">After the SSH tunnel is established, open your RDP client and connect to:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">127.0.0.1<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Port:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">3389<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The RDP connection from your local machine will be forwarded through the jumpbox to the remote server.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Keep the SSH Tunnel Active<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The SSH session must remain active while the port-forwarding tunnel is being used.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you want SSH to establish the tunnel without opening an interactive shell, you can use:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ssh -N -L 3389:&lt;IPADDRESS>:3389 root@&lt;JUMPBOXIP><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>-N<\/code> option tells SSH not to execute a remote command and is useful when SSH is being used only for port forwarding.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Security Note:<\/strong> Use SSH keys or other secure authentication methods where possible, and avoid using privileged accounts such as <code>root<\/code> for routine access when a restricted account is sufficient.<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">SSH local port forwarding is useful when your local machine cannot directly access a remote service but a jumpbox can reach it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By creating an SSH tunnel with the <code>-L<\/code> option, you can expose the remote service through a local port and access it using <code>127.0.0.1<\/code>. This approach can be useful for RDP, database services, web applications, and other TCP-based services that are reachable from the jumpbox.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">FAQs<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. What is SSH local port forwarding?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">SSH local port forwarding creates a tunnel from a port on your local machine through an SSH server to a destination server and port.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Why use a jumpbox for port forwarding?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A jumpbox can act as an intermediary when your local machine cannot directly reach the destination server but the jumpbox has network access to it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Can I use SSH port forwarding for RDP?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes. RDP traffic can be forwarded through SSH using port <code>3389<\/code>, provided the jumpbox can reach the remote Windows server.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Why do I connect to 127.0.0.1?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The local port is opened by the SSH client on your machine. Connecting to <code>127.0.0.1<\/code> sends the traffic through the SSH tunnel to the configured destination.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5. Does the SSH connection need to remain active?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes. The SSH tunnel normally remains available only while the SSH connection providing the forwarding is active.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>How to Reset SSH Port to Default Port Through WHM<\/strong> \u2013 Learn how to restore the default SSH port configuration through WHM when managing a server.<br><a href=\"https:\/\/pheonixsolutions.com\/blog\/reset-ssh-port-to-default-port-through-whm\/?utm_source=chatgpt.com\" target=\"_blank\" rel=\"noreferrer noopener\">Read the article<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Talk to our experts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Looking for the right technology solution for your business? Our team of experts can help you with development, cloud, DevOps, design, and a wide range of other technology needs. Get in touch with our team&nbsp;<a href=\"https:\/\/pheonixsolutions.com\/contact\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In some network environments, a local machine may not have direct access to a remote server, while a jumpbox [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022,1024],"tags":[],"class_list":["post-748","post","type-post","status-publish","format-standard","hentry","category-web-architecture","category-security","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-c4","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/748","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=748"}],"version-history":[{"count":1,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/748\/revisions"}],"predecessor-version":[{"id":11476,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/748\/revisions\/11476"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}