Eu tenho muitos clientes precisam verificar se a porta está aberta no servidor remoto. Eu uso o comando nc para fazer este trabalho, no entanto sempre dar falha de pesquisa de DNS, mas posso encontrar com êxito o registro DNS usando o dig ou nslookup.
Alguém sabe o motivo? Obrigado!
[root@client ~]# nc -vzw5 d1.myserver.com 443
d1.myserver.com: forward host lookup failed: Unknown host : No such file or directory
[root@ndc-nz1-1 ~]# nslookup d1.myserver.com
Server: 192.168.1.155
Address: 192.168.1.155#53
Name: d1.myserver.com
Address: 192.168.2.25
[root@client ~]# dig d1.myserver.com
; <<>> DiG 9.2.4 <<>> d1.myserver.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11270
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;d1.myserver.com. IN A
;; ANSWER SECTION:
d1.myserver.com. 7200 IN A 192.168.2.25
;; Query time: 1 msec
;; SERVER: 192.168.1.155#53(192.168.1.155)
;; WHEN: Tue Jul 21 21:13:21 2015
;; MSG SIZE rcvd: 67
Informações sobre o arquivo no nsswitch.conf
[root@client ~]# cat /etc/nsswitch.conf |grep
hosts: files dns
[root@client ~]# ll /etc/nsswitch.conf
-rw-r--r-- 1 root root 1658 Apr 1 2008 /etc/nsswitch.conf
Informações sobre o arquivo no resolv.conf
[root@client ~]# cat /etc/resolv.conf
nameserver 192.168.1.155
options timeout:1
Tentando usar outros comandos:
[root@client ~]# ping d1.myserver.com
ping: unknown host d1.myserver.com
[root@client ~]# wget d1.myserver.com
--01:47:57-- http://d1.myserver.com/
=> 'index.html'
Resolving d1.myserver.com... 192.168.2.25
Connecting to d1.myserver.com|192.168.2.25|:80... connected.