DNS/Config

From AbarikWiki
Jump to: navigation, search

Host File

  • Host File
  • Change this to statically assign a DNS Mapping

Win

  • C:\Windows\System32\drivers\etc\hosts

Unix

  • /etc/hosts

Example:

[root@localhost Desktop]# echo "1.1.1.1 x.com" >> /etc/hosts
[root@localhost Desktop]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
1.1.1.1 x.com
[root@localhost Desktop]# # Verify
[root@localhost Desktop]# nslookup
> localhost.localdomain
Server:         192.168.218.2
Address:        192.168.218.2#53

Name:   localhost.localdomain
Address: 127.0.0.1
> 

Client

Unix

  • Generally, "/etc/resolve.conf" maintains the DNS Server list that generally gets updated using dhclient if you are using DHCP to learn DNS Server
[admin@localhost ~]$ cat /etc/resolv.conf
; generated by /sbin/dhclient-script
search localdomain
nameserver 192.168.218.2
[admin@localhost ~]$ 
[admin@localhost ~]$ nslookup
> www.google.com
Server:         192.168.218.2
Address:        192.168.218.2#53

Non-authoritative answer:
Name:   www.google.com
Address: 173.194.115.84
Name:   www.google.com
Address: 173.194.115.80
Name:   www.google.com
Address: 173.194.115.81
Name:   www.google.com
Address: 173.194.115.83
Name:   www.google.com
Address: 173.194.115.82
>