What is the hostname. How to set hostname. What is a hostname

It's not hard to set up an additional root website in IIS on a development machine and use the hosts file to build a map of additional hostnames for testing.

What is a hostname?

First, let's try to explain the difference between a hostname and a domain name. When you purchase a domain name (like "mydomain.com"), it's also a hostname, but that's the default only because the domain doesn't have partitions. For any domain name, you can set multiple hostnames (eg "www.mydomain.com", "foo.mydomain.com" or "cheeseburger.mydomain.com" will be valid for your domain). Sometimes they are called subdomains, but in our opinion, for the sake of clarity, these are different hostnames. If the hostname is a computer, then the domain name is the name of a group of computers. The default structure is "hostname.domainname". In the case of "www.mydomain.com", "www" is part of the host and "mydomain.com" is part of the domain name. When they are combined, a hostname is obtained, identified by the domain name.

Historically, the order of host names has been "www.mydomain.com" for a web server, "mail.mydomain.com" for a mail server, and so on. But these are not mandatory abbreviations. You can use the name "www" or not, at your discretion. People are just used to seeing "www" at the beginning of a website address. You can have multiple sites (e.g. "web1.mydomain.com", "web2.mydomain.com", "test.mydomain.com", etc.)

Hostnames can point to different ip addresses, or multiple hostnames point to the same ip address. A computer can have one or more ip addresses, so one or more hostnames will point to it.

Understanding how names (hostnames) are assigned IP addresses

Hostnames are assigned IP addresses in the DNS (Domain Name Server), but before the DNS servers are checked, data on the local machine is accessed, which is stored in the hosts file and, if the required address is found, it is used instead of the address from DNS. Your IT department's local network may have a local DNS server installed to assign IP addresses to computer names on the local network. There are many DNS servers on the Internet, and usually the ISP you use to connect to the Internet provides the DNS server(s) for you when you provide an IP address. These DNS servers, in combination with other DNS servers from the Internet, redirect hostnames to IP addresses so that your computer can connect to them.

But as mentioned above, before checking the DNS servers, your machine will look in the hosts file to see if the hostname exists.

On Windows, the hosts file is located at "C:\Windows\system32\drivers\etc"

the "hosts" file does not have a file extension, but is just a text file. To change it, right-click on notepad and select "Run as administrator", then navigate to "C:\Windows\system32\drivers\etc"

To view all files, not just TXT, you need to change the file extension in notepad as shown here:

You can then add your own hostnames, and give them a loopback address - 127.0.0.1

You can see exactly how the "localhost" host name works. It is written in your hosts file.

You can add any hostname and associate it with an ip address by simply putting them on the same line. For example:

127.0.0.1 mojotest1

The ip address 127.0.0.1 is a special ip that is on every computer. It is also called "internal loop" (loopback address). For any computer, this address points to itself. The internal loop doesn't even need a network card. "localhost" always points to the inner loop. In the example above, we simply added an additional hostname for the inner loop. If your network card has a fixed IP address, then you can easily associate it with a hostname instead of 127.0.0.1. Let your card have ip address 192.168.0.100, then you should make the following entry:

192.168.0.100 mojotest1

What does The Default Web Site "Default" do?

You can install as many root levels as you need in IIS. Each site can be assigned any ip address. Therefore, any hostnames assigned to this ip address can be processed by the corresponding IIS bound to this ip.

However, as already mentioned, multiple hostnames can point to the same IP address. To run multiple sites under different hostnames referring to the same ip address, IIS has a special option. In fact, you don't even need to specify a specific ip. Just leave "All Unassigned" and add the hostname. After that, a request for a specific name will be redirected to the correct root folder (site). In IIS, when you select a specific site, the "Bindings" link will be displayed in the right window, by clicking on which you can enter host names and ip addresses.

Note that it is not necessary for testing to bind hostnames to the appropriate domains. You can use a simple version like "mojotest1" or if you prefer - "www.fake.com", "www.fake.home", "fake.home".

What is "Default Web Site "Default"? This is a normal site that does not have any bindings to ip and host names. will be redirected to the default host.This is the only purpose of this host.If you give it a specific hostname, it will no longer be the default host.There is nothing special about it, except for the absence of a hostname and ip address, so you can easily delete it and recreate it, and its name can be arbitrary, because for IIS it doesn't matter what the name of the default node is.

To add a new site in IIS? you must specify a unique ip address or hostname. If you try to create a site without a unique ip or name, you will end up with a second default host that won't start or will break the first one. This is experienced by beginners who can't add a new site (for the reasons mentioned above) and take the path of least resistance by simply giving the default web site different domain names and redirecting them to the appropriate virtual folders. But these are not separate sites, but just folders in the root directory.

Therefore, when adding a new site, you must specify the hostname that leads to a specific site, and not to the default host.

See also

