Link to home
Start Free TrialLog in
Avatar of DavidO84
DavidO84Flag for Ireland

asked on

How to display your hostname on the web?

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?
Avatar of ByteSleuth
ByteSleuth
Flag of Germany image

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
Avatar of DavidO84

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of Fabio Marzocca
Fabio Marzocca
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great thanks for the information.
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.