How to display your hostname on the web?

DavidO84
DavidO84 used Ask the Experts™
on
Hi,

I ahve a fixed ip address provided by my ISP and I am using this for my sever running ubuntu 9.10. I have noticed that if I do an iplookup for most ip address i see it's hostname also. For example if i lookup 216.239.59.103 (which is google.com) here -->http://ip-lookup.net/index.php  - i see the hostname is gv-in-f103.1e100.net - but when i lookup my ip address i see nothing

From the command line if I do hostname or hostname -f or hostname --fqdn i see my hostanme which i setup when install ubutnu as an open ssh sever and I also added to hosts.

My question is what controls the display of your hostname to the web?

Is it me or my ISP?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Hello,

in php you can do it like this to display a hostname on a webpage:
<?
$ip = "208.201.239.36";
$host = gethostbyaddr($ip);
print "The host name for $ip is $host.";
?>

in php. is this what you mean

regards

bytesleuth

Author

Commented:
Hi ByteSleuth,

Thanks for the input, but what i mean is, when my ip address is looked up I want it to display the hostname of my server (mail.mydomain.com)

or

if someone pings it with "ping -a  216.239.59.103" that reads

"Pinging gv-in-f103.1e100.net [216.239.59.103] with 32 bytes of data:"

and not just

"Pinging 216.239.59.103 with 32 bytes of data:"


The setup is: I have a fixed Ip address provided my ISP, running ubuntu server 9.10 setup as an openssh with apache2 etc.

Hostname configured to be mail.mydomain.com

this is only visible locally and not when someone does and ip lookup for my ip address.
Resolving the ip with a ping or a lookup depends upon how your ISP has registered their IPs on the DNS. There is nothing you can do from your server to change this.

Author

Commented:
Great thanks for the information.

Author

Commented:
Just alittle more info in regard to arranging your hostname on the web when reverse dns is looked up, you must contact your ISP that issued teh static ip address and request that they update your ptr record for that ip address. The name for example mail.mydomain.com must have a valid A record forwarded to your static ip address.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial