Dhcp DNS Snmp

81
www.nettech.in Nettech Private Ltd. DHCP, DNS, SNMP Prepared by : Swapan Purkait Director Nettech Private Limited [email protected] + 91 93315 90003 For Summ er T rainin g on Comp uter Netwo rkin g visit www.nettech.in

Transcript of Dhcp DNS Snmp

Page 1: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 1/81

www.nettech.inNettech Private Ltd.

DHCP, DNS, SNMP

Prepared by :Swapan PurkaitDirectorNettech Private [email protected]+ 91 93315 90003

For Summer Training on Computer Networking

visit www.nettech.in

Page 2: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 2/81

www.nettech.inNettech Private Ltd.

First Question

• How does your computer know whichIP to use?

• How does your computer know thatwww.nettech.in is at IP 202.144.75.66?

• How can you track your network’s health?

Page 3: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 3/81

www.nettech.inNettech Private Ltd.

The Internet and Addressing

• All machines on the Internet are accessed viatheir IP address –  Dotted quad: xxx.xxx.xxx.xxx

• Problem: IP addresses are hard to remember and

hard to statically assign on large networks• Solution: Need to come up with a way to

automatically assign IP addresses and a textbased representation of machine addressesinstead of just 4 numbers

Page 4: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 4/81

Page 5: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 5/81

Page 6: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 6/81

www.nettech.inNettech Private Ltd.

DHCP

• Allows client machines to receive an IPaddress, DNS information, etcautomatically

• Before DHCP came into use, users had to

type in all this information by hand, whichis bad: – Easy to mistype something when entering by

hand

 – Manually changing network configuration every

time you move your laptop is a pain – Bootp resolved some of these issues

• … and DHCP still uses the same port as bootp

Page 7: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 7/81

www.nettech.inNettech Private Ltd.

Purpose of DHCP

From RFC-2131 (the Internet standard):

• The Dynamic Host Configuration Protocol (DHCP) provides a framework for passingconfiguration information to hosts on a

TCP/IP network.

• DHCP consists of two components:

 – a protocol for delivering host-specific configuration parameters from a DHCP server to

a host and  – a mechanism for allocation of network addresses

to hosts.

Page 8: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 8/81

www.nettech.inNettech Private Ltd.

DHCP functional goals

• A host without a valid IP address locatesand communicates with a DHCP server

• A DHCP server passes configurationparameters, including an IP address, tothe host

• The DHCP server may dynamicallyallocate addresses to hosts and reuseaddresses

• Hosts can detect when they require a

new IP address• Unavailability of DHCP server has

minimal effect on operation of hosts

Page 9: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 9/81

Page 10: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 10/81

www.nettech.inNettech Private Ltd.

What does DHCP do?

• Provides protocol stack, application andother configuration parameters to hosts

• Eliminates need for individual, manualconfiguration for hosts

• Includes administrative controls fornetwork administrators

• Backward compatible packet format forBOOTP interoperation (RFC 1542)

• Can coexist with hosts that have pre-

assigned IP addresses and hosts that donot participate in DHCP

Page 11: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 11/81

www.nettech.inNettech Private Ltd.

Design Goals

• Eliminate manual configuration of hosts

• Prevent use of any IP address by morethan one host

• Should not require a server on every

subnet

• Allow for multiple DHCP servers

• Provide a mechanism, not a policy

• Provide the same configuration -including IP address - to a hostwhenever possible

Page 12: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 12/81

www.nettech.inNettech Private Ltd.

What can you do with DHCP

• Plug-and-play

• Move desktop PCs between offices

• Renumber

• Other restructuring - change subnetmasks

• Mobile IP - laptops

• Moving equipment - cartable

Page 13: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 13/81

www.nettech.inNettech Private Ltd.

What DHCP doesn’t do

• Support multiple addresses per interface• Inform running host that parameters have

changed

• Propagate new addresses to DNS

• Support inter-server communication

• Provide authenticated message delivery

