跳转至

内网穿透

windows配置ssh服务

适用于 Windows 的 OpenSSH 入门

Windows 免密码 SSH 连接指南

以管理员身份运行powershell

Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'

会显示你是否安装ssh-client和ssh-server,之后按需安装

Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

启动服务

# Start the sshd service
Start-Service sshd

# 开机自启动 OPTIONAL but recommended:
Set-Service -Name sshd -StartupType 'Automatic'

# 判断防火墙是否允许 Confirm the Firewall rule is configured. It should be created automatically by setup. Run the following to verify
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
    Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
    New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
} else {
    Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
}
ssh localhost

安装ZeroTier

首先在官网注册账号: zerotier, 点击Create A Network, 此时会得到一个唯一的Network ID,点击该网络进入详情页,也就是管理员界面,

本地机和远程机都下载客户端, 安装好后点击join a new network可以输入之前得到的Network ID即可完成绑定,此时需要在管理员界面完成授权,可以完成连接,就可通过获得的新ip进行ssh

内网穿透神器ZeroTier使用教程

【教程】超详细安装和使用免费内网穿透软件Zerotier-One