Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible for many domain names to share one IP address? For example, www.xjtl.com, www.fmie.com, sdmfl.com, etc.

Hundreds of domain names share just one IP – when you do a DNS query for each of them, the same IP is returned.

Are there any laws or Internet rules that disallow this?

share|improve this question
12  
Why would there be laws against this? –  AthomSfere Apr 2 '13 at 22:14
    
It is a little irritating, since spammers may create hundreds of different domains linked to one IP. But the technique has many legitimate uses. –  Daniel R Hicks Apr 2 '13 at 23:55
6  
Disallowing it will increase web hosting costs and we will run out of IPV4 addresses immediately. –  Yousf Apr 3 '13 at 9:22
add comment

7 Answers

up vote 32 down vote accepted

Yes, this is a extremely common practice it is called a Shared Web Hosting

In name-based virtual hosting, also called shared IP hosting, the virtual hosts serve multiple hostnames on a single machine with a single IP address. This is possible because when a web browser requests a resource from a web server using HTTP/1.1 it includes the requested hostname as part of the request. The server uses this information to determine which web site to show the user. When you register/purchase your domain name on a particular "registrars name server", your DNS settings are kept on their server, and in most cases point your domain to the Name Server of your hosting provider. This Name Server is where the IP number (currently associated with your domain name) resides.

Any time you have a website that you look up it's IP and when you type the IP directly in to the browser and you got a different website, you just encountered Shared Hosting.


In fact, this website here uses it. Ping superuser.com or stackoverflow.com and you will get 198.252.206.16 for both. If you type that IP address in to your browser it will not work and you will get a error saying the site does not exist because it did not have a hostname to check and see which site it should serve you.

share|improve this answer
    
The second part I was going to add to my response, good. –  AthomSfere Apr 2 '13 at 22:22
    
I thought shared web hosting has some naming restriction, like if the root domain name is prop.com, then those domain names should be named like a.prop.com, fld.prop.com, belt.prop.com, anyway, they must have suffix prop.com? –  misteryes Apr 2 '13 at 23:23
2  
Setting up virtual hosting is pretty easy to do (at least on Apache.) httpd.apache.org/docs/2.2/vhosts/examples.html –  HairOfTheDog Apr 3 '13 at 0:23
1  
@misteryes No, there is no restriction. All that matters is the same program hosts the all of the sites so it can intercept the hostname as part of the HTTP/1.1 header then serve the correct web page. –  Scott Chamberlain Apr 3 '13 at 3:56
    
@misteryes What you are thinking of is called sub domains. –  Hansi Apr 5 '13 at 10:35
show 2 more comments

Shared web hosting is also for the case of different people, each with one or many different domain names, in addition to the cases of one or more different sub-domains.

For example, I have about 30 domain names on a single web hosting account. The files for my "First" domain name are located in the root of my "public_html" folder. This folder is in my "home" directory, so something like: ".../.../username/home/public_html".

And, in the root of this folder are folders for each sub-domain of my "First" domain name. Lets say my "First" domain name is "example.com", and I have some sub-domains. The files will be organized like this:

"example.com"  -->  ".../username/home/public_html"
"a.example.com"  -->  ".../username/home/public_html/a"
"b.example.com"  -->  ".../username/home/public_html/b"
"c.example.com"  -->  ".../username/home/public_html/c"

Plus, there is another folder in public_html for each of my other additional domain names (referred to as "add-on" domains in my hosting).

"domain2.com"  -->  ".../username/home/public_html/somefolder"
"domain3.com"  -->  ".../username/home/public_html/otherfolder"
"a.domain2.com"  -->  ".../username/home/public_html/somefolder/a"
"b.domain3.com"  -->  ".../username/home/public_html/otherfolder/b"

Plus, many other people (perhaps dozens of people), each having a different "username", all have hosting accounts on the same computer, and each of these other users may have one or many domains and sub-domains, with their files organized in a similar fashion.

All of these users, including me, all share the same IP address. If I want, I could pay extra to have one or more unique IP addresses for my domains.

Originally, at least in concept, I believe the internet was setup with each domain name to have a different IP address. I think around the time of HTTP/1.1 this was changed to allow multiple domain names to share a single IP address. This was done then because of the concern of running out of IP addresses.

share|improve this answer
1  
I wish I could give you some of my up-votes, you did a much better explanation than I did. –  Scott Chamberlain Apr 3 '13 at 4:39
add comment

IPs are scarce. Not only are there no rules that disallow this but it is strongly encouraged. Use of IP addresses must be justified by some kind of need.

share|improve this answer
add comment

It is possible, and it often makes sense.

Say you owned the website and brand for Firefox, you would want to make sure all hits for Firefox and typed URLs that might be confused for your resolved to your IP, so you buy Firefox.com, Firefox.org, FF.com, FF.org, Firefix.org and Firefix.com. You not also buy 6 different IPs, you would point them all to the same IP. Lets say Firefox bought out Maxthon browser, you would then point all of Maxthon's domains to your IP too.

There is no reason for there to laws against it...

share|improve this answer
add comment

simple way is to have each domain use different directories on your server. When you go to www.example.com it will forward you to 208.352.12.24/website and if you have www.example2.com you could forward it to 208.352.12.24/website2 etc.. idk hope this helps!

share|improve this answer
add comment

Suppose We have this Law like 'you can use only one domain name associated with one IP Address'. In that case, since we have limited number of IP Addresses, We will have limited number of Domain Names. So once we have consumed all IP addresses, there will not be any new player in Town.
And So business got stuck and there will be fight for domain names or so. No new domain, no new company and everything falls apart.
So there will be voices against such law and so either erase the law or modify it. And we prefer no such law. So simply there is no such law which limits business growth till its in right direction.

share|improve this answer
    
That's not entirely true. No new companies because they can't get a domain? What about all of the companies that don't necessarily need a web presence to do their job, such as a manufacturing company that could do fax/mail orders? –  Kruug Apr 3 '13 at 13:27
    
I meant companies, with internet presence –  skyemporer Apr 4 '13 at 9:22
add comment

You can indeed host many many websites on the same IP address. Though, if you want your website to use secure HTTP (HTTPS), then you have to use a unique IP address for that web site only.

You need to use secure HTTP if your website visitors are able to log into your site or if some other sensitive information is transferred to their browser. So, something like an e-commerce site would need to have its own IP address that is not shared with anything else in order to encrypt credit card details and the like.

share|improve this answer
1  
Not true, the Server Name Identification extension to SSL solves that problem. It is not 100% supported, but all modern browsers work with it. –  Scott Chamberlain Apr 3 '13 at 19:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.