• Configure routers and other network equipment

• Design network addressing plan

• Determine other configuration parameters

• Locate other servers

Page 14: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 14/81

www.nettech.inNettech Private Ltd.

DHCP: Messages Overview

• Several messages are sent back and forthbetween a client and the DHCP serverbefore it can successfully obtain an IPaddress

Page 15: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 15/81

www.nettech.inNettech Private Ltd.

DHCP: DISCOVER

• Hardcoding the addresses of DHCP serverskind of defeats the purpose of automaticconfiguration

• Solution: A client using DHCP will

broadcast a DISCOVER message to allcomputers on its subnet (addr255.255.255.255) to figure out the IPaddress of any DHCP servers

• Most routers are configured to pass thisrequest within the campus or enterprise

Page 16: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 16/81

www.nettech.inNettech Private Ltd.

DHCP: OFFER

• (Optionally) sent from server in responseto a DISCOVER

• Contains an IP address, otherconfiguration information as well (subnet

mask, DNS servers, default gateway,search domains, etc)

• Note that all DHCP servers that receive aDISCOVER request may send an OFFER;

 – since a client typically does not need morethan one IP address, more messages neededto zero on one IP

Page 17: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 17/81

www.nettech.inNettech Private Ltd.

DHCP: REQUEST

• Sent by client to request a certain IP address –  Usually the one sent by an OFFER, but also used to renew

leases. Also can be sent to try to get same address after areboot

• This message is broadcast

• Most OSs by default will send a REQUEST for thefirst OFFER they receive – this means that if there is a rogue DHCP server on your subnet,most clients will ignore the OFFERs from thecampus DHCP servers (since the OFFER from therogue server gets to the user’s PC first)!

Page 18: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 18/81

www.nettech.inNettech Private Ltd.

DHCP: ACK/NACK

• Sent by server in response to a REQUEST

• ACK: Request accepted, client can startusing the IP it REQUESTed

• NACK: Something is wrong with theclient’s REQUEST (for example theyrequested an IP address they’re notsupposed to have)

Page 19: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 19/81

www.nettech.inNettech Private Ltd.

DHCP: RELEASE

• Sent by client to end a lease

• Not strictly required, but is the “polite” thing todo if done with the IP (could just let the lease

expire)

• Some clients may not send RELEASEs in anattempt to keep the same IP address for as longas possible

Page 20: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 20/81

www.nettech.inNettech Private Ltd.

DHCP: Big Picture

Page 21: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 21/81

www.nettech.inNettech Private Ltd.

Summary

• DHCP works today as a tool forautomatic configuration of TCP/IP hosts

• It is an open Internet standard andinteroperable client implementations arewidely available

• Provides automation for routineconfiguration tasks, once networkarchitect has configured network andaddressing plan

• Ongoing work will extend DHCP withauthentication, DHCP-DNS interactionand inter-server communication

Page 22: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 22/81

www.nettech.inNettech Private Ltd.

DHCP: Conclusion

• Efficient way of assigning computers IPaddresses and delivering configurationinformation to those computers

• Does not solve other problem of addressing – that IP addresses are hard toremember

Page 23: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 23/81

www.nettech.inNettech Private Ltd.

IETF standards

• Formal process for development, reviewand acceptance of TCP/IP protocol suitestandards

• Initial specifications published as InternetDrafts (I-Ds)

• Accepted specifications published asRequest for Comments (RFCs)

Page 24: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 24/81

www.nettech.inNettech Private Ltd.

Protocol status

• DHCP has been accepted as a DraftStandard; the specifications arepublished in:

 – RFC 2131: Dynamic Host ConfigurationProtocol

 – RFC 2132: DHCP Options and BOOTPVendor Extensions

• Several additional options are in

development

Page 25: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 25/81

www.nettech.inNettech Private Ltd.

Implementation status

• DHCP is an open standard, with freelyavailable specifications

• Can be (and has been) implemented

entirely from the specification• Commercial implementations are widely

