I have installed RasPi Raspbian, and now I can’t do ssh or git clone, only local host names are being resolved it seems. And yet ping works:
pi ~ $ ssh test.com
ssh: Could not resolve hostname test.com: Name or service not known
pi ~ $ git clone gitosis@test.com:test.git
Cloning into 'test'...
ssh: Could not resolve hostname test.com: Name or service not known
fatal: The remote end hung up unexpectedly
pi ~ $ ping test.com
PING test.com (174.36.85.72) 56(84) bytes of data.
I sort of worked around it for github by using http://github.com instead of git://github.com, but this is not normal and I would like to pinpoint the problem.
Googling for similar issues but the solutions offered was either typo correction, or adding domains to hosts file.
asked Feb 25, 2013 at 0:53
![]()
2
This sounds like a DNS issue. Try switching to another DNS server and see if it works.
OpenDNS
- 208.67.222.222
- 208.67.220.220
GoogleDNS
- 8.8.8.8
- 8.8.4.4
answered Feb 25, 2013 at 1:17
chirinoskychirinosky
4,4081 gold badge27 silver badges38 bronze badges
3
Try reseting te contents of the DNS client resolver cache.
(For windows) Fireup a command prompt and type:
ipconfig /flushdns
If you are a linux or mac user, they have their own way of flushing the dns.
answered Sep 29, 2016 at 4:36
OzeshOzesh
6,2161 gold badge24 silver badges23 bronze badges
Had the same error, I just needed to specify a folder:
localmachine $ git pull ssh://someusername@127.0.0.1:38765
ssh: Could not resolve hostname : No address associated with hostname
fatal: The remote end hung up unexpectedly
localmachine $ git pull ssh://someusername@127.0.0.1:38765/
someusername@127.0.0.1's password:
That error message is just misleading.
answered Apr 23, 2014 at 17:06
![]()
kungfoomankungfooman
4,2171 gold badge42 silver badges30 bronze badges
if you’ve a network-manager installed
check /etc/nsswitch.conf
if you’ve got a line
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
remove the **[NOTFOUND=return]**
restart /etc/init.d/networking
the [NOTFOUND=return] prevents futher lookups if the first nameservwe doesn't respond correctly
answered Jul 10, 2013 at 10:01
This may be an issue with the proxy. Kindly unset and try.
git config --global --unset http.proxy
git config --global --unset https.proxy
![]()
Pang
9,335146 gold badges85 silver badges121 bronze badges
answered Jun 29, 2017 at 4:56
Some Minecraft players have encountered the ‘Can’t resolve hostname’ error when trying to join a server, forbidding them from joining any server.

Note: The ‘Can’t resolve hostname’ error means that the hostname you are trying to connect to cannot be resolved to an IP address.
After a deep investigation of this issue, we came up with a shortlist of possible culprits that cause this error to happen:
- Miswritten IP address – This error could appear if you’ve mistyped the address, even if you added one space between the numbers. You need to make sure that the IP address is written perfectly.
- Firewall blocking Minecraft – The Windows Firewall’s job is to protect your system from network-based threats, so is set by default to protect Minecraft, but this might be blocking the game to work properly. To fix this, you need to disable the Firewall for Minecraft from the Windows Firewall settings.
- Bad DNS Range – Another possibility that is known to cause this behavior for some users is a badly assigned DNS range. If this scenario is applicable, you can fix this issue by replacing your current DNS range with a more stable one.
Now that you are aware of all the possible causes that trigger this error, here is a list of methods that will help you get rid of the ‘Can’t resolve hostname’ error:
Make sure that the server’s IP address is written correctly
Before jumping straight to the fixes, some affected players suggest that you should double-check the server’s IP address to see if it is mistyped.
Make sure that there are no extra spaces or characters in the address you typed to confirm that this is not the problem.
After you are sure that the server’s IP address is typed correctly, try to access the server again to see if the issue still occurs.
If you’ve done that and the error still appears, check below the following method.
Disable Firewall for Minecraft
A few players suggest that you will fix the ‘Can’t resolve hostname’ error by disabling the Windows Firewall for Minecraft.
The Windows Firewall is used to protect your Windows system from network-based threats. You can always configure these Windows Firewall settings from the Control Panel settings.
If you don’t know how to do that, follow the next instructions:
- Press Windows key + R and type ‘control’, then press Enter.

Opening up the Control menu - Inside the Control Panel menu, search for Allow an app through Windows Firewall and access it.

Allowing an app through Firewall - After that, firstly you need to click on Change settings to give administrator permission. Through the list of apps search for Minecraft, then click on Remove to disable the firewall for Minecraft.

Configuring the allowed apps - Now test the game and if your problem is still occurring, check below the last method.
Edit the DNS server address
Some people recommend changing the DNS server address for your network to fix the ‘Can’t resolve hostname’ error. The DNS server is set by default to pick an address automatically, so you have to change that from the Settings.
A DNS server is a computer server that contains a database of public IP addresses and their associated hostnames, and in most cases serves to resolve, or translate, those names to IP addresses as requested.
Follow the next guide if you don’t know how to change the DNS server address:
- Use the taskbar search option to search for Network and access the first result.

View networks and tasks - Inside the Network and Sharing Center, click on Change adapter settings.

Changing the adapter settings - Now right click on the Network address you are using, then click on Properties.

Accessing the network properties screen - Through the list of items that appeared on your screen, search for Internet Protocol Version 4 (TCP/IPv6), highlight it and click on Properties.

Accessing the Properties screen of IPv4 - Now, click on the circle next to Use the following DNS server addresses, then insert the following codes inside the two boxes:
208.67.222.222 208.67.220.220

Adjusting the DNS servers - After that, click on OK and your ‘Can’t resolve hostname’ error will be fixed.
Kamil Anwar
Kamil is a certified MCITP, CCNA (W), CCNA (S) and a former British Computer Society Member with over 9 years of experience Configuring, Deploying and Managing Switches, Firewalls and Domain Controllers also an old-school still active on FreeNode.
SSH stands for secure shell, and it is a security protocol that provides end-to-end encryption of data. SSH could not resolve hostname is an error message that occurs when the host system fails to resolve the IP address of the remote host provided with the ssh command. Ssh protocol is widely used to provide secure remote shell access.
The ssh command is used to connect to a remote host. The ssh command requires a hostname to connect to, which is then inquired from a DNS(Domain Name System) server that sends the IP address of the remote host the user is trying to login to. If, for some reason, if the hostname is not resolved, then the ssh could not resolve the hostname error message is displayed.
Contents
- 1 Understanding SSH
- 2 SSH hostname resolution and DNS
- 3 Fixes ssh could not resolve hostname
- 3.1 Check the hostname
- 3.2 Clearing DNS Cache
- 3.3 Editing the /etc/hosts file
- 4 SSh could not resolve hostname github.com
- 5 SSH could not resolve hostname Gitlab
- 6 SSH could not resolve hostname Gitbucket.org
- 7 FAQs on SSH Could Not Resolve Hostname
- 7.1 What is TCP?
- 7.2 What is the difference between git and GitHub?
- 7.3 What is the Linux equivalent of ipconfig?
- 8 Conclusion
- 9 Trending Now
Understanding SSH
Secure Shell is an intermediate protocol that is implemented between the application layer and the transport layer of the Internet protocol stack. It works on top of the TCP protocol, ensuring reliable delivery and data integrity. To connect to a remote shell, use the ssh command and provide the username and the hostname of the remote host you are trying to connect. Public key cryptography is used to authenticate the user. The private key is stored in the user’s host, which provides authentication. The ssh could not resolve hostname is one of the common errors faced while using ssh.

