It's really quite easy to "running a domain" (a website, e-mail, etc.) on your computer without paying a hosting service:
- Have a computer connected to the internet 24/7 that runs DNS.
- Buy a domain-name from a domain-registrar. Let's call it
mydomain.com
.
- Configure
mydomain.com
to have an NS record that points users to the computer from step 1. That way, any subdomain queries like www.mydomain.com
and mail.mydomain.com
will get sent to that computer.
- Add DNS entries on the computer from step 1 to send users to the right computer. Like redirect all
www.mydomain.com
to 12.34.56.78
(if that's your webserver's IP.)
Once you've done that, any DNS requests that query for www.mydomain.com
will get sent to your computer's DNS, and it will reply with 12.34.56.78
.
It's gets tricker if you don't have a static IP for the computer from step 1, but there are free services to get around that, such as afraid.org.
Of course, seeing how cheap hosting is nowadays, you might be better off just hosting it. It really saves your a lot of extra hassle, at a small cost to customization.
EDIT: After re-reading the question, I realize you may have meant just setting up a DNS domain within your LAN or some other private network. I think the "external" threw me off...