available

• Non-commerical implementations are also

available

Page 26: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 26/81

www.nettech.inNettech Private Ltd.

DHCP Resources

• Compilation of DHCP-related WWW linksand other information:

http: / /www. dhcp. org

• DHCP FAQ (maintained by John Wobus)

• dhcp-v4@bucknel l . edumailing list (adminrequests to l i stserv@bucknel l . edu)

• IETF information can be retrieved from:http: / /www. i et f . cnri . reston. va. us

• I-Ds and RFCs can also be retrieved from:http: / /www. rf c-edi tor. org

Page 27: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 27/81

www.nettech.inNettech Private Ltd.

DNS – Domain Name System

Page 28: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 28/81

www.nettech.inNettech Private Ltd.

Second Question

• How does your computer know which IP touse?

• How does your computer know thatwww.nettech.in is at IP202.144.75.66?

• How can you track your network’s health?

Page 29: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 29/81

www.nettech.inNettech Private Ltd.

Domain Name System (DNS)

• The first IP networks distributed host fileson a regular basis

 – This became a burden and an automateddistributed solution was needed

• IP Addresses are great for computers – IP address includes information used for

routing.

• IP addresses are tough for humans toremember.

• IP addresses are impossible to guess.

 – ever guessed at the name of a WWW site?

Page 30: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 30/81

www.nettech.inNettech Private Ltd.

Hostnames

• DNS is born

• Domain names comprise a hierarchy sothat names are unique, yet easy toremember.

• The domain name system is usually usedto translate a host name into an IPaddress .

 – Ex: www.xxx.org <-> IP 212.87.7.181

• (which one would you rather remember?)

Page 31: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 31/81

www.nettech.inNettech Private Ltd.

DNS: Basics

• Hierarchical namespace

• Distributed system – very few coreservers

• Stores other information than simplehostname <-> IP mappings

• Request/response protocol

Page 32: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 32/81

www.nettech.inNettech Private Ltd.

DNS Hierarchy

edu com org in

rpi albany ac nettech

Page 33: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 33/81

www.nettech.inNettech Private Ltd.

Host name structure

• Each host name is made up of asequence of labels separated byperiods.

 – Each label can be up to 63 characters

 – The total name can be at most 255

characters.

• Examples:

 – whitehouse.gov

 – barney.the.purple.dinosaur.com

 – monica.cs.rpi.edu

Page 34: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 34/81

www.nettech.inNettech Private Ltd.

Domain Name

• The domain name for a host is thesequence of labels that lead from the host(leaf node in the naming tree) to the topof the worldwide naming tree.

• A domain is a subtree of the worldwidenaming tree.

Page 35: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 35/81

www.nettech.inNettech Private Ltd.

Hierarchical Naming

com edu gov mil net org us

arpa

colordao

cs

foobar 

foobar.cs.colorado.edu

Page 36: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 36/81

www.nettech.inNettech Private Ltd.

Top level domains

• edu, gov, com, net, org, mil, …

• Countries each have a top level domain (2letter domain name).

 – Such as .in, .uk, .it, etc.

• New top level domains include:

.aero .biz .coop .info .name .pro

Page 37: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 37/81

www.nettech.inNettech Private Ltd.

Domain Naming System

edu com

harvard …mit

hbs ee

www

physics

cisco…yahoonasa…nsf arpa…navy acm…ieee

gov mil org net uk fr  

Page 38: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 38/81

www.nettech.inNettech Private Ltd.

DNS: Architecture

• DNS servers are responsible for one or moredomains of any level

•  “Root servers” are maintained throughout theworld (one is in Palo Alto) and are responsible forall of the top-level domains –  When you register a domain, an entry for that domain is added

to the appropriate root server

• Owners of each regular domain or subdomainmaintain (or outsource) their own DNS serverscontaining the correct information

Page 39: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 39/81

www.nettech.inNettech Private Ltd.

Name Servers

• Partition hierarchy into zonesedu com

