External host remote ssh to connect the internal LAN Linux

Recently, the company has high host table configuration box (i7,32G, 512G), so I installed the head of kali, who are able to use when penetration test, the rest belongs to me, such a high-profile machine, how willing it eat it gray. So I went to study a little, how to remotely access the LAN host, tried to penetrate the internal network FRP, but too dependent on the bandwidth of the cloud server, the connection is unstable, so give up, but also the big brother recommended I use ngrok, I have not trial, the brothers are interested can discuss learning exchanges =. =
Preparation:

   一台内网机器A、一台外网笔记本B、一台云服务器C(上述是本人的材料,各位可根据手中的机器酌情变化配置方法)

Configuration:
First, the internal configuration of network machines Kali:
Usually we use Kali may have been initiated by the end of ssh, here, we want it to serve as a receiving end, so first of all, if we kali support remote SSH connection.
1. Modify the sshd_config file, remove the comment matches #PasswordAuthentication yes, then save and exit.

vi /etc/ssh/sshd_config

Then, start ssh service

service ssh start        //此命令没有回显

Finally, at the command line, enter

ssh -CfNg -R 7001:localhost:22 用户名@C机

Normal does not complain, but I could screenshots here, the cloud server problem occurred point = =

Second, the cloud server configuration C
configuration on the server cloud is relatively simple, there must be a public IP, accessible to both hosts, and then open the appropriate ports and forward enough to listen, I am here to open ports are 7000 and 7001, For more ports open command I will not describe, different commands are not the same server, all of you to Baidu.

Third, the configuration of the machine outside the network B
here, I use the MacBook, enter the command line

ssh -CfNg -L 7000:localhost:7001   用户名@C机
提示输入云主机的密码,即为成功。

Fourth, login
Finally, you can visit the company's machine A, and B under external host can command line, enter ssh -p 7000 A normal user names @localhost is no echo.

Guess you like

Origin www.cnblogs.com/H4ck3R-XiX/p/12153973.html