There are two types of "vhosts": real and fake.
Real vhosts are usually called "reverse DNS" (also called rDNS)—it's basically a DNS record for your IP address, pointing to some domain name with a PTR
record, which is looked up by the server upon connection (be it ircd
, httpd
, or anything else). This is the "Looking up your hostname..." notice you see immediately after connecting to IRC.
If a user connects from 2001:db8::42
, for example, a DNS lookup is performed for 2.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.
. If the user connected from 192.0.2.123
, the equivalent DNS name will be 123.2.0.192.in-addr.arpa.
. The reverse DNS can be changed by whoever controls the IP address block. If you have a single IPv4 address for your home network, you usually have to annoy your ISP to get the rDNS changed.
To avoid spoofing, an ircd
(the IRC server program) will compare reverse and forward DNS—that is, it will make sure your rDNS hostname points back to your IP address—before displaying it to other users.
For those who are unable to change their real rDNS, most IRC networks offer "virtual hosts" or "cloaks".
Almost every IRC daemon has the ability to change user's displayed hostname at any time; usually this is restricted to operators, or even to services. For example, with the IRC command /chghost joeuser joes-fake-hostname.net
(assuming sufficient privileges).
On most networks this process is automated by services—once an operator assigns you a vhost (cloak), you get it set every time you identify to your services account.
(I'm saying "services", not "NickServ" or "HostServ", because most of the time it is a single program presenting itself as all of the *Servs.)
There is no A record on Google's name server:
$ dig www.ylog.in @8.8.8.8
; <<>> DiG 9.9.3-rl.13207.22-P2-RedHat-9.9.3-5.P2.fc19 <<>> www.ylog.in @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 53820
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;www.ylog.in. IN A
;; Query time: 1298 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Fri Aug 23 15:14:43 IST 2013
;; MSG SIZE rcvd: 40
Most likely, your most recent change hasn't propagated yet. Wait a few days.
Best Answer
localhost is a "special name" which points to the IP address 127.0.0.1 which is supposed to exist on any computer capable of using the Internet, and refers to the machine itself. (Any IP address starting with 127.x.x.x refers to the local machine).
localhost is not the same as localhost.mydomain.com.
The file /etc/hostname appears what your computer thinks its name is. In Debian it appears to link 127.0.1.1 to this name in the /etc/hosts file. [ You could probably set this to a "valid" IP address if you have a statically assigned one ]
Ideally you should not use "localhost" as your hostname as it will (in theory, can't think of any examples as I have not done it) cause issues with some programs.