DNS is a protocol primarily used for converting hostname(hostname), like www.example.com to IP addresses like 192.168.1.0, and vice versa. On the Internet, the relationship between servers is based on IP addresses, not hostname(hostname) , which the user enters into programs such as browsers or telnet clients. This means that the system needs a tool that would allow you to look up the IP address of the server by its hostname(hostname) . There are several solutions for this. For example, reading the /etc/hosts file or querying the NIS server. But the use of DNS is the most common.

As already mentioned, the DNS protocol is used to find IP addresses by hostname and vice versa. This is often used to determine the hostname of a client that connects to a server. DNS can also be used to determine the address of a mail server, as well as to get more information about a host. For example, its location, operating system or its owner. However, most often DNS is used for its intended purpose.

Most systems use the DNS protocol to send queries to a server that looks up IP addresses by hostname(hostname) . A normal system is only a DNS client and never responds to requests from servers or other clients. While many companies and providers have one or more DNS servers in their network. So all other hosts on that network can use them. If your company already has a DNS server, then you do not need to read this chapter.

The domain name system is divided into zones (called domains), each of which has a name like example.com or foo.com.au . Zones are hierarchical. This means that the foo.com.au zone is in the com.au zone, which in turn is part of the au zone. At the very top of this hierarchy is located. or root(root) zone.

For each zone, there is at least one DNS server, which is the main one and has all the information about this zone. There are also several secondary or slave servers that have a copy of the information from the main server. This will make a backup of the main server if it becomes faulty. One DNS server can serve several DNS zones or none. The server is usually responsible for providing information about the zones it serves.

Before a server can serve a zone, it must be registered with the parent zone. Most parent zones like . com , .net , .ru are inaccessible to ordinary people and are managed by companies that have the right to register child zones in these parent zones. They are usually called registrars. This means that you can't just set up a DNS server that serves a domain like example.com and make it available on the Internet. You must pay to have your domain registered. This can be done by any company-registrar. Thus, by paying, you will register a domain name that is a subdomain of the main domain, such as the .com domain.

Each zone includes many DNS records, each with a name, type, and values. The most common record type is the address, or A record for short. This record type contains the following information: IP address and its associated hostname(hostname) . The other type is NS or name server(name server) records that contain information about the DNS server serving the zone or subdomain. And the third type is MX or mail server) entry that contains information about the host that serves mail for this zone.

Each zone must have at least one additional server that can take over the main server if it is unavailable for some reason. Additional servers will also allow you to distribute the load on the main server. This is because other servers, looking for information about the DNS record, select a DNS server from the desired zone randomly. In fact, there is no way for other servers to know which server is the main and which is the secondary server for some zone.

Additional servers can request a copy of all zone records using an intrazone transfer. This is done when a secondary DNS server receives a zone for the first time, and also when the server determines that the zone has changed or the records are out of date. The main server can be configured to notify the secondary servers when the zone has changed and they need to update, allowing them to always have the new information.

Each zone has its own serial number, which is a simple counter that increments whenever any entry in the zone has changed. This number is used by secondary servers to determine if changes have been made to the zone, and if so, those changes should be copied. In most cases, it doesn't matter what this serial number looks like. However, some domains require the number format to be date-oriented - YYYYMMDDnn.

Usually, only master (master, main) zones or only slaves (secondary) zones are located on one server. However, it happens that the server is the main one for some zones and at the same time, additional for others. There are no rules for the number of servers serving the zone. The important .com and root (root, main) zones have 13 maintenance servers, because these zones make up a huge part of the Internet and they receive a large number of accesses. The more additional servers per zone, the better, as long as they keep their content in sync.

When a DNS server receives a request from a client to search for a record, it first checks at home to see if the required record is included in the zones that it serves. If so, he can respond to the client immediately. However, if the required entry is not found on that server, then the server will send requests to other servers to look for it. The search begins with one of the servers responsible for the root (main) zone, which will direct to another DNS server, and he to the third, and so on, until the required record is found. If the required record does not exist, then one of the DNS servers will say so and the lookup will stop.

For example, imagine if a DNS client asks the server for an IP address for the host www.webmin.com.

The server will go through the following steps to determine the IP address:

1. It will first make a request to one of the root(master) servers, such as a.root-servers.net(198.41.0.4), to try and find an IP address for www.webmin.com . The root server will respond with a list of DNS servers serving the.com zone. One of them is a.gtld-servers.net(192.5.6.30).

2. Next, it will make a request to the server serving the.com zone with a request for an IP address for www.webmin.com . The response will be a list of DNS servers, one of which is au.webmin.com(203.89.239.235). This is the main DNS server for the webmin.com domain.

3. The DNS client will then query the webmin.com server to find out the address for www.webmin.com . The answer will be 216.136.171.204 which is the correct IP address.

4. The DNS client will get this IP address and cache the result. Now he will know what IP address www.webmin.com has and he will not need to go through all these steps again. But this result has a TTL, so after this time, the IP address data will be out of date, and the DNS client will go through these steps again in order to find out the IP address for www.webmin.com . This is done in order not to go through these steps again and again, creating a lot of traffic on the Internet.

