Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 20071 DHCP, DNS, SNMP Debashis Saha MIS Group, IIM Calcutta

Similar presentations


Presentation on theme: "Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 20071 DHCP, DNS, SNMP Debashis Saha MIS Group, IIM Calcutta"— Presentation transcript:

1 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 20071 DHCP, DNS, SNMP Debashis Saha MIS Group, IIM Calcutta ds@iimcal.ac.in

2 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 20072 First Question How does your computer know which IP to use? How does your computer know that www.iimcal.ac.in is at IP 202.54.116.3? How can you track your network’s health?

3 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 20073 The Internet and Addressing All machines on the Internet are accessed via their 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 text based representation of machine addresses instead of just 4 numbers

4 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 20074 Addressing Solutions Two protocols have been developed to solve these problems –DHCP – automatic network configuration (including IP address) –DNS – translates textual based names into IP addresses and vice versa

5 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 20075 DHCP – Dynamic Host Configuration Protocol

6 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 20076 DHCP Allows client machines to receive an IP address, DNS information, etc automatically Before DHCP came into use, users had to type in all this information by hand, which is 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

7 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 20077 Purpose of DHCP From RFC-2131 (the Internet standard): The Dynamic Host Configuration Protocol (DHCP) provides a framework for passing configuration 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.

8 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 20078 DHCP functional goals A host without a valid IP address locates and communicates with a DHCP server A DHCP server passes configuration parameters, including an IP address, to the host The DHCP server may dynamically allocate addresses to hosts and reuse addresses Hosts can detect when they require a new IP address Unavailability of DHCP server has minimal effect on operation of hosts

9 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 20079 DHCP: Basics A client leases an IP address from a DHCP server for a given amount of time When lease expires, the client must ask DHCP server for a new address (clients attempt to renew lease after 50% of the lease time has expired) Typical leases may last for from 30 seconds to 24 hours, or even longer.

10 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200710 What does DHCP do? Provides protocol stack, application and other configuration parameters to hosts Eliminates need for individual, manual configuration for hosts Includes administrative controls for network administrators Backward compatible packet format for BOOTP interoperation (RFC 1542) Can coexist with hosts that have pre- assigned IP addresses and hosts that do not participate in DHCP

11 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200711 Design Goals Eliminate manual configuration of hosts Prevent use of any IP address by more than 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 host whenever possible

12 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200712 What can you do with DHCP Plug-and-play Move desktop PCs between offices Renumber Other restructuring - change subnet masks Mobile IP - laptops Moving equipment - cartable

13 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200713 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

14 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200714 DHCP: Messages Overview Several messages are sent back and forth between a client and the DHCP server before it can successfully obtain an IP address

15 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200715 DHCP: DISCOVER Hardcoding the addresses of DHCP servers kind of defeats the purpose of automatic configuration Solution: A client using DHCP will broadcast a DISCOVER message to all computers on its subnet (addr 255.255.255.255) to figure out the IP address of any DHCP servers Most routers are configured to pass this request within the campus or enterprise

16 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200716 DHCP: OFFER (Optionally) sent from server in response to a DISCOVER Contains an IP address, other configuration information as well (subnet mask, DNS servers, default gateway, search domains, etc) Note that all DHCP servers that receive a DISCOVER request may send an OFFER; –since a client typically does not need more than one IP address, more messages needed to zero on one IP

17 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200717 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 a reboot This message is broadcast Most OSs by default will send a REQUEST for the first OFFER they receive – this means that if there is a rogue DHCP server on your subnet, most clients will ignore the OFFERs from the campus DHCP servers (since the OFFER from the rogue server gets to the user’s PC first)!

18 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200718 DHCP: ACK/NACK Sent by server in response to a REQUEST ACK: Request accepted, client can start using the IP it REQUESTed NACK: Something is wrong with the client’s REQUEST (for example they requested an IP address they’re not supposed to have)

19 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200719 DHCP: RELEASE Sent by client to end a lease Not strictly required, but is the “polite” thing to do if done with the IP (could just let the lease expire) Some clients may not send RELEASEs in an attempt to keep the same IP address for as long as possible

20 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200720 DHCP: Big Picture

21 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200721 Summary DHCP works today as a tool for automatic configuration of TCP/IP hosts It is an open Internet standard and interoperable client implementations are widely available Provides automation for routine configuration tasks, once network architect has configured network and addressing plan Ongoing work will extend DHCP with authentication, DHCP-DNS interaction and inter-server communication

22 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200722 DHCP: Conclusion Efficient way of assigning computers IP addresses and delivering configuration information to those computers Does not solve other problem of addressing – that IP addresses are hard to remember

23 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200723 IETF standards Formal process for development, review and acceptance of TCP/IP protocol suite standards Initial specifications published as Internet Drafts (I-Ds) Accepted specifications published as Request for Comments (RFCs)

24 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200724 Protocol status DHCP has been accepted as a Draft Standard; the specifications are published in: –RFC 2131: Dynamic Host Configuration Protocol –RFC 2132: DHCP Options and BOOTP Vendor Extensions Several additional options are in development

25 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200725 Implementation status DHCP is an open standard, with freely available specifications Can be (and has been) implemented entirely from the specification Commercial implementations are widely available Non-commerical implementations are also available

26 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200726 DHCP Resources Compilation of DHCP-related WWW links and other information: http://www.dhcp.org DHCP FAQ (maintained by John Wobus) dhcp-v4@bucknell.edu mailing list (admin requests to listserv@bucknell.edu ) listserv@bucknell.edu IETF information can be retrieved from: http://www.ietf.cnri.reston.va.us I-Ds and RFCs can also be retrieved from: http://www.rfc-editor.org

27 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200727 DNS – Domain Name System

28 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200728 Second Question How does your computer know which IP to use? How does your computer know that www.iimcal.ac.in is at IP 202.54.116.3? How can you track your network’s health?

29 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200729 Domain Name System (DNS) The first IP networks distributed host files on a regular basis –This became a burden and an automated distributed solution was needed IP Addresses are great for computers –IP address includes information used for routing. IP addresses are tough for humans to remember. IP addresses are impossible to guess. –ever guessed at the name of a WWW site?

30 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200730 Hostnames DNS is born Domain names comprise a hierarchy so that names are unique, yet easy to remember. The domain name system is usually used to translate a host name into an IP address. –Ex: www.xxx.org IP 212.87.7.181 (which one would you rather remember?)

31 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200731 DNS: Basics Hierarchical namespace Distributed system – very few core servers Stores other information than simple hostname IP mappings Request/response protocol

32 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200732 DNS Hierarchy educomorgin rpialbany ac iimcal

33 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200733 Host name structure Each host name is made up of a sequence of labels separated by periods. –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

34 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200734 Domain Name The domain name for a host is the sequence of labels that lead from the host (leaf node in the naming tree) to the top of the worldwide naming tree. A domain is a subtree of the worldwide naming tree.

35 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200735 Hierarchical Naming comedugovmilnetorgus arpa colordao cs foobar foobar.cs.colorado.edu

36 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200736 Top level domains edu, gov, com, net, org, mil, … Countries each have a top level domain (2 letter domain name). –Such as.in,.uk,.it, etc. New top level domains include:.aero.biz.coop.info.name.pro

37 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200737 Domain Naming System educom harvard … mit hbsee www physics cisco … yahoonasa … nsfarpa … navyacm … ieee govmilorgnetukfr

38 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200738 DNS: Architecture DNS servers are responsible for one or more domains of any level “Root servers” are maintained throughout the world (one is in Palo Alto) and are responsible for all 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 subdomain maintain (or outsource) their own DNS servers containing the correct information

39 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200739 Name Servers Partition hierarchy into zones educom princeton … mit csee ux01ux04 physics cisco … yahoonasa … nsfarpa … navyacm … ieee govmilorgnetukfr Root name server Princeton name server Cisco name server CS name server EE name server … … Each zone implements two or more name servers 1.Primary 2.secondary

40 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200740 Hierarchical Administration - “Zones” arpacomingovmilnetorgus arpa ac iimcal www www.iimcal.ac.in

41 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200741 Administration - Zones A zone is a subtree of the DNS tree that is independently managed –Second-level domains (“ac.in”) are usually an independent zone –Most sub-domains (“iimcal.ac.in”) are also independent. A zone must provide multiple name servers. This server records the members in the domain. –You typically need a primary name server and one or more secondary name servers. –Secondary retrieves information from primary using a zone transfer.

42 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200742 Resolving an address A.C.D wants to know about F.E.D A C D E GBF H Host “A.C.D” asks “B.C.D” (the local name server) to resolve “F.E.D” Name servers

43 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200743 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 primary domain 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”

44 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200744 Domain servers What kind of records can be requested 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 a certain type from a server

45 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200745 DNS Organization Distributed Database –The organization that owns a domain name is responsible for running a DNS server that can provide the mapping between hostnames within the domain to IP addresses. –So - some machine run by RPI is responsible for everything within the rpi.edu domain.

46 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200746 rpi.edu DNS DB rpi.edu DNS DB DNS Distributed Database There is one primary server for a domain, and typically a number of secondary servers containing replicated databases. rpi.edu DNS DB Authoritative rpi.edu DNS DB Replicas rpi.edu DNS server

47 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200747 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 DNS servers for that domain.

