我使用AWS - Amazon Web Services并从MAC终端运行命令
http://ec2-52-xx-x-xx.us-west-2.compute.amazonaws.com
但是我收到了这个错误:
网关超时:无法连接到远程主机
由于此错误,我无法再访问该网站 有一个安全组应用于此实例 和ssh的端口22列在此安全组
下答案 0 :(得分:3)
Check the security group for this instance并尝试使用telnet IP< 允许入站端口> 。如果telnet发生在任何这些端口上,这意味着连接就在那里。
现在来了ssh,默认情况下ssh在端口22上,根据你已经允许的安全组。所以你需要检查是否有人更改了sshd_config文件并更改了端口?
答案 1 :(得分:1)
简单地说,入站防火墙可以保护网络免受来自Internet或其他网段的传入流量的侵害,即不允许的连接,恶意软件和拒绝服务攻击。出站防火墙可以防止来自企业网络内部的传出流量。
答案 2 :(得分:0)
您确定该主机实际上仍然名为ec2-52-xx-x-xx.us-west-2.compute.amazonaws.com吗?每次停止并重新启动Amazon EC2实例时,公用DNS名称都将更改。在AWS控制台中仔细检查它。
答案 3 :(得分:0)
ssh的端口22列在此安全组
下
这并不意味着什么。允许访问的IP地址是哪些?另外,请检查您的DNS名称是否未按照jarmod的建议进行更改。
答案 4 :(得分:0)
检查端口22的传入和传出规则,并尝试使用分配的IP4
答案 5 :(得分:0)
To connect using the SSH, ssh should be installed correctly on your machine
just type **"SSH"** if something like this comes up that means your machine has ssh
*usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-E log_file] [-e escape_char]
[-F configfile] [-I pkcs11] [-i identity_file]
[-J [user@]host[:port]] [-L address] [-l login_name] [-m mac_spec]
[-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address]
[-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]]
[user@]hostname [command]*
Mostly **Linux and macOS X** have already installed if not then go to the
[here][1]
For **Windows Server** 2019 and Windows 10 [Openssh in Windows][2]
The first check is there any problem with your ssh is allowed from the security group of that particular instance
like is it allowing to connect from ssh or not
once that is confirmed you have to enter the correct syntax to connect the AWS instance
Using Public DNS that is available under the running instance
**ssh -i /path/my-key-pair.pem my-instance-user-name@my-instance-public-dns-name**
Using ipv6 similarly, ipv4 can be done
**ssh -i /path/my-key-pair.pem my-instance-user-name@my-instance-IPv6-address**
in place of **my-instance-user-name** you can through documentation provided by AWs[1]
[1]: http://www.openssh.com
[2]: https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_overview