How to know the IP address of some host
somename I can
Use the verbose flag (
-v) of the
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 [18.104.22.168] 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_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 22.214.171.124 IP
# pattern alias (that obviously matches somename) to another hostname
# that is itself resolved via DNS (and that can be nslookup-ed).
Please refer to the
ssh_config(5) manual page explanations of
HostName directives and to the
PATTERNS section for more information.