一些拼写错误的 SSH 主机被解析为 127.0.0.1 等效

Mar*_*ing 1 fedora ssh dns

我有一台 Fedora 25 机器。有时我会拼错 SSH 的主机名。那我做ssh examle.com。出于某种原因,我然后localhost通过 SSH连接到我的机器 ( )。我注意到这一点是因为如果SSH_环境中有变量,我的 shell 提示就会显示出来。

现在在家里,我收到一个干净的主机名解析错误。有时这可能是什么原因?一些本地 DNS 服务器只是解析它不知道的所有内容127.0.0.1

StrictHostKeyChecking no

host juqueen
hostname juqueen.fz-juelich.de
user hbn28e
controlpath ~/.ssh/controlmasters/%r@%h:%p
controlmaster auto
controlpersist 15m


host judac
hostname judac.fz-juelich.de
user hbn28e
controlpath ~/.ssh/controlmasters/%r@%h:%p
controlmaster auto
controlpersist 15m

host martin-ueding.de
hostname martin-ueding.de
user ssh-444717-mu
StrictHostKeyChecking yes

host hiskp
hostname plato.itkp.uni-bonn.de                                                                                        
user ueding                                                                                                            

host chaos                                                                                                             
hostname chaos.stw-bonn.de                                                                                             
user mu                                                                                                                

host gateway.cb.uni-bonn.de                                                                                            
ForwardAgent yes                                                                                                       
hostname gateway.cb.uni-bonn.de                                                                                        
user ueding                                                                                                            
checkhostip yes                                                                                                        
controlpath ~/.ssh/controlmasters/%r@%h:%p                                                                             
controlmaster auto                                                                                                     
controlpersist 15m                                                                                                     

host qbig                                                                                                              
ForwardAgent yes                                                                                                       
#hostname gateway.cb.uni-bonn.de                                                                                       
ProxyCommand ssh gateway.cb.uni-bonn.de "nc qbig %p"                                                                   
user ueding                                                                                                            
checkhostip yes                                                                                                        
controlpath ~/.ssh/controlmasters/%r@%h:%p                                                                             
controlmaster auto                                                                                                     
controlpersist 15m                                                                                                     

host gsp.fz-juelich.de                                                                                                 
hostname gsp.fz-juelich.de                                                                                             
identityfile ~/.ssh/id_gsp_owncloud                                                                                    

host martin-welsh                                                                                                      
hostname martin-welsh.fritz.box                                                                                        

host martin-shire                                                                                                      
hostname martin-shire.fritz.box                                                                                        

host martin-friese
hostname martin-friese.fritz.box
#hostname 192.168.188.71

host root@martin-welsh
user root
hostname martin-welsh.local

host martin-criollo
hostname 192.168.188.21
user shell
port 2222

host martin-falabella
hostname martin-falabella.fritz.box
port 2222

host cip
hostname cip-pool.physik.uni-bonn.de
user s6mauedi
Run Code Online (Sandbox Code Playgroud)

在家里,我有一个 AVM FRITZ!Box 路由器。这会产生一些 DNS 魔法,并让您解析本地网络中的名称。所以我可以ssh martin-friese.fritz.box从另一台电脑上做并连接到笔记本电脑。这在没有任何 Avahi/Zeroconf/Bonjour 东西的情况下很好地工作,因此也立即支持 Windows 和 Android。地址http://fritz.box被解析到路由器的 Web 界面 ( 192.168.???.1)。

在大学里,我的电脑仍然有 hostname martin-friese.fritz.box。也许这对我的 Fedora 安装来说有点太深了。我想我应该拥有martin-friese并让 FRITZ!Box DNS 在.fritz.box我在家时烘烤。

当我现在尝试解析不存在的主机名时,我得到以下信息:

$ host this-does-not-exist
this-does-not-exist.fritz.box has address 127.0.53.53                                                                  
this-does-not-exist.fritz.box mail is handled by 10 your-dns-needs-immediate-attention.box.
Run Code Online (Sandbox Code Playgroud)

互联网搜索your-dns-needs-immediate-attention告诉我.boxTLD 现在是一个有效域,因此我的 DNS 与全球 DNS 存在冲突。

的输出dig并没有真正帮助我。

$ dig this-does-not-exist

; <<>> DiG 9.10.4-P5-RedHat-9.10.4-4.P5.fc25 <<>> this-does-not-exist                                                  
;; global options: +cmd                                                                                                
;; Got answer:                                                                                                         
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 10457                                                             
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1                                                

;; OPT PSEUDOSECTION:                                                                                                  
; EDNS: version: 0, flags:; udp: 4096                                                                                  
;; QUESTION SECTION:                                                                                                   
;this-does-not-exist.           IN      A                                                                              

;; AUTHORITY SECTION:                                                                                                  
.                       10800   IN      SOA     a.root-servers.net. nstld.verisign-grs.com. 2017013000 1800 900 604800 86400

;; Query time: 13 msec                                                                                                 
;; SERVER: 131.220.226.3#53(131.220.226.3)                                                                             
;; WHEN: Mo Jan 30 16:51:54 CET 2017                                                                                   
;; MSG SIZE  rcvd: 123
Run Code Online (Sandbox Code Playgroud)

所以我想我只需要将我的主机名更改为martin-friese没有.fritz.box? 或者我应该将其更改为friese.martin-ueding.de,我拥有域但注册商对我的笔记本电脑一无所知。

Pat*_*zek 5

127.0.53.53 是新 gTLD 引入的保护措施,称为 WCIP(通配控制中断计划),请参阅https://www.icann.org/resources/pages/name-collision-2013-12-06-en

如果你看里面https://www.icann.org/sites/default/files/ci-monitoring/citld-complete.csv,你会看到新.box的gTLD在这种情况下之间2016-11-11,并2017-02-08为其下所有的SLD(通配符)。

在您的 ssh 配置中,该host部分是您想要的任何令牌,它纯粹是本地的。但是,对于hostname您应该放置一个可以在 ssh 配置所在的计算机上解析的名称。DNS解析由内容管辖UNIX系统上/etc/resolv.conf,将除其他事项外,指定域名服务器会被询问递归查询以及潜在的后缀,如果你在使用它的名称太少点(见增加searchdomainndots选项)。

friese.martin-ueding.de目前确实成功解析134.119.45.68为只要此解析保留并希望它是正确的 IP,您应该能够ssh friese.martin-ueding.de从任何地方执行并在传输级别成功建立连接(当然在谈论身份验证之前)。

顺便说一下,基于 whois,fritz.box目前还不是现有域。将来有人注册时会发生很多“乐趣”。