如何正确更改Microsoft Azure中的SSH端口? [英] How to change SSH ports in Microsoft Azure properly?

查看:95
本文介绍了如何正确更改Microsoft Azure中的SSH端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于Ubuntu 14.04 LTS的虚拟机(用于测试,而不是生产服务器).默认情况下,默认的SSH端口22在Azure上已打开

I have a virtual machine (for testing, not a production server) based on Ubuntu 14.04 LTS. The default SSH port 22 is opened by default on Azure

我想将其更改为12131.我编辑了SSH配置文件,并将端口更改为12131,然后通过以下方式重新加载ssh服务:

I want to change it to 12131. I edited my SSH configuration file and changed port to 12131, then reloaded ssh service by:

service ssh reload

然后,我登录Windows Azure门户并将端点SSH更新为:

Then I logged into my Windows Azure portal and updated endpoint SSH as:

公共端口 12131

专用端口 12131

现在我正在使用SSH超时.在Azure的Ubuntu 14.04中更改SSH端口的正确方法是什么?

Now I'm getting timeout with SSH. What is the proper way to change SSH port in Ubuntu 14.04 in Azure?

感谢您的帮助.

推荐答案

首先,最重要的是Public端口.这是面向Internet的端口.您可以绝对安全地仅将公共端口编辑为XXXX,而将私有端口保留为22.Azure负载平衡器(Azure中的VM之前始终有一个负载平衡器)将正确地将连接路由到VM的22端口.因此,无需编辑您的SSH守护程序配置.

First of all, the most important is the Public port. This is the Internet facing port. You can absolutely safely edit just the public port to XXXX and leave private port to 22. Azure Load Balancer (there is always a Load balancer in front of your VMs in Azure) will properly route the connection to your VM's 22 Port. Thus no need to edit your SSH daemon config.

我建议您从新的VM重新开始,仅更改端点的公共端口.这样的配置不会有问题.您遇到的问题可能是由IPTABLES配置引起的,该配置不允许传入的12131.

I suggest that you start over with a new VM and only change the public port of the endpoint. You will not have issues with such configuration. The issue you faced can be caused by IPTABLES configuration which does not allow incoming 12131.

更新

ubussl.cloudapp.net的配置完全符合我的描述.我让它在那里进行测试以进行连接.如果您无法连接,则是我们自己的ISP阻止了此连接.尝试将SSH公用端口转移到80或443,同时将SSH公用端口转移到22,以确保连接没有被ISP/CORP防火墙有意阻止.

ubussl.cloudapp.net is configured exactly the way I describe. I let it there for test to connect. If you cannot connect, then it is our very own ISP that is blocking this connection. Try shifting the SSH public port to 80 or 443, while living the private to 22 to make sure the connection is not intentionally blocked by ISP / CORP firewall.

这篇关于如何正确更改Microsoft Azure中的SSH端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