Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to know how a web server can distinguish between requests of different DNS names on the same server (same IP)?

for example, in my university there are two websites:

fea.kau.edu.sa
engineering.kau.edu.sa

and when I use nslookup on Windows, I got the same IP address for both domain names. Can you explain please?

share|improve this question
add comment

3 Answers

up vote 8 down vote accepted

HTTP 1.1 requires that all client systems send a header, Host, which indicates to the server which hostname they are sending the request for.

This allows the server to read that header, and respond with content for the appropriate site.

Without this feature, a different IP address would be needed for each different site; we would have run out of IPv4 space even sooner if we didn't have this in place.

share|improve this answer
add comment

Fire up your favourite packet tracer (something like wireshark) and watch what actually happens when you connect.

A very simple request might look like this:

GET / HTTP/1.1
Host: www.example.com
​

(note the empty line at the end if you want to re-create this yourself by using, say, telnet. You can see a lot of this stuff also over in wikipedia)

The Host: part of the request tells the web server which site to access.

There's a lot of stuff shown in these headers, so you might want to get to know them with a browser plugin like Firebug

share|improve this answer
add comment

Simple.

Since a long tim, every HTTP request.... ...INCLUDES THE DOMAIN.

Basically the PAYLOAD (not tcp, the http request structure) tells the web serve rwhat the domiain is for.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

has the fields transmitted by the browse. There is one "HOSTNAME".

Most other protocols - do not care.

share|improve this answer
    
is English your first language? –  Alnitak Jan 10 '12 at 9:47
    
No. Simlpe like that. –  TomTom Jan 10 '12 at 10:13
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.