How to create your own hostname for an ip address?
Example:-
If i am running apache, and giving my friend my ip to view the webpage.
what should i do if i want a hostname instead of ip?
Note:- i have tried freeDNS,DynDNS,No-IP and other services and they are not free. i want to learn how to create it manually.

Thanks.

If you do not want to use paid DNS or cannot find a free service, the other free option is to tell your friend to modify his/her HOSTS file on their computer.

You can create an entry like...

192.168.0.1 www.yourName.local

Replace that IP with your public IP.

Alternatively, register a .info domain name or similar one that only costs a few dollars per year. Most of thee registrars also provide DNS services included in the domain registration.

no-ip.org is a dynamic dns provider offering free service. I use it with success. You just have to type in a code every month when they send you a reminder email.

:/
ok but really, isn't there any other way?
thanks for your replies.

i mean, if you just have any knowledge, what does the companies do?
(educational purpose)

what does the companies do?

The most appropriate way to handle this, the way companies and enterprises implement this, is by having a publicly accessing domain name hosted in a DNS zone with the appropriate records.

You asked for a free solution though.

thanks alot BRO!

Step1: Check for the package installed or not

rpm -qa | grep httpd

Step2 : Install the package

yum install httpd

Step3 : For hostbased web access we require DNS server entries of our host.

Example host in this post is : server1.example.com(Actual server name) and
hostbase.example.com(our virtual host name)

So we have to give A record for the server1.example.com and CNAME record for hostbase.example.com which points to server1.example.com

Step3 : Create the root web directory and a test index.html for this testing.

I want to create my web directory in /hostnamebase

mkdir /hostnamebase

Now create index.html and try to write something in to that file then save the file.

vi /hostnamebase/index.html

save and exit the file.

Step4 : Now edit the httpd.config file

vi /etc/httpd/conf/httpd.conf

Step4(a) : Please specify the NameVirtualHost

NameVirtualHost 192.168.0.1

http://www.linuxnix.com/2010/12/how-to-access-the-web-server-through-a-hostname.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.