SSH hostname resolution and DNS
The hostname provided in the ssh command has to be resolved to an IP address, i.e., the address of the remote host in computer-readable form. The hostname can be provided in the IP address form example, 192.168.43.89, or a name can be used instead of example.com, for example. A DNS server is used to resolve the hostname to an IP address. The string of characters provided as the hostname in the command is sent to the DNS server, which then, in turn, returns the IP address of the host.
If the host is unable to contact the DNS server or the DNS server doesn’t return a valid IP address in return then, ssh could not resolve the hostname error that occurs. The ssh could not resolve hostname can also happen due to the cached DNS data stored in the system. Frequently used Domain name addresses are stored in cache storage in the host system so that the system doesn’t need to enquire the DNS server every time it makes a request. If the cache data is outdated or the host’s IP has been charged, the cached data becomes useless and can cause problems like ssh could not resolve the hostname.
If you are receiving the ssh could not resolve the hostname error, then a few steps can be employed to resolve and avoid this error message. Consider the given steps to fix the ssh could not resolve the hostname error.
Check the hostname
Most of the basic and simple measures to avoid the ssh could not resolve hostname is to check whether the hostname you are using with the ssh command is correct or not. Using the wrong hostname or domain address might result in a Wrong DNS response or no valid response at all. Check your hostname address for typos and syntax errors of the command. If everything is correct but still getting the hostname does not resolve the error, then employ the following measures.

Clearing DNS Cache
Clearing the DNS cache might also help resolve the ssh could not fix the hostname error. After the DNS cached data is deleted, a new fresh DNS inquiry is sent to the DNS server for each request, which would be beneficial if the IP address of the host is changed. Follow the given steps to clear the DNS cache in Windows.
- Press Windows + R.
- Enter cmd in the serach box and hit enter.
- In the shell Enter the command ipconfig /flushdns.
- The DNS cache is not cleared.
- Try running the ssh command again.
For Ubuntu users, Enter the following command in the terminal to clear the DNS cache manually.

Editing the /etc/hosts file
If you are trying to connect to a remote host using ssh for the first time and getting a hostname error not resolved error in return, try editing the ssh hosts file and entering the username and hostname in the file. Employing the given steps to edit the hosts’ file and fix the ssh could not resolve the hostname error.
- Open the terminal emulator.
- Enter sudo nano /etc/hosts.
- Enter your root password.
- Now in the file, enter the IP address and hostname of your remote host.
- Press ctrl + O to save the file.
- Press ctrl + X to exit nano.
- Run the ssh command again.

SSh could not resolve hostname github.com

The ssh could not resolve hostname error can also show up while using the git version management program. The git uses the ssh while cloning a repository or pushing a remote repository. The issue can be fixed with the following steps.
- Try to ping the github.com using the ping github.com command. If the server responds then try to run the git command again after rebooting the system, it might be a normal network issue.
- If the issue persists, follow the steps mentioned above, such as clearing the DNS cache.
- Run the following command to restart the network manager in linux, which might help resolve the issue.
sudo service network-manager restart
SSH could not resolve hostname Gitlab
Gitlab is another popular open-source platform that is widely used in DevOps operations. “ssh: Could not resolve hostname gitlab.example.com: Temporary failure in name resolution” is the error message that is displayed while logging into the GitLab server. As the message itself suggests, this is a temporary failure in the name resolution, and chances would be resolved automatically after some time. But if the problem persists, follow the steps suggested above to make it work. You could also try adding ssh:// before the git URL to resolve the hostname issue.
git clone ssh://[email protected]:username/This_is_a_demo.git
SSH could not resolve hostname Gitbucket.org
Bitbucket is another open platform used to host git repositories online. The same hostname resolution problem can be encountered with gitbucket.org as with github.com. To resolve this issue, use the suggested methods and configure your .git config file. Open the config file in the .git folder for your project’s main directory. Change the remote directory listing as mentioned below (remove the ssh:// in the config file) and rerun the command.
url = ssh://[email protected]
//before
url = [email protected]
//after
FAQs on SSH Could Not Resolve Hostname
What is TCP?
It stands for Transfer Control Protocol. It is a transport layer protocol that ensures the reliable hosts-to-host delivery of the data packets.
What is the difference between git and GitHub?
Git is a version management program that keeps track of the changes in a project, While GitHub is an online platform where people can share their git repositories.
What is the Linux equivalent of ipconfig?
The Linux equivalent of the ipconfig command is ifconfig.
Conclusion
The ssh could not resolve hostname is a common error that any user can face. It is not that big of an issue. It simply happens when the ssh command fails to resolve the IP address of the provided hostname. In such situations clearing the DNS cache or editing the /etc/host file can help. This article provided you with the necessary measure and solutions to fix this error. In the end, we also mentioned what to do if you are receiving this error while using the git CLI.
Trending Now
-

Resolve Error Code E4301 Using These 4 Exciting Methods
●October 20, 2022
-

15 Incredible Ways to Fix Paramount Plus Keeps Pausing Error
by Amal Santosh●October 20, 2022
-

5 Strategies to Fix Adobe Short Media Token Validation Error Invalid Signature
by Amal Santosh●October 11, 2022
-

Fix the Apple TV 4K Turns off by Itself with 7 Wonderful Ways
by Amal Santosh●October 11, 2022
Stuck with ‘SSH: could not resolve hostname: no such host’ is known error? We can help you.
This error implies that the server is down or the hostname is not given properly etc.
At Bobcares, we often get requests from our customers regarding SSH as part of our Server Management Services.
Today, we’ll see the reasons for this error to occur and how our Support Engineers fix it.
Why SSH: Could not resolve hostname server error?
Now, let’s discuss what causes this error to occur.
Many developers reported that lack of connectivity is the most common cause of this error.
So, we always make sure that it is properly connected to the internet.
Today, let’ see some scenarios where our Engineers handled this error perfectly.
How we fix this error?
Having a decade of experience in managing servers, our Dedicated Engineers are familiar with the SSH errors. Now, let’s discuss how our Support Engineers fix this error.
As we already discussed some of the possible causes for this error, the next question is how we fix it?
Recently, one of our customers approached us saying that he is getting an error like the one shown below while he is trying to ssh.
So, our Support Engineers checked in detail and found that he was trying to ssh using the way below:
ssh IP ADDRESS:22
We suggested the customer to try ssh-ing using the command as shown below:
ssh -p 22 user@IP ADDRESS
This way he was successfully able to SSH into the server.
Also, we handled a situation where the customer approached with the same error. But, when checked /etc/hosts file was configured properly.
So, we did deep dig and found that the hostname was not given properly in /etc/hosts file.
We added the hostname as:

Finally, this fixed the problem.
[Need any assistance with SSH errors? – We’ll help you]
Conclusion
In short, this error may occur either due to some connectivity issues or some wrong configuration. Also, we saw how our Support Engineers find fix for this error in detail.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
GET STARTED
var google_conversion_label = «owonCMyG5nEQ0aD71QM»;
You may get an error message when connecting to a machine that says ssh: Could not resolve hostname server: Name or service not known. This might happen if you cannot connect wirelessly or don’t have enough signal strength for your device, but it can also occur because of typos in the command line prompt.
In this article, we’ll talk about how to fix it so you can reaccess your machine.
Solution 1: Check the Hostname
When trying to SSH to a server, verify the full command you are running. You may be typing a command that the ssh program does not understand.
Here is an example of a command you may have run:
ssh [email protected] 74.6.11.164
ssh: Could not resolve hostname myserver: Name or service not known
As you can see, the error shown is about not resolving the hostname myserver.
When you use the ssh program, the command you will use should be the following:
ssh [email protected]
ssh [email protected]74.6.11.164
In the previous example, user is root and hostname is myserver which is not a valid hostname. The correct example is shown you provide user as root and hostname as 74.6.11.164.
Solution 2: Add an Entry in /etc/hosts
You may have a scenario where you do want to specify myserver as your hostname because you don’t want to type the IP address 74.6.11.164. In this case, you would need to add an entry in /etc/hosts.
To make this change, open the /etc/hosts file and add myserver line to the end of the file such as the following example:
# Sample /etc/hosts file
127.0.0.1. localhost
74.6.11.164 myserver
Once this entry has been saved in /etc/hosts, you can ssh to the server by typing:
ssh [email protected]
You should not be able to connect to your specified server.
Solution 3: Check the Hosts Directive
If the previous didn’t fix your issue, it may be the ordering of the hosts directive in your /etc/nsswitch.conf file.
Take a look at your /etc/nsswitch.conf. It should have this line:
hosts: files dns
With the above line, your Linux system will look at files first which is /etc/hosts to resolve DNS. If it doesn’t find anything there, it will query DNS in /etc/resolv.conf.
If your /etc/resolv.conf shows a different entry than the above, you may consider updating it and then connect to your server again.
25 мая, 2017 11:40 дп
85 491 views
| Комментариев нет
Linux, SSH
В первой статье этой серии вы узнали о том, как и в каких ситуациях вы можете попробовать исправить ошибки SSH. Остальные статьи расскажут, как определить и устранить ошибки:
- Ошибки протокола: в этой статье вы узнаете, что делать, если сбрасываются клиентские соединения, клиент жалуется на шифрование или возникают проблемы с неизвестным или измененным удаленным хостом.
- Ошибки аутентификации: поможет устранить проблемы с парольной аутентификацией или сбросом SSH-ключей.
- Ошибки оболочки: это руководство поможет исправить ошибки ветвления процессов, валидации оболочки и доступа к домашнему каталогу.
Для взаимодействия SSH-клиента с SSH-сервером необходимо установить базовое сетевое подключение. Это руководство поможет определить некоторые общие ошибки подключения, исправить их и предотвратить их возникновение в будущем.
Требования
- Убедитесь, что можете подключиться к виртуальному серверу через консоль.
- Проверьте панель на предмет текущих проблем, влияющих на работу и состояние сервера и гипервизора.
Основные ошибки
Разрешение имени хоста
Большинство ошибок подключения возникает тогда, когда ссылка на хост SSH не может быть сопоставлена с сетевым адресом. Это почти всегда связано с DNS, но первопричина часто бывает не связана с DNS.
На клиенте OpenSSH эта команда:
ssh user@example.com
может выдать ошибку:
ssh: Could not resolve hostname example.com: Name or service not known
В PuTTY может появиться такая ошибка:
Unable to open connection to example.com Host does not exist
Чтобы устранить эту ошибку, можно попробовать следующее:
- Проверьте правильность написания имени хоста.
- Убедитесь, что вы можете разрешить имя хоста на клиентской машине с помощью команды ping. Обратитесь к сторонним сайтам (WhatsMyDns.net, например), чтобы подтвердить результаты.
Если у вас возникают проблемы с разрешением DNS на любом уровне, в качестве промежуточного решения можно использовать IP-адрес сервера, например:
ssh user@111.111.111.111
# вместо
ssh user@example.com.
Истечение времени соединения
Эта ошибка значит, что клиент попытался установить соединение с SSH-сервером, но сервер не смог ответить в течение заданного периода ожидания.
На клиенте OpenSSH следующая команда:
ssh user@111.111.111.111
выдаст такую ошибку:
ssh: connect to host 111.111.111.111 port 22: Connection timed out
В PuTTY ошибка выглядит так:
Network error: Connection timed out
Чтобы исправить ошибку:
- Убедитесь, что IP-адрес хоста указан правильно.
- Убедитесь, что сеть поддерживает подключение через используемый порт SSH. Некоторые публичные сети могут блокировать порт 22 или пользовательские SSH-порты. Чтобы проверить работу порта, можно, например, попробовать подключиться к другим хостам через этот же порт. Это поможет вам определить, не связана ли проблема с самим сервером.
- Проверьте правила брандмауэра. Убедитесь, что политика по умолчанию – не DROP.
Отказ в соединении
Эта ошибка означает, что запрос передается на хост SSH, но хост не может успешно принять запрос.
На клиенте OpenSSH следующая команда выдаст ошибку:
ssh user@111.111.111.111
ssh: connect to host 111.111.111.111 port 22: Connection refused
В PuTTY ошибка появится в диалоговом окне:
Network error: Connection refused
Эта ошибка имеет общие с ошибкой Connection Timeout причины. Чтобы исправить её, можно сделать следующее:
- Убедиться, что IP-адрес хоста указан правильно.
- Убедиться, что сеть поддерживает подключение через используемый порт SSH. Некоторые публичные сети могут блокировать порт 22 или пользовательские SSH-порты. Чтобы проверить работу порта, можно, например, попробовать подключиться к другим хостам через этот же порт.
- Проверить правила брандмауэра. Убедитесь, что политика по умолчанию – не DROP, и что брандмауэр не блокирует этот порт.
- Убедиться, что сервис запущен и привязан к требуемому порту.
Рекомендации по исправлению ошибок подключения
Брандмауэр
Иногда проблемы с подключением возникают из-за брандмауэра. Он может блокировать отдельные порты или сервисы.
Читайте также: Что такое брандмауэр и как он работает?
В разных дистрибутивах используются разные брандмауэры. Вы должны научиться изменять правила и политики своего брандмауэра. В Ubuntu обычно используется UFW, в CentOS – FirewallD. Брандмауэр iptables используется независимо от системы.
Читайте также:
- Основы UFW: общие правила и команды фаервола
- Настройка брандмауэра FirewallD в CentOS 7
- Основы Iptables: общие правила и команды брандмауэра
Чтобы настроить брандмауэр, нужно знать порт сервиса SSH. По умолчанию это порт 22.
Чтобы запросить список правил iptables, введите:
iptables -nL
Такой вывод сообщает, что правил, блокирующих SSH, нет:
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Если в выводе вы видите правило или политику по умолчанию REJECT или DROP, убедитесь, что цепочка INPUT разрешает доступ к порту SSH.
Чтобы запросить список правил FirewallD, введите:
firewall-cmd --list-services
Список, появившийся на экране, содержит все сервисы, которые поддерживаются брандмауэром. В списке должно быть правило:
dhcpv6-client http ssh
Если вы настроили пользовательский порт SSH, используйте опцию –list-ports. Если вы создали пользовательское определение сервиса, добавьте опцию –list-services, чтобы найти SSH.
Чтобы проверить состояние UFW, введите:
ufw status
Команда вернёт доступные порты:
Status: active
To Action From
-- ------ ----
22 LIMIT Anywhere
443 ALLOW Anywhere
80 ALLOW Anywhere
Anywhere ALLOW 192.168.0.0
22 (v6) LIMIT Anywhere (v6)
443 (v6) ALLOW Anywhere (v6)
80 (v6) ALLOW Anywhere (v6)
В списке должен быть порт SSH.
Проверка состояния сервиса SSH
Если вы не можете подключиться к серверу по SSH, убедитесь, что сервис SSH запущен. Способ сделать это зависит от операционной системы сервера. В более старых версиях дистрибутивов (Ubuntu 14.04, CentOS 6, Debian 8) используется команда service. Современные дистрибутивы на основе Systemd используют команду systemctl.
Метод проверки состояния сервиса может варьироваться от системы к системе. В более старых версиях (Ubuntu 14 и ниже, CentOS 6, Debian 6) используется команда service, поддерживаемая системой инициализации Upstart, а в более современных дистрибутивах для управления сервисом используется команда systemctl.
Примечание: В дистрибутивах Red Hat (CentOS и Fedora) сервис называется sshd, а в Debian и Ubuntu – ssh.
В более старых версия используйте команду:
service ssh status
Если процесс работает должным образом, вы увидите вывод, который содержит PID:
ssh start/running, process 1262
Если сервис не работает, вы увидите:
ssh stop/waiting
В системах на основе SystemD используйте:
systemctl status sshd
В выводе должна быть строка active:
sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled)
Active: active (running) since Mon 2017-03-20 11:00:22 EDT; 1 months 1 days ago
Process: 899 ExecStartPre=/usr/sbin/sshd-keygen (code=exited, status=0/SUCCESS)
Main PID: 906 (sshd)
CGroup: /system.slice/sshd.service
├─ 906 /usr/sbin/sshd -D
├─26941 sshd: [accepted]
└─26942 sshd: [net]
Если сервис не работает, вы увидите в выводе inactive:
sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled)
Active: inactive (dead) since Fri 2017-04-21 08:36:13 EDT; 2s ago
Process: 906 ExecStart=/usr/sbin/sshd -D $OPTIONS (code=exited, status=0/SUCCESS)
Process: 899 ExecStartPre=/usr/sbin/sshd-keygen (code=exited, status=0/SUCCESS)
Main PID: 906 (code=exited, status=0/SUCCESS)
Чтобы перезапустить сервис, введите соответственно:
service ssh start
systemctl start sshd
Проверка порта SSH
Существует два основных способа проверить порт SSH: проверить конфигурационный файл SSH или просмотреть запущенный процесс.
Как правило, конфигурационный файл SSH хранится в /etc/ssh/sshd_config. Стандартный порт 22 может переопределяться любой строкой в этом файле, определяющей директиву Port.
Запустите поиск по файлу с помощью команды:
grep Port /etc/ssh/sshd_config
Читайте также: Использование Grep и регулярных выражений для поиска текстовых шаблонов в Linux
Команда вернёт:
Port 22
Если вы уже убедились, что сервис работает, теперь вы можете узнать, работает ли он на требуемом порте. Для этого используйте команду ss. Команда netstat –plnt выдаст аналогичный результат, но команду ss рекомендуется использовать для запроса информации сокета из ядра.
ss -plnt
В выводе должно быть указано имя программы и порт, который она прослушивает. Например, следующий вывод сообщает, что сервис SSH прослушивает все интерфейсы и порт 22.
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:* users:(("sshd",pid=1493,fd=3))
LISTEN 0 128 :::22 :::* users:(("sshd",pid=1493,fd=4))
Символ * и 0.0.0.0 указывает, что все интерфейсы сервера прослушиваются. Строка 127.0.0.1 значит, что сервис не является общедоступным. В sshd_config директива ListenAddress должна быть закомментирована, чтобы прослушивать все интерфейсы, или должна содержать внешний IP-адрес сервера.
Если у вас не получается самостоятельно настроить соединение SSH, вы можете обратиться за помощью к службе поддержки своего хостинг-провайдера.
Tags: firewalld, Iptables, OpenSSH, PuTTY, SSH, UFW
It’s very popular for modern Minecraft servers to use a “hostname” instead of a traditional IP address. A hostname acts similar to a domain name, but one that is used to connect to the server. Typically servers will add the “play” subdomain to achieve this.
The “can’t resolve hostname” error in Minecraft means that the game is unable to find the hostname that you are entering.
Fixing “Can’t Resolve Hostname”
There are a number of different reasons this error can occur. Some are more simple than others. It can range from mistyping the name, to issues with a firewall or router settings.
Firstly, make sure that you are typing the correct name! Any extra characters or symbols or spaces will prompt this error. It must be exact.
If this doesn’t work, the next step is to try connecting to the actual IP address of the server. Many times servers that use hostnames will not display their IP address as well. We can find it though!
- Search your computer for “cmd” and open a Command Prompt.
- Find the hostname of the server. In this example we will use: play.strongcraft.org
- In your console, type: nslookup <hostname here>
- Press Enter
- Copy the Address displayed under the “Non-authoritative answer” section

This address that we’ve copied is the actual IP of the server! We can now enter this IP directly into Minecraft to connect.

Still not working?
If entering the direct IP address does not work, there may be an error with the server. There is a quick way we can test our connection to the server without using Minecraft.
- Open up another Command Prompt.
- Type: ping <server IP address here>
- Press Enter
This will display your connection to the server. If you receive “Request timed out.” at any point during this process, it means that you are not able to establish a connection to the server. For the most part, this means it is offline.

If the pinging process completed without this error, it usually means there is an underlying issue with a firewall. This can be occurring from your side, or on the end of the server. It is best to contact the server administrators if you cannot connect at this point