rss
Kioskea - Tribune
Report an error
Posted by

Mr Tarun Aggarwal

    

Filed under : Kioskea - Tribune >> Webmastering >> Hosting >> HOSTS Guide
Key words : 

linux

unix

windows

protocole

tcp/ip

hosting

host



HOSTS Guide


28 Apr, 2008 12:22 pm

In a network, the system that contains the data is called the host, while the computer at which the user sits is called the remote terminal. What to know more about hosting data?



default text HOSTS (case insensitive in Windows OSes) or hosts (must be lower case in *nix OSes) is an ASCII (plain text) file used by TCP/IP protocol for BSD/FreeBSD/Linux/Solaris/UNIX, BeOS, MacOS, OS/2, Novell Netware + Windows Operating Systems.

Acts as TCP/IP (Transport Control Protocol/Internet Protocol) host table and contains a list of address-to-name resolution mappings of numeric IP (Internet Protocol) addresses (32-bit identifiers) resolved to valid host names.

Operates as a local DNS (Domain Naming System) server by translating a UNC (Universal Naming Convention) domain name into an IP address, thus decreasing the time necessary to reach a remote server.

Never map an IP to a host name already in use, for example your ISP (Internet Service Provider) name or your favorite web site(s) name(s).
Never rename this file, it must be HOSTS without extension.

To properly use HOSTS in Windows 32-bit (Win32/x86) + 64-bit (Win64/x64) OSes you must make sure Enable DNS is turned ON: Control Panel -> Network -> your TCP/IP adapter name (if more than 1 must do this for ALL) -> TCP/IP Properties -> DNS Configuration tab -> check Enable DNS box -> click Apply/OK button.

Microsoft Windows Host Name Resolution over TCP/IP search order:

HOSTS file
DNS server
NetBIOS cache
WINS server
Broadcast
LMHOSTS file

You can view/edit your HOSTS file using Notepad or better text/ASCII editor/viewer, especially if your HOSTS file is larger than 64 KB.
Each entry must be kept on its own (separate) line.
Entries are most always case sensitive.
Each IP address must be placed 1st separated by at least 1 space or Tab from corresponding host (machine) name, which must be placed 2nd on same line.
Insert any optional comments on same line after host name (or on separate lines) preceded by a # symbol and followed (optionally) by at least 1 space or Tab (examples):

IP Host name Comments

102.54.94.97 rhino.acme.com # source server
38.25.63.10 x.acme.com # x client host

This must be the 1st HOSTS line:

127.0.0.1 localhost

If more than 1 localhost lines, the 1st one overrides all others.

Each host name entry is limited to a maximum of 255 characters.

•NEVER• rename/modify/delete/comment/remark this HOSTS line:

127.0.0.1 localhost

The hosts file must reside in: [%windir% = usually C:\WINDOWS (3.xx/95/98/ME + 2000/XP/2003/Vista) or C:\WINNT (NT/2000)]

%windir% = Windows 3.xx/95/98/ME
%windir%\SYSTEM32\DRIVERS\ETC or %windir%\SYSTEM32 = Windows NT4/2000/XP/2003/Vista:
HOSTS location can be changed by modifying this Registry Value.
/etc = BSD/FreeBSD/Linux/Solaris/UNIX
/boot/beos/etc = BeOS
/private/etc = MacOS X
\mptn\etc = OS/2
\ETC = Novell Netware


• NOTE #1:

In Windows 2000/XP/2003 DNS Client service (if enabled) loads the entire contents of the existing HOSTS file (if any) into the DNS cache, which may slow down the computer, especially if using a (very) large HOSTS file.
You have 2 choices here:

One way is to stop and/or disable DNS Client service: Start button -> Run... box -> type services.msc -> click OK or press Enter -> open DNS Client -> General tab -> set to Manual (if needed) or Disabled (if not needed) -> Stop (if running) -> click OK or press Enter -> reboot.
To set DNS Client to Manual (if needed), run these 2 commands from a DOS console or a batch file:
SC CONFIG DNSCache START= demand
SC STOP DNSCache