princeton …mit

cs ee

ux01 ux04

physics

cisco …yahoo nasa …nsf arpa …navy acm …ieee

gov mil org net uk fr  

Rootname server 

Princetonname server 

Cisconame server 

CSname server 

EEname server 

Each zone implementstwo or more nameservers

1. Primary

2. secondary

Page 40: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 40/81

www.nettech.inNettech Private Ltd.

Hierarchical Administration - “Zones” 

arpa com in gov mil net org us

arpa

nettech

photos photos.nettech.in

Page 41: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 41/81

www.nettech.inNettech Private Ltd.

Administration - Zones

• A zone is a subtree of the DNS tree that isindependently managed – Second-level domains (“ac.in”) are usually an

independent zone

 – Most sub-domains (“ximb.ac.in”) are alsoindependent.

• A zone must provide multiple nameservers. This server records the membersin the domain. – You typically need a primary name server and

one or more secondary name servers.

 – Secondary retrieves information from primaryusing a zone transfer.

Page 42: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 42/81

www.nettech.inNettech Private Ltd.

Resolving an address

• A.C.D wants to know about F.E.D

 A

C

D

E

GB F

H

• Host “A.C.D” asks “B.C.D” (the local nameserver) to resolve “F.E.D”

Name

servers

Page 43: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 43/81

www.nettech.inNettech Private Ltd.

Resolving an address

• B.C.D doesn’t know the answer.

• It wants to ask the primary domain server for the “E.D” domain, so it asks the parent of the “B.C” domain (“D” in this example) to resolve “E.D”.

• D asks H, the root server.• H doesn’t know the answer, but it’s the top-level

domain and knows that “G.E.D” is the primarydomain server for the “E.D” domain

• B.C.D now knows the primary domain server for

the E.D domain, and can now ask “G.E.D” about “F.E.D” 

Page 44: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 44/81

www.nettech.inNettech Private Ltd.

Domain servers

• What kind of records can berequested for a given domain? – Address translation

 – Caching information

 – Mail server information – Authoritative nameserver information

• How is this data requested? – Each record has a type and certain data

associated with it – clients request records of acertain type from a server

Page 45: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 45/81

www.nettech.inNettech Private Ltd.

DNS Organization

• Distributed Database

 – The organization that owns a domain nameis responsible for running a DNS serverthat can provide the mapping betweenhostnames within the domain to IPaddresses.

 – So - some machine run by RPI isresponsible for everything within the rpi.edudomain.

Page 46: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 46/81

www.nettech.inNettech Private Ltd.

rpi.edu

DNS DB

rpi.edu

DNS DB

DNS Distributed Database

• There is one primary server for adomain, and typically a number of secondary servers containing replicateddatabases.

rpi.edu

DNS DB

 Authori tat ive

rpi.edu

DNS DB

Replicas

rpi.edu DNS server 

Page 47: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 47/81

www.nettech.inNettech Private Ltd.

DNS Clients

• A DNS client is called a resolver .

• A call to gethostbyname()is handled by a

resolver (typically part of the client).

• Most Unix workstations have the file/etc/resolv.conf that contains the

local domain and the addresses of DNSservers for that domain.

Page 48: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 48/81

www.nettech.inNettech Private Ltd.

 /etc/resolv.conf 

domain nettech.in

202.144.75.66

Page 49: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 49/81

www.nettech.inNettech Private Ltd.

nslookup

• nslookup is an interactive resolver that

allows the user to communicate directlywith a DNS server.

• nslookup is usually available on Unixworkstations. (dig and host are also DNS

clients).

Page 50: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 50/81

www.nettech.inNettech Private Ltd.

DNS Servers

• Servers handle requests for their domaindirectly.

• Servers handle requests for other domainsby contacting remote DNS server(s).

• Servers cache external mappings.

Page 51: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 51/81

www.nettech.inNettech Private Ltd.

Server - Server Communication

