How to know the IP address of some host somename I can ssh to?
Use the verbose flag (-v) of the ssh command:
ssh somename -v
The output should contain, among other things, a line that shows the resolved IP of the server you are connecting to:
debug1: Connecting to aur.archlinux.org [5.9.250.164] port 22.
If I do nslookup on this host it says "no answer". How can ssh resolve it's name then?
The most probable cause of ssh being able to resolve a hostname that nslookup cannot is that it is configured at the ssh level.
Per the ssh_config(5) manual page, there are three places where ssh looks at for config files:
- command-line options
- user's configuration file (~/.ssh/config)
- system-wide configuration file (/etc/ssh/ssh_config)
One of these files may contain your hostname somename (or a pattern that matches it) as an alias of another hostname or IP. For example:
# explicit alias of somename to 8.8.8.8 IP
Host somename
HostName 8.8.8.8
# pattern alias (that obviously matches somename) to another hostname
# that is itself resolved via DNS (and that can be nslookup-ed).
Host *
HostName anotherhostname
Please refer to the ssh_config(5) manual page explanations of Host and HostName directives and to the PATTERNS section for more information.