Cheatsheet: Difference between revisions

Content added Content deleted
Line 738:
 
== Hosts file ==
 
* All operating systems with network support have a hosts file in order to translate hostnames to IP addresses.
* The file /etc/hosts started in the old days of DARPA as the resolution file for all the hosts connected to the internet (before DNS existed).
* It has the maximum priority ahead of any other name system
 
* Order of name resolution is actually defined in /etc/nsswitch.conf, which usually has this entry:
hosts: files dns
 
* This means "try files (/etc/hosts); and if it fails, try DNS."
* But that order could be changed or expanded.
 
* As a single file, it doesn't scale well: the size of the file becomes too big very soon.
* That is why the DNS system was developed, a hierarchical distributed name system.
* It allows any host to find the numerical address of some other host efficiently.
 
* On Linux and Mac OS it is located here: /etc/hosts
* On Windows it is under: Windows\System32\drivers\etc\
 
* The hosts file contains lines of text consisting of an IP address field followed by One or More Host names.
* Each field is separated by white space – tabs or spaces.
* Comment lines are indicated by an octothorpe (#) in the first position.
* Entirely blank lines in the file are ignored.
* One name may resolve to several addresses (192.168.0.8 10.0.0.27).
* However which one is used depends on the routes (and their priorities) set for the computer.
 
* By editing the hosts files, you can achieve:
Block a website
Handle an attack or resolve a prank
Create an alias for locations on your local server
Override addresses that your DNS server provides
Control access to network traffic
 
== Check CPU, Memory and HDD ==