• If a server is asked to provide themapping for a host outside it’s domain(and the mapping is not in the servercache):

 – The server finds a nameserver for thetarget domain.

 – The server asks the nameserver to providethe host name to IP translation.

• To find the right nameserver, use DNS!

Page 52: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 52/81

www.nettech.inNettech Private Ltd.

DNS Data

• DNS databases contain more than justhostname-to-address records:

 – Name server records NS

 – Hostname aliases CNAME

 – Mail Exchangers MX

 – Host Information HINFO

Page 53: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 53/81

www.nettech.inNettech Private Ltd.

The Root DNS Server

• The root server needs to know theaddress of 1st (and many 2nd) leveldomain nameservers.

edu com org jp

albanyrpi

Page 54: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 54/81

www.nettech.inNettech Private Ltd.

Server Operation

• If a server has no clue about where to findthe address for a hostname, ask the rootserver.

• The root server will tell you what

nameserver to contact.

• A request may get forwarded a few times.

Page 55: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 55/81

www.nettech.inNettech Private Ltd.

DNS Message Format

HEADER

QUERIES

Response RESOURCE RECORDS

Response AUTHORITY RECORDS

Response ADDITIONAL INFORMATION

HEADER

QUERIES

Response RESOURCE RECORDS

Response AUTHORITY RECORDS

Response ADDITIONAL INFORMATION

Page 56: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 56/81

www.nettech.inNettech Private Ltd.

DNS Message Header

• query identifier

• flags

• # of questions• # of RRs

• # of authority RRs

• # of additional RRs

Page 57: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 57/81

www.nettech.inNettech Private Ltd.

Message Flags

• QR: Query=0, Response=1

• AA: Authoritative Answer

• TC: response truncated (> 512 bytes)

• RD: recursion desired• RA: recursion available

• rcode: return code

Page 58: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 58/81

www.nettech.inNettech Private Ltd.

Recursion

• A request can indicate that recursion isdesired - this tells the server to find outthe answer (possibly by contacting otherservers).

• If recursion is not requested - theresponse may be a list of other nameservers to contact.

Page 59: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 59/81

www.nettech.inNettech Private Ltd.

Question Format

• Name: domain name (or IP address)

• Query type (A, NS, MX, …)

• Query class (1 for IP)

Page 60: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 60/81

www.nettech.inNettech Private Ltd.

Response Resource Record

• Domain Name

• Response type

• Class (IP)

• Time to live (in seconds)• Length of resource data

• Resource data

Page 61: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 61/81

www.nettech.inNettech Private Ltd.

UDP & TCP

• Both UDP and TCP are used:

 – TCP for transfers of entire database tosecondary servers (replication).

 – UDP for lookups

 – If more than 512 bytes in response - requestorresubmits request using TCP.

Page 62: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 62/81

www.nettech.inNettech Private Ltd.

Lots more

• This is not a complete description !

• If interested - look at:

 – RFC 1034: DNS concepts and facilities.

 – RFC 1035: DNS implementation and protocol

specification.

 – play with nslookup.

 – Look at code for BIND (DNS server code).

Page 63: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 63/81

www.nettech.inNettech Private Ltd.

Name to Address Conversion

• There is a library of functions that act asDNS client (resolver).

 – you don’t need to write DNS client code to useDNS!

• With some OSs you need to explicitly linkwith the DNS resolver library:-lnsl (nsl is “Name Server Library”)

Suns (Solaris) need this !

Page 64: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 64/81

www.nettech.inNettech Private Ltd.

DNS library functions

gethostbyname

gethostbyaddr

gethostbyname2

Page 65: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 65/81

www.nettech.inNettech Private Ltd.

gethostbyname

struct hostent *gethostbyname( const

char *hostname);

struct hostent is defined in netdb.h:

#include <netdb.h>

Page 66: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 66/81

www.nettech.inNettech Private Ltd.

struct hostent

struct hostent {

char *h_name;

char **h_aliases;

int h_addrtype;int h_length;

char **h_addr_list;

};

