Avatar of deadlock_
deadlock_ asked on

localhost mapped to incorrect ip address

Hi

I have a strange problem on my OpenBSD box.
localhost seem to be mapped to an incorrect ip address. (or for some
other reason)


# ping localhost
PING localhost.rby.se (85.228.196.87): 56 data bytes
--- localhost.rby.se ping statistics ---
2 packets transmitted, 0 packets received, 100.0% packet loss


So localhost gets expanded to localhost.rby.se (rby.se is my domain)
Then it seem to be resolved by the DNS. I am totally confused


I am thankful for any help


Below is the output from some standard commands:
# ifconfig -a
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33208
        groups: lo
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
        inet 127.0.0.1 netmask 0xff000000
vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        lladdr 00:05:5d:0c:fd:e4
        groups: egress
        media: Ethernet autoselect (100baseTX full-duplex)
        status: active
        inet6 fe80::205:5dff:fe0c:fde4%vr0 prefixlen 64 scopeid 0x1
        inet 192.168.0.5 netmask 0xffffff00 broadcast 192.168.0.255
enc0: flags=0<> mtu 1536


# cat /etc/hosts
#       $OpenBSD: hosts,v 1.11 2002/09/26 23:35:51 krw Exp $
#
# Host Database
#
# RFC 1918 specifies that these networks are "internal".
# 10.0.0.0      10.255.255.255
# 172.16.0.0    172.31.255.255
# 192.168.0.0   192.168.255.255
#
::1 localhost.rby.se localhost
27.0.0.1 localhost.rby.se localhost
::1 whiterussian.rby.se whiterussian
127.0.0.1 whiterussian.rby.se whiterussian


# cat /etc/hostname.vr0
dhcp


# cat /etc/hostname.lo0
127.0.0.1 localhost


# cat /etc/resolv.conf
nameserver 192.168.0.1


$ cat /etc/hosts
#       $OpenBSD: hosts,v 1.11 2002/09/26 23:35:51 krw Exp $
#
# Host Database
#
# RFC 1918 specifies that these networks are "internal".
# 10.0.0.0      10.255.255.255
# 172.16.0.0    172.31.255.255
# 192.168.0.0   192.168.255.255
#
::1 localhost.rby.se localhost
127.0.0.1 localhost.rby.se localhost
::1 whiterussian.rby.se whiterussian
127.0.0.1 whiterussian.rby.se whiterussian


Another thing. This error appeared on my fresh install.
During installation the network failed to configure because I was not
able to connect an ethernet cable to the computer.
I configued it afterwards by adding the hostname.* files.
It worked before the reinstall and my other computers
are able to ping localhost without problems.

Thankful for any help
/Jens
Unix OS

Avatar of undefined
Last Comment
deadlock_

8/22/2022 - Mon
SOLUTION
arnold

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
deadlock_

Hi arnold

Thanks for your reply.
Yes localhost.rby.se is a valid internet name, however I cannot understand why it goes so far.
localhost should be directly converted to 127.0.0.1 I think.
If I run ping localhost on my osx box I get the following output:

longislandicetea-air:~ root# ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.046 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.052 ms
c64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.056 ms
^C
--- localhost ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.046/0.051/0.056/0.004 ms

I think the OpenBSD box behaves incorrectly.
There have to be some missconfiguration.

Why does it even try localhost.rby.se? that is when it cannot resolve localhost right?
then it tries with the domain?

Before my resintall of the box it did resolve localhost to 127.0.0.1 perfectly. so there have to be something wrong here.

Any other ideas?

BR/
Jens
arnold

localhost is directly converted to 127.0.0.1.  

Do you have a defaultdomain set on this system for rby.se??
try ping localhost.  (the . prevents the appending of a default domain.)

Usually localhost should have a 127.0.0.1 without regard in what domain zone it is set.

What is the configuration of your nsswitch.conf file????
ASKER
deadlock_

$ ping localhost.
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=0.100 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=255 time=0.147 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=255 time=0.150 ms

So that seem to work great! I forgot you could add a dot to force it to be a FQN

Allthough cannot find nsswitch.conf.
I find one in /usr/local/emul/redhat/etc/nsswitch.conf but that is because I have
enabled linux binary support. I guess that OpenBSD does not use nsswitch.conf ?
There have to be some other function

Thanks for the help so far!

Your help has saved me hundreds of hours of internet surfing.
fblack61
ASKER CERTIFIED SOLUTION
deadlock_

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question