通过MobaXterm建立SSH隧道进行本地转发

本地转发:

 

在150阿里云上开启httpd

[root@iZbp145axkc98giot5b448Z ~]# yum install httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
base                                                                                                                                          | 3.6 kB  00:00:00
docker-ce-stable                                                                                                                              | 3.5 kB  00:00:00
epel                                                                                                                                          | 4.7 kB  00:00:00
extras                                                                                                                                        | 2.9 kB  00:00:00
updates                                                                                                                                       | 2.9 kB  00:00:00
(1/5): epel/x86_64/group_gz                                                                                                                   |  95 kB  00:00:00
(2/5): epel/x86_64/updateinfo                                                                                                                 | 1.0 MB  00:00:00
(3/5): epel/x86_64/primary_db                                                                                                                 | 6.7 MB  00:00:00
(4/5): extras/7/x86_64/primary_db                                                                                                             | 164 kB  00:00:00
(5/5): updates/7/x86_64/primary_db                                                                                                            | 7.6 MB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-90.el7.centos will be installed
--> Processing Dependency: httpd-tools = 2.4.6-90.el7.centos for package: httpd-2.4.6-90.el7.centos.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-90.el7.centos.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-90.el7.centos.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-90.el7.centos.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-5.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package httpd-tools.x86_64 0:2.4.6-90.el7.centos will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================================
 Package                                 Arch                               Version                                           Repository                        Size
=====================================================================================================================================================================
Installing:
 httpd                                   x86_64                             2.4.6-90.el7.centos                               base                             2.7 M
Installing for dependencies:
 apr                                     x86_64                             1.4.8-5.el7                                       base                             103 k
 apr-util                                x86_64                             1.5.2-6.el7                                       base                              92 k
 httpd-tools                             x86_64                             2.4.6-90.el7.centos                               base                              91 k
 mailcap                                 noarch                             2.1.41-2.el7                                      base                              31 k

Transaction Summary
=====================================================================================================================================================================
Install  1 Package (+4 Dependent packages)

Total download size: 3.0 M
Installed size: 10 M
Is this ok [y/d/N]: y
Downloading packages:
(1/5): apr-util-1.5.2-6.el7.x86_64.rpm                                                                                                        |  92 kB  00:00:00
(2/5): apr-1.4.8-5.el7.x86_64.rpm                                                                                                             | 103 kB  00:00:00
(3/5): httpd-tools-2.4.6-90.el7.centos.x86_64.rpm                                                                                             |  91 kB  00:00:00
(4/5): mailcap-2.1.41-2.el7.noarch.rpm                                                                                                        |  31 kB  00:00:00
(5/5): httpd-2.4.6-90.el7.centos.x86_64.rpm                                                                                                   | 2.7 MB  00:00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                 12 MB/s | 3.0 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : apr-1.4.8-5.el7.x86_64                                                                                                                            1/5
  Installing : apr-util-1.5.2-6.el7.x86_64                                                                                                                       2/5
  Installing : httpd-tools-2.4.6-90.el7.centos.x86_64                                                                                                            3/5
  Installing : mailcap-2.1.41-2.el7.noarch                                                                                                                       4/5
  Installing : httpd-2.4.6-90.el7.centos.x86_64                                                                                                                  5/5
  Verifying  : apr-1.4.8-5.el7.x86_64                                                                                                                            1/5
  Verifying  : mailcap-2.1.41-2.el7.noarch                                                                                                                       2/5
  Verifying  : httpd-tools-2.4.6-90.el7.centos.x86_64                                                                                                            3/5
  Verifying  : apr-util-1.5.2-6.el7.x86_64                                                                                                                       4/5
  Verifying  : httpd-2.4.6-90.el7.centos.x86_64                                                                                                                  5/5

Installed:
  httpd.x86_64 0:2.4.6-90.el7.centos

Dependency Installed:
  apr.x86_64 0:1.4.8-5.el7          apr-util.x86_64 0:1.5.2-6.el7          httpd-tools.x86_64 0:2.4.6-90.el7.centos          mailcap.noarch 0:2.1.41-2.el7

Complete!

查看端口有没有开启

[root@iZbp145axkc98giot5b448Z ~]# netstat -nltp |grep 80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      25181/httpd
[root@iZbp145axkc98giot5b448Z ~]#

然后再MobaXterm进行SSH隧道转发

[root@iZ1la3d1xbmukrZ ~]# ssh root@XXXXXXX.150
root@XXXXXXXXX.150's password:
Last login: Mon Mar 30 21:13:37 2020 from XXXXXXXX.239

Welcome to Alibaba Cloud Elastic Compute Service !

[root@iZbp145axkc98giot5b448Z ~]#

再MobaXterm进行配置本地转发

 然后点击启动

 查看监听的端口

 本地请求9999

posted @ 2020-03-30 22:11  天宇轩-王  阅读(3681)  评论(1编辑  收藏  举报