You are not logged in.

#1 2022-11-03 18:15:23

Chrissss
Member
Registered: 2014-02-04
Posts: 14

gnu-netcat resolves hostname to wrong ip

Hello community!

Some time ago I had to use a certain subnet (10.0.0.x). Now, that I changed jobs, I reconfigured my router, so that it uses 192.168.0.x again. Everything works, but the name resolution of my arch machine is somehow screwed. When I scan my NAS via 'nc' for a running samba server, it can't resolve the hostname. I have to use the IP address:

$ nc -v -z -w 3 DiskStation 139
Warning: Inverse name lookup failed for `10.0.0.10'
DiskStation [10.0.0.10] 139 (netbios-ssn): Die Wartezeit f?r die Verbindung ist abgelaufen
$ nc -v -z -w 3 192.168.0.10 139
DiskStation.fritz.box [192.168.0.10] 139 (netbios-ssn) open.

When I ping 'diskstation' the name gets properly resolved. Pings to the ip 192.168.0.10 work also, to 10.0.0.10 not -- like it should be.

$ ping -c 3 diskstation
PING diskstation(DiskStation.fritz.box (fd00::211:32ff:fe51:df27)) 56 Datenbytes
64 Bytes von DiskStation.fritz.box (fd00::211:32ff:fe51:df27): icmp_seq=1 ttl=64 Zeit=0.593 ms
64 Bytes von DiskStation.fritz.box (fd00::211:32ff:fe51:df27): icmp_seq=2 ttl=64 Zeit=0.374 ms
64 Bytes von DiskStation.fritz.box (fd00::211:32ff:fe51:df27): icmp_seq=3 ttl=64 Zeit=0.353 ms

--- diskstation ping-Statistik ---
3 Pakete übertragen, 3 empfangen, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 0.353/0.440/0.593/0.108 ms
$ ping -c 3 192.168.0.10
PING 192.168.0.10 (192.168.0.10) 56(84) Bytes an Daten.
64 Bytes von 192.168.0.10: icmp_seq=1 ttl=64 Zeit=0.316 ms
64 Bytes von 192.168.0.10: icmp_seq=2 ttl=64 Zeit=0.313 ms
64 Bytes von 192.168.0.10: icmp_seq=3 ttl=64 Zeit=0.389 ms

--- 192.168.0.10 ping-Statistik ---
3 Pakete übertragen, 3 empfangen, 0% packet loss, time 2040ms
rtt min/avg/max/mdev = 0.313/0.339/0.389/0.035 ms

$ ping -c 3 10.0.0.10
PING 10.0.0.10 (10.0.0.10) 56(84) Bytes an Daten.
Von 62.155.245.75 icmp_seq=1 Zielnetz nicht erreichbar
Von 62.155.245.75 icmp_seq=2 Zielnetz nicht erreichbar
Von 62.155.245.75 icmp_seq=3 Zielnetz nicht erreichbar

--- 10.0.0.10 ping-Statistik ---
3 Pakete übertragen, 0 empfangen, +3 Fehler, 100% packet loss, time 2003ms

My systems get's it's network settings via DHCP from my router (Fritzbox 7580). I neither edited /etc/hosts nor /etc/resolv.conf:

$ cat /etc/hosts
# Static table lookup for hostnames.
# See hosts(5) for details.
$ cat /etc/resolv.conf 
# Generated by NetworkManager
search fritz.box
nameserver 192.168.0.1
nameserver fd80::3f7f:f7d4:8464:c880

So where does my nc gets the information, that 'diskstation' should resolve to 10.0.0.10.

Thanks!

Offline

#2 2022-11-03 18:32:58

Chrissss
Member
Registered: 2014-02-04
Posts: 14

Re: gnu-netcat resolves hostname to wrong ip

'dig' gives me two answers, why?

$ dig diskstation

; <<>> DiG 9.18.8 <<>> diskstation
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11063
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 3

;; QUESTION SECTION:
;diskstation.			IN	A

;; ANSWER SECTION:
diskstation.		9	IN	A	10.0.0.10
diskstation.		9	IN	A	192.168.0.10

;; AUTHORITY SECTION:
diskstation.		9	IN	NS	fritz.box.

;; ADDITIONAL SECTION:
fritz.box.		9	IN	A	192.168.0.1
fritz.box.		9	IN	AAAA	fd00::e228:6dff:fe46:f46b
fritz.box.		9	IN	AAAA	2003:de:d720:4500:e228:6dff:fe46:f46b

;; Query time: 0 msec
;; SERVER: 192.168.0.1#53(192.168.0.1) (UDP)
;; WHEN: Thu Nov 03 19:31:32 CET 2022
;; MSG SIZE  rcvd: 156
$ resolvectl query diskstation
diskstation: 10.0.0.10                         -- link: enp53s0
             192.168.0.10                      -- link: enp53s0
             fd00::211:32ff:fe51:df27          -- link: enp53s0
             2003:de:d720:4500:211:32ff:fe51:df27 -- link: enp53s0
             (diskstation.fritz.box)

-- Information acquired via protocol DNS in 4.2ms.
-- Data is authenticated: no; Data was acquired via local or encrypted transport: no
-- Data from: network

Last edited by Chrissss (2022-11-03 18:39:35)

Offline

#3 2022-11-03 19:46:28

-thc
Member
Registered: 2017-03-15
Posts: 775

Re: gnu-netcat resolves hostname to wrong ip

If the Fritz!Box' network devices list shows only one "diskstation": Have you restarted your Fritz!Box?

Offline

Board footer

Powered by FluxBB