Dnešná relácia otázok a odpovedí sa k nám pridelí zdvorilosťou SuperUser - podskupiny Stack Exchange, zoskupenia webových stránok Otázky a odpovede.
Otázka
Čítačka SuperUser N. Hinkle kladie nasledujúcu otázku o procese internetového overovania a autentifikácie Windows:
In Windows 7, the notification area networking icon will show an error indicator if there is no internet access
How does Windows know whether or not it has a successful internet connection?
Presumably it is checking some online Microsoft service to see whether it has a successful connection, gets redirected to some other page, or doesn’t get any response at all, but I haven’t seen anywhere that this process or the services used are documented. Can anybody explain how this works?
Takéto kontroly sú jednou z mnohých vecí, ktoré považujeme za samozrejmosť pri používaní moderného operačného systému, ale aj tie najdôležitejšie prvky z užívateľskej skúsenosti majú základný mechanizmus. Ako nám systém Windows hovorí, či je internetové pripojenie a či sa potrebujeme prihlásiť do portálu autentifikácie Wi-Fi?
Odpoveď
Príslušník SuperUser Tobias Plutat ponúka určitý pohľad na tento proces:
After some digging (the sheer number of network and Internet related services in Windows is astonishing), I think I found it. Windows Vista and 7 have a variety of Network Awareness features, one of which is the Network Connectivity Status Indicator that performs connectivity tests that in turn are used by the network systray icon. The test for internet connectivity is simple:
- NCSI tries to load a specific page via HTTP (more precisely: a text document) and tests whether it can be retrieved.
- If that is not successful, Windows reports “No Internet access”.
The mechanism also checks whether the domain the document is hosted on resolves to the expected IP address. So, it might also assume proper internet access if this test is successful but the document can’t be retrieved.
The reason it reports “No Internet Access” when you haven’t authenticated on a Hotspot yet lies in the way a Hotspot works. It blocks all ports besides 80 and 443 (for HTTP and HTTPS, respectively), which get redirected to the Hotspot’s authentication server and might mess with DNS requests in one way or another. Thus, NCSI can neither resolve the domain its test file is hosted on, and even if it could it wouldn’t reach the actual file because HTTP traffic is redirected to the Authentication server.
Ďalší prispievateľ Jeff Atwood zdôrazňuje niektoré kľúčové citácie z dokumentu Tobias:
Here are the details of the connection status determination process:
The following list describes how NCSI might communicate with a Web site to determine whether a network has Internet connectivity:
-
A request for DNS name resolution of
dns.msftncsi.com
-
HTTP žiadosť o
https://www.msftncsi.com/ncsi.txt
vráti 200 OK a text
Microsoft NCSI
Toto nastavenie môže byť zakázané s nastavením databázy Registry. Ak nastavíte:
HKEY_LOCAL_MACHINE SYSTEM CurrentControlSet Služby NlaSvc Parametre Internet EnableActiveProbing
na
0
Systém Windows už nebude skúmať internetové pripojenie.
Spoločnosť Apple robí niečo veľmi podobné v systéme iOS na odhalenie pripojenia k internetu a možných wifi stránok na prihlásenie do hotela atď.
Zatiaľ čo celý tento proces je pre koncových používateľov zvyčajne 100% transparentný, príležitostne po autentifikácii prostredníctvom webového portálu hot-spotu Wi-Fi, ocitnete sa pri pohľade na skutočný obsah súboru NSCSI.txt. Ako ste skončili pri pohľade na netextový textový dokument namiesto webovej stránky, ktorú ste sa pokúšali načítať, už nie je tajomstvom, keď je spojený s predchádzajúcimi odpoveďami na túto tému.
Máte niečo doplniť vysvetlenie? Zvuk vypnúť v komentároch. Chcete si prečítať viac odpovedí od iných používateľov technológie Stack Exchange? Pozrite sa na celý diskusný príspevok tu.