To set DNS Client to Disabled (if not needed), run these 2 commands from a DOS console or a batch file:

SC CONFIG DNSCache START= disabled
SC STOP DNSCache

To determine if you need to have DNS Client service enabled: Start button -> Run... box -> type services.msc -> click OK or press Enter -> open DNS Client -> Status column -> should state Started (if needed) or should be empty (if not needed).
More info @ MSKB.

CAUTION:
Stop/Disable DNS Client service ONLY if NOT connected to/part of a network/domain.
If connected to/part of a network/domain, DNS Client service may be necessary for proper operation.
More info:

Windows 2000/XP/2003 Services.
Windows XP Professional Services.
Windows XP Professional SP2 Services.
Windows XP Services Guide.
Windows XP = DNS Client Service.
Windows XP Services Tweak Guide.
Windows XP Services Guide.
Optimize XP Services.
Windows XP Services Removal Guide.

The other way is to force the DNS cache (if DNS Client service is active) to read the entire list of servers from your HOSTS file by running this command from a DOS console or a batch file:
IPCONFIG /flushdns

More info @ MSKB.

• NOTE #2:

In case you are running ANY network/server on your local computer, you •MUST• edit your HOSTS file using Notepad or better text/ASCII editor/viewer and change ALL 127.0.0.1 entries (except the 127.0.0.1 localhost line) to read 0 (or 0.0.0.0).
Restart or log back into your network/server when done.
Otherwise you might get a huge number of login popup prompts while trying to access the local server/network, because localhost is always located at the 127.0.0.1 IP address.

• NOTE #3:

In case you cannot access an internet site/server, and if your web browser/e-mail client/ftp client/network tool returns a message/page/screen similar to (depending on the web browser/client/tool used):

"Problem loading page / Unable to connect" = Firefox/Mozilla/Netscape/Seamonkey
"Cannot find server / This page cannot be displayed" = Internet Explorer
"Unable to connect to server" = Netscape (older)
"Error / Connection closed by remote server" = Opera
"Connection failed / Address not available" = WS_FTP
this may be due to a 0 (0.0.0.0 abbreviated) or 127.0.0.1 entry into your HOSTS file associated with the internet site/server you are trying to access.
To (re)enable that particular internet site/server, just delete/remove or comment/remark that entire line: edit your HOSTS file using Notepad or better text/ASCII editor/viewer and place a # symbol in front of that line.
Then restart your web browser/e-mail client/ftp client/network tool and access that same internet site/server again.

• NOTE #4:

In case Internet Explorer web browser does NOT allow you to save a web page, and you get this error message (or similar):


"Error Saving Web Page
This Web page could not be saved"
this may be due to 1 or more 0 (0.0.0.0 abbreviated) or 127.0.0.1 entry/entries into your HOSTS file associated with 1 or more of the internet site(s)/server(s) you are trying to save that web page from.
To temporarily access that particular internet site/server and be able to save it properly as web page:

Copy & paste that URL name from the Internet Explorer URL address box: highlight the entire URL line -> right-click on it -> select Copy.
Close/exit that particular Internet Explorer instance.
Rename to any other name or move to any other valid location your HOSTS file.
Restart Internet Explorer.
Highlight the entire URL address box -> right-click on it -> select Paste.
Now save your web page again.
Close/exit that particular Internet Explorer instance.
Rename BACK to the original name or move BACK to the original location your HOSTS file.
Restart Internet Explorer.
This is because webmasters sometimes include server-side code to access more than 1 web site/server from within the same web page.
FYI:
If you don't understand some of these abbreviations/acronyms/terms, please look them up.

Article originally published on: Eye Links


Post comment
   
 Name *
 Email *
 URI
Your comment *:
 
Line breaks are automatic. The e-mail address is required for submission, but will not be displayed. The following HTML language is allowed: <a href=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <strong> <sub> <sup>

Ads
FEEDS


    
Powered by Take Part Média