Auteur Sujet: dig localhost => erreur "Got bad packet: FORMERR"  (Lu 11454 fois)

0 Membres et 1 Invité sur ce sujet

vivien

  • Administrateur
  • *
  • Messages: 47 079
    • Twitter LaFibre.info
dig localhost => erreur "Got bad packet: FORMERR"
« le: 21 avril 2017 à 18:59:55 »
J'ai un pb avec dig sur un serveur Ubuntu 16.04 LTS : la commande tout simple dig localhost renvoi l'erreur Got bad packet: FORMERR systématiquement.

$ dig localhost
;; Got bad packet: FORMERR
54 bytes
32 43 81 a0 00 01 00 01 00 00 00 01 09 6c 6f 63          2C...........loc
61 6c 68 6f 73 74 00 00 01 00 01 c0 0c 00 01 00          alhost..........
01 00 00 2a 30 00 04 7f 00 00 01 00 00 00 00 00          ...*0...........
00 00 00 00 00 00                                        ......

Mon fichier /etc/hosts contiens bien l'IP de localhost :
127.0.0.1       localhost

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Vous avez une idée d'où peut être le problème ?

(dig localhost est appelé par smokeping pour une raison que j'ignore, ce qui le bloque vu le retour)

Le syslog :
smokeping[1178]:  * Starting latency logger daemon smokeping
smokeping[1178]: Sent data to Server and got new config in response.
smokeping[1178]: ERROR: output of '/usr/bin/dig localhost' does not match (?^i:query time:\s+([0-9.]+)\smsec.*)
smokeping[1178]:  at (eval 71) line 1.
smokeping[1178]:    ...done.

alain_p

  • Abonné Free fibre
  • *
  • Messages: 16 168
  • Delta S 10G-EPON sur Les Ulis (91)
dig localhost => erreur "Got bad packet: FORMERR"
« Réponse #1 le: 21 avril 2017 à 20:07:27 »
C'est quoi les DNS de la machine et le nom de domaine (domainname) ?

vivien

  • Administrateur
  • *
  • Messages: 47 079
    • Twitter LaFibre.info
dig localhost => erreur "Got bad packet: FORMERR"
« Réponse #2 le: 21 avril 2017 à 21:08:39 »
J'ai fait plusieurs changement de nom de a machine pensant que ce serait une solution.

Jusqu'à présent il n y avait pas de FQDN (Fully qualified domain name).

J'ai essayé en mettant un FQDN, même chose.

$ hostname
vivien2.testdebit.info

$ dig localhost
;; Got bad packet: FORMERR
54 bytes
4a 22 81 a0 00 01 00 01 00 00 00 01 09 6c 6f 63          J"...........loc
61 6c 68 6f 73 74 00 00 01 00 01 c0 0c 00 01 00          alhost..........
01 00 00 2a 30 00 04 7f 00 00 01 00 00 00 00 00          ...*0...........
00 00 00 00 00 00                                        ......

$ ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.022 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.024 ms
^C
--- localhost ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1004ms
rtt min/avg/max/mdev = 0.022/0.023/0.024/0.001 ms
vgu@vivien2:~$ ping vivien2.testdebit.info
PING vivien2.testdebit.info (127.0.1.1) 56(84) bytes of data.
64 bytes from vivien2.testdebit.info (127.0.1.1): icmp_seq=1 ttl=64 time=0.022 ms
64 bytes from vivien2.testdebit.info (127.0.1.1): icmp_seq=2 ttl=64 time=0.025 ms
^C
--- vivien2.testdebit.info ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1024ms
rtt min/avg/max/mdev = 0.022/0.023/0.025/0.005 ms

corrector

  • Invité
dig localhost => erreur "Got bad packet: FORMERR"
« Réponse #3 le: 21 avril 2017 à 23:03:06 »
Mon fichier /etc/hosts contiens bien l'IP de localhost :
...
Vous avez une idée d'où peut être le problème ?
...
...
output of '/usr/bin/dig localhost'
Oui, le problème est que tu mélanges tout :

Citer
dig (domain information groper) is a flexible tool for interrogating DNS name servers
...
Unless it is told to query a specific name server, dig will try each of the servers listed in /etc/resolv.conf.
https://linux.die.net/man/1/dig

corrector

  • Invité
dig localhost => erreur "Got bad packet: FORMERR"
« Réponse #4 le: 21 avril 2017 à 23:13:26 »
$ ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
Mais ping n'a aucun raison d'aller interroger les DNS!

ping n'est PAS un outil pour outil pour tester le DNS.

Hugues

  • AS2027 MilkyWan
  • Modérateur
  • *
  • Messages: 12 423
  • Lyon (69) / St-Bernard (01)
    • Twitter
dig localhost => erreur "Got bad packet: FORMERR"
« Réponse #5 le: 22 avril 2017 à 08:37:03 »
Non, mais ping interroge le DNS, pour 1/ traduire la query 2/ trouver un eventuel reverse DNS

corrector

  • Invité
dig localhost => erreur "Got bad packet: FORMERR"
« Réponse #6 le: 22 avril 2017 à 08:46:17 »
Non, ping demande à la libc qui demande à l'OS de traduire un nom en adresse.

ping se contrefiche du DNS!

BadMax

  • Client Free adsl
  • Expert
  • *
  • Messages: 3 481
  • Malissard (26)
dig localhost => erreur "Got bad packet: FORMERR"
« Réponse #7 le: 22 avril 2017 à 08:58:35 »
ping utilise /etc/nsswitch.conf pour savoir quoi utiliser pour trouver localhost.

Typiquement on regarde dans /etc/hosts puis le DNS. Dig regarde directement DNS normalement.

corrector

  • Invité
dig localhost => erreur "Got bad packet: FORMERR"
« Réponse #8 le: 22 avril 2017 à 09:48:54 »
ping a juste besoin de convertir une chaîne de caractères passée par l'utilisateur (const char[]) en adresse IP (v6) et inversement de traduire des adresses IP en texte affichable : ping ne s'occupe pas des "DNS", il ne sait même pas ce qu'est un serveur DNS!

dig a pour fonction d'interroger le DNS. Il permet de définir la requête qui n'est pas forcèment convertir un texte en adresse.

vectronx

  • Professionnel des télécoms
  • Abonné MilkyWan
  • *
  • Messages: 89
  • Villefranche-sur-Saône 69
dig localhost => erreur "Got bad packet: FORMERR"
« Réponse #9 le: 22 avril 2017 à 10:09:08 »
Quand tu utilises dig sans indiquer de serveur DNS, la commande interroge directement le serveur DNS qui est configuré sur ton Ubuntu et donc n'interroge pas ton fichier host.
Il faudrait regarder du côté du serveur DNS qui est configuré sur ton Ubuntu et savoir pourquoi il ne répond pas 127.0.0.1.

corrector

  • Invité
dig localhost => erreur "Got bad packet: FORMERR"
« Réponse #10 le: 22 avril 2017 à 10:16:19 »
Peut être parce que localhost n'est pas défini?

alain_p

  • Abonné Free fibre
  • *
  • Messages: 16 168
  • Delta S 10G-EPON sur Les Ulis (91)
dig localhost => erreur "Got bad packet: FORMERR"
« Réponse #11 le: 22 avril 2017 à 10:27:29 »
Chez moi, dig localhost ne fait pas d'erreur, mais ne renvoie rien, car effectivement localhost n'est pas défini. J'ai les DNS google dans ce cas, 8.8.8.8 et 8.8.4.4.

ubuntu-srv:~$ dig localhost

; <<>> DiG 9.10.3-P4-Ubuntu <<>> localhost
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 38370
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;localhost.                     IN      A

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

;; Query time: 7 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Sat Apr 22 10:06:04 CEST 2017
;; MSG SIZE  rcvd: 113