Chabot College ELEC 99.08 Name Resolution CISCO NETWORKING ACADEMY

advertisement
Chabot College
ELEC 99.08
Name Resolution
CISCO NETWORKING ACADEMY
Name Resolution Topics
• Concepts
– name to IP address mapping
– “fully qualified” domain names
• Methods
– host tables
– domain name services (DNS)
• Commands
–
–
–
–
–
ip host
ip domain-lookup
ip name-server
ip domain-name
show hosts
CISCO NETWORKING ACADEMY
Name Resolution Purposes
1. Convenience of humans.
Which is easier to remember?
• 198.133.219.25
• www.cisco.com
CISCO NETWORKING ACADEMY
Name Resolution Purposes
2. Ability to move machines with no disruption
of access.
What happens when we move a server to a
different network or subnet? How do users
find it?
198.133.219.25 becomes 209.42.167.99
but
www.cisco.com
CISCO NETWORKING ACADEMY
remains
www.cisco.com
Fully Qualified Domain Name
• Unique in the world - no duplicates.
• Example:
library.stanford.edu
• Heirarchical structure:
– Top level domain (e.g. edu)
– Domain (e.g. stanford)
– Host (e.g. library)
CISCO NETWORKING ACADEMY
Fully Qualified Domain Name
chabotde.clpccd.cc.ca.us
Host name
Domain name
Top-Level
Domain
Sub-Domains
CISCO NETWORKING ACADEMY
Fully Qualified Domain Name
• For our labs, we’ll assume this domain
name has been assigned: lab.edu
• Our router’s fully qualified domain names
will therefore be:
– fremont.lab.edu
– hayward.lab.edu
– oakland.lab.edu
CISCO NETWORKING ACADEMY
Default Domain Name
• TCP/IP configurations include a default
domain to be appended to any unqualified
hostname (e.g. hayward).
• For our labs, we’ll use this default domain:
lab.edu
• Then when you ping fremont, TCP/IP will
actually ping fremont.lab.edu
• Saves a lot of typing!
CISCO NETWORKING ACADEMY
Resolving Names to Addresses
• Host Tables
• Domain Name Services
CISCO NETWORKING ACADEMY
Host Table
• Created manually on each router or computer
• Maps names to IP addresses
– fremont.lab.edu 192.168.1.1
– hayward.lab.edu 192.168.2.1
• Provides name resolution only on the host on
which the table was created.
• Fast, low overhead, cached in RAM.
CISCO NETWORKING ACADEMY
Host Table Commands
• ip host [name] [address]
• May include up to 8 addresses per name
• Global config mode
oak(config)#ip host fremont
oak(config)#ip host hayward
oak(config)#ip host oakland
CISCO NETWORKING ACADEMY
192.168.1.1
192.168.2.1
192.168.3.1
10.1.0.1
10.2.0.1
10.2.0.2
Domain Name Services (DNS)
• A network service
• Runs on one or two servers that are used by all
hosts on the network
• Maps names to IP addresses
– fremont.lab.edu
– hayward.lab.edu
192.168.1.1
192.168.2.1
• Used throughout the global Internet
CISCO NETWORKING ACADEMY
DNS - Special Considerations
• Billions of IP addresses in use, many mapped to
a name.
(We could never fit them in a hosts file.)
• IP addresses and domain names change daily,
and new ones are assigned daily.
(We could never keep hosts files up to date.)
• DNS is like a global phone book that must be
– kept up-to-date
– very fast in its response
CISCO NETWORKING ACADEMY
How DNS Works
• Local host sends DNS query to the local name server defined in the
host’s TCP/IP config. (UDP port 53)
• If the local name server knows the address of the target name, it
sends back a reply.
• Otherwise, it forwards the query to one of the 13 root name servers
on the Internet.
• The root server then returns the IP address of the primary name
server responsible for the domain being requested.
• The local name server then begins a recursive process, contacting
the primary name server and then the authoritative name server for
the target domain.
• The local name server then fills the local host’s request for the target
ip address.
• The host then uses the supplied IP address to contact its target.
CISCO NETWORKING ACADEMY
How DNS Works - Example
• To find the IP address of technet.micrsoft.com...
• your PC asks the Chabot name server,
which then performs the following steps:
• Asks one of the 13 root name servers on the Internet for the
addresses of the com name servers
• Asks one of these com servers for the address of the microsoft.com
name server
• Ask the microsoft.com name server for the address of the host:
technet.microsoft.com.
• The chabot name server then replies to your PC with the target IP
address
CISCO NETWORKING ACADEMY
How DNS Works
CISCO NETWORKING ACADEMY
DNS Commands
• no ip domain-lookup
• Turns off the use of DNS to look up the ip
address mapped to a hostname
• Used in our practice lab to prevent delays due to
mistyped commands
• Global config mode
oak(config)#no ip domain-lookup
oak(config)#
CISCO NETWORKING ACADEMY
DNS Commands
• ip domain-lookup
• Turns on the use of DNS to look up the ip
address mapped to a hostname
• This is the default for all routers, so this
command is only needed if lookup was
previously turned off with no ip domain-lookup
• Global config mode
oak(config)#ip domain-lookup
oak(config)#
CISCO NETWORKING ACADEMY
DNS Commands
•
•
•
•
ip name-server xxx.xxx.xxx.xxx
Sets the address for the DNS server to be used
All DNS queries will go to this server
Up to six server addresses may be listed,
separated by spaces
• Global config mode
oak(config)#ip name-server 172.28.118.12
oak(config)#
CISCO NETWORKING ACADEMY
DNS Commands
• ip domain-name [name]
• Sets the default domain to be appended to
“unqualified” names
• Saves repetitive typing of local domain
• Global config mode
oak(config)#ip domain-name lab.edu
oak(config)#
CISCO NETWORKING ACADEMY
DNS Commands
• Typical configuration
• Global config mode
oak(config)#ip domain-lookup
oak(config)#ip name-server 172.28.118.12
oak(config)#ip domain-name lab.edu
oak(config)#
• On a Windows PC, the same settings are made
in the Network Control Panel, TCP/IP properties.
CISCO NETWORKING ACADEMY
Show Hosts Commands
• show hosts
• Lists the host-address mappings cached in RAM
• privileged EXEC mode
router#show hosts
Default domain is CISCO.COM
Name/address lookup uses domain service
Name servers are 192.31.7.10 131.108.4.12
Host
Flag
Age
Type
SLAG.CISCO.COM
(perm, OK) 1
IP
CHAR.CISCO.COM
(temp, OK) 8
IP
CHAOS.CISCO.COM
(temp, OK) 8
IP
DIRT.CISCO.COM
(temp, EX) 8
IP
DUSTBIN.CISCO.COM (temp, EX) 0
IP
DREGS.CISCO.COM
(temp, EX) 24
IP
CISCO NETWORKING ACADEMY
Address(es)
131.108.4.10
192.31.7.50
131.108.1.115
131.108.1.111
131.108.1.27
131.108.1.30
Show Hosts Commands
• Flags:
– perm - address resolved by host table
– temp - address resolved by DNS
router#show hosts
Default domain is CISCO.COM
Name/address lookup uses domain service
Name servers are 192.31.7.10 131.108.4.12
Host
Flag
Age
Type
SLAG.CISCO.COM
(perm, OK) 1
IP
CHAR.CISCO.COM
(temp, OK) 8
IP
CHAOS.CISCO.COM
(temp, OK) 8
IP
DIRT.CISCO.COM
(temp, OK) 8
IP
DUSTBIN.CISCO.COM (temp, EX) 0
IP
DREGS.CISCO.COM
(temp, EX) 24
IP
CISCO NETWORKING ACADEMY
Address(es)
131.108.4.10
192.31.7.50
131.108.1.115
131.108.1.111
131.108.1.27
131.108.1.30
DNS Server Records
• A few DNS record types
–
–
–
–
A (host address)
CNAME (alias - cannonical name)
PTR (domain name pointer - for reverse lookup)
MX (mail exchange - mail server for domain)
• CNAME records mean that a host at one IP
address can have many names.
CISCO NETWORKING ACADEMY
Let’s try it!
• Point your browser at:
http://www.clpccd.cc.ca.us
http://porter.clpccd.cc.ca.us
• For the host at 209.129.156.3, Chabot’s DNS
servers list
– porter as the host name (A-record)
– www as a name alias (CNAME-record)
CISCO NETWORKING ACADEMY
Let’s try it!
• Point your browser at:
http://porter
• On your PC, the default domain is set to
– clpccd.cc.ca.us
• Therefore, when you browse to porter,
you reach the ip address of
porter.clpccd.cc.ca.us
CISCO NETWORKING ACADEMY
Let’s try it!
• At the DOS prompt:
ping davis
• On your PC, the default domain is set to
– clpccd.cc.ca.us
• Therefore, when you ping davis,
you reach the ip address of
davis.clpccd.cc.ca.us
CISCO NETWORKING ACADEMY
Lookup Sequence
1. Check cache in RAM.
If entry not found,
2. Check hosts table.
If entry not found,
3. Query local DNS server.
If entry not found, refer to root server and then to
authoritative DNS server for the target domain.
Therefore, host table entries will be used first
to satisfy a query.
CISCO NETWORKING ACADEMY
Site Blocking - a simple approach...
• What does this address mean?
127.0.0.1
• “loopback” address - your own NIC
CISCO NETWORKING ACADEMY
Site Blocking - a simple approach...
• Suppose I wanted to prevent my browser from
diplaying ads from ad1.doubleclick.net
which DNS resolves to 206.65.183.110.
• Where would my browser go if my PC’s host
table contained this entry?
127.0.0.1 ad1.doubleclick.net
• Take a look at this hosts file, which is designed
to support ad blocking.
• For more info, point your browswer at
http://www.accs-net.com/hosts/index.html
CISCO NETWORKING ACADEMY
Download