首页
社区
课程
招聘
[求助]SSH隧道实现端口射
发表于: 2015-7-31 17:30 1557

[求助]SSH隧道实现端口射

2015-7-31 17:30
1557
我想使用ssh隧道技术来将内网的端口映射到vps上,命令如下:
ssh -C -f -N -g -R 8080:127.0.0.1:80 root@vps的ip 

现在呢,在vps上只能使用127.0.0.1:8080访问,使用ip:8080无法访问,需要设置 什么吗?不过使用其他端口转发工具可以访问。求大神指点下,先谢谢了,不懂的不要问为何不使用其他工具转发这类问题。。。
vps ssh_config内容如下:

# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile  %h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

[培训]《安卓高级研修班(网课)》月薪三万计划,掌握调试、分析还原ollvm、vmp的方法,定制art虚拟机自动化脱壳的方法

收藏
免费 0
支持
分享
最新回复 (2)
雪    币: 2676
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
GatewayPorts
             Specifies whether remote hosts are allowed to connect to ports forwarded for the client.  By default, sshd(8) binds
             remote port forwardings to the loopback address.  This prevents other remote hosts from connecting to forwarded ports.
             GatewayPorts can be used to specify that sshd should allow remote port forwardings to bind to non-loopback addresses,
             thus allowing other hosts to connect.  The argument may be “no” to force remote port forwardings to be available to the
             local host only, “yes” to force remote port forwardings to bind to the wildcard address, or “clientspecified” to allow
             the client to select the address to which the forwarding is bound.  The default is “no”.

vps上sshd_config设置GatewayPorts为yes,本地使用-R 0.0.0.0:8080:127.0.0.1:80转发。
2015-8-3 12:10
0
雪    币: 88
活跃值: (335)
能力值: ( LV4,RANK:55 )
在线值:
发帖
回帖
粉丝
3
非常感谢
2015-8-10 09:41
0
游客
登录 | 注册 方可回帖
返回
//