48 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200748 /etc/resolv.conf domain rpi.edu 128.113.1.5 128.113.1.3

49 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200749 nslookup nslookup is an interactive resolver that allows the user to communicate directly with a DNS server. nslookup is usually available on Unix workstations. ( dig and host are also DNS clients).

50 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200750 DNS Servers Servers handle requests for their domain directly. Servers handle requests for other domains by contacting remote DNS server(s). Servers cache external mappings.

51 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200751 Server - Server Communication If a server is asked to provide the mapping for a host outside it’s domain (and the mapping is not in the server cache): –The server finds a nameserver for the target domain. –The server asks the nameserver to provide the host name to IP translation. To find the right nameserver, use DNS!

52 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200752 DNS Data DNS databases contain more than just hostname-to-address records: –Name server recordsNS –Hostname aliases CNAME –Mail ExchangersMX –Host InformationHINFO

53 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200753 The Root DNS Server The root server needs to know the address of 1st (and many 2nd) level domain nameservers. educomorgjp albany rpi

54 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200754 Server Operation If a server has no clue about where to find the address for a hostname, ask the root server. The root server will tell you what nameserver to contact. A request may get forwarded a few times.

55 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200755 DNS Message Format

56 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200756 DNS Message Header query identifier flags # of questions # of RRs # of authority RRs # of additional RRs 16 bit fields Response }

57 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200757 Message Flags QR: Query=0, Response=1 AA: Authoritative Answer TC: response truncated (> 512 bytes) RD: recursion desired RA: recursion available rcode: return code

58 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200758 Recursion A request can indicate that recursion is desired - this tells the server to find out the answer (possibly by contacting other servers). If recursion is not requested - the response may be a list of other name servers to contact.

59 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200759 Question Format Name: domain name (or IP address) Query type (A, NS, MX, …) Query class (1 for IP)

60 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200760 Response Resource Record Domain Name Response type Class (IP) Time to live (in seconds) Length of resource data Resource data

61 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200761 UDP & TCP Both UDP and TCP are used: –TCP for transfers of entire database to secondary servers (replication). –UDP for lookups –If more than 512 bytes in response - requestor resubmits request using TCP.

62 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200762 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).

63 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200763 Name to Address Conversion There is a library of functions that act as DNS client (resolver). –you don’t need to write DNS client code to use DNS! With some OSs you need to explicitly link with the DNS resolver library: -lnsl ( nsl is “Name Server Library”) Suns (Solaris) need this!

64 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200764 DNS library functions gethostbyname gethostbyaddr gethostbyname2 IPV6!

65 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200765 gethostbyname struct hostent *gethostbyname( const char *hostname); struct hostent is defined in netdb.h: #include

66 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200766 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

67 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200767 hostent picture h_name h_aliases h_addrtype h_length h_addr_list Official Name alias 1 alias 2 null IP address 1 IP address 2 null

68 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200768 Which Address? On success, gethostbyname returns the address of a hostent that has been created. –has an array of ptrs to IP addresses –Usually use the first one: #define h_addr h_addr_list[0]

69 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200769 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

70 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200770 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* !

71 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200771 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));

72 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200772 Network Byte Order All the IP addresses returned via the hostent are in network byte order! Repeat after me: "Thank you gethostbyname !"

73 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200773 gethostbyaddr struct hostent *gethostbyaddr( const char *addr size_t len, int family); AF_INET (could be AF_INET6) sizeof(struct in_addr)

74 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200774 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

75 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200775 References RFC 1034 RFC 1035

76 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200776 SNMP - Simple Network Management Protocol

77 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200777 Third Question How does your computer know which IP to use? How does your computer know that www.iimcal.ac.in is at IP 202.54.116.3? How can you track your network’s health?

78 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200778 SNMP is … A network management tool –Designed to allow data acquisition from SNMP capable network equipment –Allows control of SNMP capable equipment by the distant controller Based on inquiry/response architecture with simple response parameters

79 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200779 Used for management of fault conditions – prevention of and response to network failure Designed to manage performance – coping with deterioration of performance due to congestion, changing traffic conditions SNMP is …

80 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200780 SNMP Message Protocol Messages use UDP, ports 161 (requests/responses) and 162 (notifications) Message types: –GetRequest: request values of variables from device –GetNextRequest: request value of variable following the one supplied –GetResponse: return values –SetRequest: instruct device to set values of variables –Trap: from device - notify monitor / manager of value change

81 Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 200781 To know more on SNMP “Essential SNMP”, Douglas R Mauro & Kevin J Schmidt, Shroff Publishers & Distributors, Calcutta, 2001


Download ppt "Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, 20071 DHCP, DNS, SNMP Debashis Saha MIS Group, IIM Calcutta"

Similar presentations


Ads by Google