You are not logged in.
for i in $(seq 1 10) ; do /usr/bin/hostname -i; sleep 5; done
118.98.96.151
118.98.96.151
192.168.1.11
118.98.96.151
118.98.96.151
118.98.96.151
118.98.96.151
118.98.96.151
118.98.96.151
118.98.96.151
192.168.1.11 is the address I expected. It is the address reported by Network Manager "Connection Information"
118.98.96.151 is some address belonging to my ISP, but neither Default Gateway: 180.251.160.1 nor Primary DNS Server: 202.134.1.10 nor Secondary DNS Server: 203.130.193.74
According to http://toolbar.netcraft.com/site_report … .98.96.151 it is an nginx webserver owned by the ISP.
Different ip addresses reported by hostname -i????
The only interface is ethernet.
On a notebook running Live Manjaro, the above test reports 127.0.0.1, 10 times, but Network Manager reports 192.168.1.12.
Obviously I am missing an understanding of how hostname gets its IP.
Why the ISP server IP appeared is mind boggling to me.
Last edited by nobicycle (2014-07-03 02:24:11)
Offline
I'm not super knowledgable on networking but I would think you do not have your host file setup and so you are asking your ISP for it IP address which it is not answering correctly for.
I'm not sure, but my understanding is that hostname binary calls the system gethostname function.
It will resolve its information by order dictated by /etc/nsswitch.conf
usually the hosts section is something similar to:
hosts: files dns ...etc
So first it should go to /etc/hosts
192.168.1.11 myhostname.localdomain myhostname
If it is not resolved there it will send a dns request to the dns server.
Your ISP's dns server most likely does not know how to answer for your local machine and for some reason returning that IP address.
Offline
$ hostname -i
127.0.0.1
Configure your /etc/hosts correctly, i.e. the first line:
127.0.0.1 localhost myhostname
Where "myhostname" is whatever you want to call the PC. Check *that* by just running "hostname".
Offline
Thanks guys.
I happened to need to reinstall, and afterwards the problem went away.
Actually, the hosts file was vanilla, untouched.
There was no wifi interface. But I do remember tying to get a USB wifi device running with hostapd and believe there was a bridge left around. At the time of the above tests no such device was present. Some bad configuration must have been left hanging.
Anyway, thanks for your help. Issue closed.
Offline
Please don't use (Closed), it denotes a locked thread. Solved or resolved is fine.
Offline