official name (canonical)

other names

AF_INET or AF_INET6

address length (4 or 16)

array of ptrs to addresses

Page 67: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 67/81

www.nettech.inNettech Private Ltd.

Which Address?

On success, gethostbyname returns theaddress of a hostent that has beencreated.

 – has an array of ptrs to IP addresses

 – Usually use the first one:

#define h_addr h_addr_list[0]

Page 68: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 68/81

www.nettech.inNettech Private Ltd.

gethostbyname and errors

• On error gethostbyname return null.

• Gethostbyname sets the global variable h_errno

to indicate the exact error: –  HOST_NOT_FOUND

 –  TRY_AGAIN

 –  NO_RECOVERY

 –  NO_DATA 

 –  NO_ADDRESS All defined in netdb.h

Getting at the address:

Page 69: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 69/81

www.nettech.inNettech Private Ltd.

Getting at the address:char **h_addr_list;

h = gethostbyname("joe.com");

sockaddr.sin_addr.s_addr =

*(h->h_addr_list[0]);

This won't work!!!!

h_addr_list[0] is a char* !

Page 70: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 70/81

www.nettech.inNettech Private Ltd.

Using memcpy

• You can copy the 4 bytes (IPv4) directly:

h = gethostbyname("joe.com");

 memcpy(&sockaddr.sin_addr,

h->h_addr_list[0],

sizeof(struct in_addr));

Page 71: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 71/81

www.nettech.inNettech Private Ltd.

Network Byte Order

• All the IP addresses returned via thehostent are in network byte order!

• Repeat after me:

"Thank you gethostbyname!"

Page 72: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 72/81

www.nettech.inNettech Private Ltd.

gethostbyaddr

struct hostent *gethostbyaddr( const

char *addr

size_t len,

int family);

Page 73: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 73/81

www.nettech.inNettech Private Ltd.

Some other functions

uname : get hostname of local host

getservbyname : get port number for a

named service

getservbyaddr : get name for service

associated with a port number

Page 74: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 74/81

www.nettech.inNettech Private Ltd.

References

• RFC 1034

• RFC 1035

Page 75: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 75/81

www.nettech.inNettech Private Ltd.

SNMP - Simple Network ManagementProtocol

Page 76: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 76/81

www.nettech.inNettech Private Ltd.

Third Question

• How does your computer know which IP touse?

• How does your computer know thatwww.nettech.in is at IP 202.144.75.66

• How can you track your network’shealth?

SNMP i

Page 77: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 77/81

www.nettech.inNettech Private Ltd.

SNMP is …

• A network management tool

 – Designed to allow data acquisition from SNMPcapable network equipment

 – Allows control of SNMP capable equipment by

the distant controller• Based on inquiry/response architecture

with simple response parameters

SNMP is

Page 78: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 78/81

www.nettech.inNettech Private Ltd.

• Used for management of fault conditions –prevention of and response to networkfailure

• Designed to manage performance –

coping with deterioration of performancedue to congestion, changing trafficconditions

SNMP is …

SNMP M P t l

Page 79: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 79/81

www.nettech.inNettech Private Ltd.

SNMP Message Protocol

• Messages use UDP, ports 161 (requests/responses) and162 (notifications)

• Message types:

 – GetRequest: request values of variablesfrom device

 – GetNextRequest: request value of variablefollowing the one supplied

 – GetResponse: return values

 – SetRequest: instruct device to set values of variables

 – Trap: from device - notify monitor /manager of value change

Page 80: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 80/81

www.nettech.inNettech Private Ltd.

To know more on SNMP

•  “Essential SNMP”, Douglas R Mauro & Kevin J Schmidt, Shroff Publishers & Distributors, Calcutta, 2001

Page 81: Dhcp DNS Snmp

7/27/2019 Dhcp DNS Snmp

http://slidepdf.com/reader/full/dhcp-dns-snmp 81/81

Connect with us at Facebook

Visit www.facebook.com/nettech.in