Возможно ли для многих доменных имен использовать один IP-адрес?

92666
misteryes

Возможно ли для многих доменных имен использовать один IP-адрес? Например, www.xjtl.com, www.fmie.com, sdmfl.com и т. Д.

Сотни доменных имен имеют только один IP-адрес - при выполнении DNS-запроса для каждого из них возвращается один и тот же IP-адрес.

Существуют ли какие-либо законы или правила Интернета, которые запрещают это?

38
Почему бы против этого действовать законы? Austin T French 11 лет назад 14
Это немного раздражает, так как спамеры могут создавать сотни разных доменов, связанных с одним IP. Но техника имеет много законных применений. Daniel R Hicks 11 лет назад 0
Запрет на его использование увеличит стоимость веб-хостинга, и мы немедленно исчерпаем IPV4-адреса. Yousf 11 лет назад 7
@AthomSfere - Действительно. Я думаю, что интересно, что он упомянул об этом, тем не менее, потому что это напоминает нам, каково было когда-то не знать, что мы знаем сейчас. Для посвященных кажется абсурдным думать, что могут быть законы против общих IP-адресов. Однако подумайте о предположениях, которые вам приходилось делать в отношении эзотерических предметов, прежде чем вы их поняли. Новые концепции в программном обеспечении часто представляют собой черную мрачную форму, для выяснения которой требуется некоторое время. В то же время, мозг заполняет некоторые пробелы, составляя то, что иногда составляет бред. Это все часть учебного процесса. bubbleking 8 лет назад 0

7 ответов на вопрос

54
Scott Chamberlain

Yes, this is an 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 its IP and when you type the IP directly into 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 into your browser, it will not work and you will get an error saying the site does not exist because it did not have a hostname to check and see which site it should serve you.

Вторая часть, которую я собирался добавить в свой ответ, хорошо. Austin T French 11 лет назад 0
Я думал, что общий веб-хостинг имеет некоторые ограничения именования, например, если имя корневого домена `prop.com`, тогда эти доменные имена должны быть названы как a.prop.com, fld.prop.com, belt.prop.com, в любом случае , они должны иметь суффикс `prop.com`? misteryes 11 лет назад 0
Настроить виртуальный хостинг довольно просто (по крайней мере, на Apache.) Http://httpd.apache.org/docs/2.2/vhosts/examples.html HairOfTheDog 11 лет назад 2
@misteryes Нет, ограничений нет. Все, что имеет значение, - это то, что одна и та же программа размещает все сайты, поэтому она может перехватывать имя хоста как часть заголовка HTTP / 1.1, а затем отображать правильную веб-страницу. Scott Chamberlain 11 лет назад 1
@misteryes То, о чем вы думаете, называется поддоменами. Hansi 11 лет назад 0
Можно ли посетить один из других сайтов SE, введя IP? Qwertie 10 лет назад 0
@Qwertie не со стандартным браузером. вам нужно будет вручную вставить заголовки http / 1.1. Однако, если вы отредактируете свой файл `hosts`, включив в него IP-адрес, вы сможете посетить сайт, даже не выполняя DNS-запрос. Scott Chamberlain 10 лет назад 0
17
Kevin Fegan

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.

Хотел бы я дать вам некоторые свои положительные голоса, вы сделали гораздо лучшее объяснение, чем я. Scott Chamberlain 11 лет назад 1
Итак, это означает, что если у вас есть дополнительный домен с именем X, у вас не может быть субдомена с именем X в вашем основном домене, потому что это будет конфликт имен. Вероятно, это будет ситуация, с которой большинство людей не сталкиваются, но все же стоит упомянуть. Radu Murzea 8 лет назад 0
@RaduMurzea - ​​Во многих случаях это правильно. Но это может зависеть от учетной записи веб-хостинга. На некоторых веб-хостах «дополнительный домен» (example.com) и папка, на которую он указывает, настраиваются отдельно. Поэтому, когда вы определяете / настраиваете свой дополнительный домен, например: example.com, вы также создаете / указываете имя папки для этого домена, например "/ some-unrelated-folder-name". Kevin Fegan 8 лет назад 0
4
David Schwartz

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.

3
Austin T French

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...

1
Jack Hughes

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.

Не соответствует действительности, расширение [Идентификация имени сервера] (http://en.wikipedia.org/wiki/Server_Name_Indication) в SSL решает эту проблему. Он не поддерживается на 100%, но все современные браузеры работают с ним. Scott Chamberlain 11 лет назад 1
+1. это важная дополнительная деталь для вопроса ОП. Предупреждение Скотта Чемберлена также важно, но «все современные браузеры работают с ним» - преувеличение, поэтому существование SNI не лишает смысла точку зрения Джека Хьюза. mc0e 9 лет назад 0
Действительно, если вы используете SNI, вы в значительной степени сбрасываете базу пользователей Windows XP. Jack Hughes 9 лет назад 1
0
dashboard

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!

0
skyemporer

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.

Это не совсем так. Нет новых компаний, потому что они не могут получить домен? Как насчет всех компаний, которым необязательно требуется присутствие в Интернете, чтобы выполнять свою работу, например, производственная компания, которая может делать заказы по факсу / почте? Kruug 11 лет назад 0
Я имел в виду компании, с интернет-присутствием skyemporer 11 лет назад 0