PDA

View Full Version : [xubuntu] 0.0.0.0 resolving to localhost?



Fatman_UK
August 11th, 2009, 01:27 PM
I'm seeing an odd problem with my networking. Ping, ssh, telnet and web browsers (Firefox, Chromium beta) resolve 0.0.0.0 as localhost or 127.0.0.1.


$ ping 0.0.0.0
PING 0.0.0.0 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.061 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.048 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.047 ms
^C

I'm pretty sure this shouldn't be happening.


$ cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
127.0.1.1 vostro-1.gasketnet.local vostro-1

192.168.23.222 office2
192.168.23.232 office3
192.168.23.233 office4
192.168.23.231 warehouse3

$ nslookup 0.0.0.0 localhost
Server: localhost
Address: 127.0.0.1#53

** server can't find 0.0.0.0.in-addr.arpa.: NXDOMAIN

I don't want 0.0.0.0 resolving. Ideas anyone?

eldragon
August 11th, 2009, 02:02 PM
0.0.0.0 is not a valid address, dont worry about it.

jonobr
August 11th, 2009, 05:21 PM
AFAIK I believe ping of 0.0.0.0 will go to the default route and your nic will respond to that ping request

Fatman_UK
August 13th, 2009, 09:31 AM
Thanks for the replies guys.


0.0.0.0 is not a valid address, dont worry about it.

I wish that was a good solution for me, but I need 0.0.0.0 available for when I have to use an invalid address (for instance, blocking in my hosts file. I don't want to use 127.0.0.1 because I don't want the bogus requests continuing to drive my local web server nutty). Are there any other legal invalid addresses? I can't think of any.


AFAIK I believe ping of 0.0.0.0 will go to the default route and your nic will respond to that ping request

That's what I'm seeing in practise. I guess my routing table is messed up. I'm not great at using the route command, I can never figure out the syntax (I come from BSD, where the route command is slightly easier to use ;) ).

By the way, on WinXP a "ping 0.0.0.0" comes back with "Destination specified is invalid", which I believe is the correct response. (XP uses the NetBSD networking stack, AFAIK.)



$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.22.5.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth0
default 10.22.5.2 0.0.0.0 UG 0 0 0 eth0
default 10.22.5.2 0.0.0.0 UG 100 0 0 eth0


That's definitely not right. I have two default entries and that pesky link-local that keeps popping up in routing tables across my networks.

Offtopic "D'oh!" moment: I had some trouble recently with nslookup. I was trying to figure out why it was ignoring my hosts file. I didn't realise it ignores the hosts file completely and goes directly to the nameserver. (BSD nslookup does not do this.)

===========================

Apparently that didn't fix anything. 0.0.0.0 still resolves. Obvious, now that I think about it...



$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.22.5.0 * 255.255.255.0 U 0 0 0 eth0
default 10.22.5.2 0.0.0.0 UG 100 0 0 eth0
$ ping 0.0.0.0
PING 0.0.0.0 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.058 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.050 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.040 ms
^C
--- 0.0.0.0 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.040/0.049/0.058/0.009 ms