As you can see, the DNS server can find the IP address of any host on the Internet by following a simple algorithm. It is not possible to find only the address of the root servers. They are read from a file. Since the addresses of root servers rarely change, they are stored in a specific file.

The relationship between IP addresses and their hostname is stored in DNS separately from the relationship between hostname and IP address. This is done in order to make it possible to lookup hostname (hostname) by IP address using a similar algorithm of actions as described above. This is explained by the fact that inconsistencies can occur between the relationship of IP address to hostname, and hostname to IP address. For example, www.webmin.com is associated with 216.136.171.204, but 216.136.171.204 is associated with usw-pr-vhost.sourceforge.net! This causes confusion, but it is a real fact. When a client wants to find the hostname for an IP address like 216.136.171.204, it converts that address into an entry like 204.171.136.216.in-addr.arpa. As you can see it's the same IP address, just reversed and appended to the end of in-addr.arpa. The special zone in-addr.arpa is maintained by root DNS servers, and its subdomains are available to other DNS servers. Typically, each class C zone (for example, 171.136.216.in-addr.arpa) is maintained by the DNS servers of companies or ISPs that own these zones. This means that they can create entries that define the relationship between an IP address and its hostname. All these records are of a special type - PTR. The big problem is the method of finding anything less than class C (which includes 256 addresses) served by a single DNS server. Thus, if the server serves the example.com zone, which contains only one entry, www.example.com with the address 1.2.3.4, then some server will not be able to find this address. Therefore, it is best to have this one entry in the DNS server of the ISP or hosting company whose network includes the web server for www.example.com . Only organizations may need to own a Class C network and maintain a reverse zone for that network using their own DNS server.

Many organizations have an internal network that uses private IP addresses starting with, for example, 192.168. A network like this connects to the Internet through a firewall using NAT. Some people who have a home network organize their Internet access in the following way. One of the machines has direct access to the Internet. It is the Gateway. The rest I connect through it. It turns out that they work on the Internet under the same IP address.

Also, in such networks, a DNS server may be needed to issue hostnames to computers on the internal network. This is possible by creating a zone with an arbitrary name like home or internal that contains entries about the internal computers on the network, and also by creating a reverse zone for the 192.168 network so that IP addresses can be found by query. The server can also be configured to look up the real Internet hostname, just like any normal DNS server. However, such a search will not lead to anything, since your local zone is not registered on the Internet.

Hostname is a symbolic name assigned to a network device that can be used to organize access to this device in various ways. Typically, a hostname is a domain name, which is much easier for a human to read, remember, and pronounce than the same numeric IP address that also identifies a network device.

While an IP address is required to identify a device, assigning a hostname is optional.

There are several ways to assign a hostname to a device. Fully Qualified Domain Names (FQDNs) are managed and assigned to Internet hosts through the Global Domain Name System (DNS) and are unique throughout the Internet. However, this can be done in the same way on local networks by local DNS servers, or the hostname can be determined using the "hosts" file on a separate computer.

In any case, devices on a network can technically only connect using an IP address. This means that in order to establish a connection with a device by its name, it must be possible to resolve this name to an IP address. In addition, more than one domain name can be assigned to the same IP (one IP - several domain names). In this regard, resolving a domain name in IP is a fairly simple and minimally necessary operation to implement a network connection. On the other hand, resolving an IP address to the list of domain names assigned to it is generally neither trivial nor necessary. Therefore, it is not technically implemented in Internet protocols. Except for a single case, the DNS system provides a special record PTR (pointer). It is this entry that allows the reverse resolution of an IP address to a hostname, and it is this name that is meant by "hostname" and this is how it differs from the more general "domain name".

Usually, the host is understood as the TCP / IP protocol, that is, the network name of the device connected to the network. If a network connection is created dynamically, then in this case we can talk about the connection participant that manages the communication session. For example, during online games.

Instruction

First, use the Windows command line by logging into the system as an administrator. Open the Start menu and in the Run section or in the search box, type cmd and click OK. Enter on the command line: nslookup domain_name ( hosta). Press "Enter". Find out the host's IP address if possible, as this information may be hidden. Alternatively, instead of nslookup you can enter ping domain_name (hostname)/t, although this access can also be blocked.

Refer to sites such as http://whois-service.ru, http://ip-whois.net or http://2ip.ru. Enter the URL you know or check out the list of possible connections to your computer by analyzing your IP. If the connection is direct, then you will be able to get all the information you need. You can also find out information about the site through which you, for example, connect to the game.

If you need to find out who is currently connected to a gaming (or non-gaming) site, and at what IP addresses, go to it first. After that, minimize the window and through the "Start" again refer to the command line. Enter: netstat and press "Enter". The command line window will display all currently active connections and ports. For example: 198.168.11.1:55901 where 198.168.11.1 is the host's IP address and 55901 is the active port.

You can also find out the IP address of the host from the provider, although such data is usually provided only at the request of the police, courts and special services. So do not fall for the tricks of scammers who offer you all this information for a "free" SMS or after clicking on an unknown link.

Liked the article? Share with friends: