tenhishadow / mbkp

Mikrotik backup script | simple bash script for doing encrypted backups of mikrotik devices(Routeros) via ssh. Script will do password-protected binary and encrypted with openssl export on regular basis
MIT License
25 stars 12 forks source link

ssh: Could not resolve hostname : hostname nor servname provided, or not known #4

Closed djkerya closed 3 years ago

djkerya commented 4 years ago

ssh: Could not resolve hostname : hostname nor servname provided, or not known ssh: Could not resolve hostname : hostname nor servname provided, or not known ERR: cannot establish ssh-connection

akokarev commented 3 years ago

Check ping to hostname, check dns server. Use IP address, not hostname/domain name. This problem is not with script.

tenhishadow commented 3 years ago

from example.conf: https://github.com/tenhishadow/mbkp/blob/15fdaf72e59b83e22a464172126c25b85d781c9d/example.cfg#L7

@djkerya please just configure your devices using ssh config file like described here: https://www.digitalocean.com/community/tutorials/how-to-configure-custom-connection-options-for-your-ssh-client idea is that script just use ssh and you configure ssh outside the script using this approach.

I configure it like this:


# gw jump
host mikrotik1
  User backup_user
  Hostname 1.1.1.1
  IdentityFile ~/.ssh/mykey

# ap
host mikrotik-ap1
  User backup_user
  Hostname 192.168.88.2
  ProxyJump mikrotik1 # use gw as an entrypoint
  IdentityFile ~/.ssh/mykey

This is an advanced usage that could cover any cases basically you could read it using man:

man ssh
man ssh_config