Ch 6: Networking Services: NAT, DHCP, DNS,

Transcription

Ch 6: NetworkingServices: NAT, DHCP, DNS,MulticastingMagda El ZarkiProf. of CSUniv. of CA, IrvineEmail: elzarki@uci.eduhttp: www.ics.uci.edu/ magda

Overivew of NAT NAT: Network Address Translation

Private Network Private IP network is an IP network that is not directlyconnected to the Internet IP addresses in a private network can be assigned arbitrarily. Not registered and not guaranteed to be globally unique Generally, private networks use addresses from the followingexperimental address ranges (non-routable addresses): 10.0.0.0 – 10.255.255.255 172.16.0.0 – 172.31.255.255 192.168.0.0 – 192.168.255.2553

Private AddressesH1H3H210.0.1.2Private network vate network 1

Network Address Translation(NAT) NAT is a router function where IP addresses (andpossibly port numbers) of IP datagrams are replaced atthe boundary of a private network NAT is a method that enables hosts on private networksto communicate with hosts on the Internet NAT is run on routers that connect private networks to thepublic Internet, to replace the IP address-port pair of anIP packet with another IP address-port pair.5

Basic operation of NATPrivatenetworkSourceDestination 10.0.1.2 213.168.112.3SourceDestinationNATdeviceprivate address: 10.0.1.2public address: 128.143.71.21H1InternetSourceDestination 213.168.112.3 10.0.1.2public ss10.0.1.2128.143.71.21 NAT device has address translation table One to one address translation6 128.143.71.21 213.168.112.3213.168.112.3 213.168.112.3 128.143.71.21H5

Pooling of IP addresses Scenario: Corporate network has many hosts but only asmall number of public IP addresses NAT solution: Corporate network is managed with a private address space NAT device, located at the boundary between the corporatenetwork and the public Internet, manages a pool of public IPaddresses When a host from the corporate network sends an IPdatagram to a host in the public Internet, the NAT devicepicks a public IP address from the address pool, and bindsthis address to the private address of the host7

Pooling of IP addressesPrivatenetworkInternetSource 10.0.1.2Destination 213.168.112.3private address:public address:Source 128.143.71.21Destination 213.168.112.3NATdevice10.0.1.2public address: .2Pool of addresses: 128.143.71.0-128.143.71.307

Supporting migration between network serviceproviders Scenario: In CIDR, the IP addresses in a corporate network areobtained from the service provider. Changing the service providerrequires changing all IP addresses in the network. NAT solution: Assign private addresses to the hosts of the corporate network NAT device has static address translation entries which bind theprivate address of a host to the public address. Migration to a new network service provider merely requires anupdate of the NAT device. The migration is not noticeable to thehosts on the network.Note: The difference to the use of NAT with IP address pooling is thatthe mapping of public and private IP addresses is static.9

Supporting migration between network private address:public address: 10.0.1.2 .143.71.21ISP 1allocates address block128.143.71.0/24 to ork10 128.143.71.21 Address10.0.1.2128.143.71.21128.195.4.120 128.195.4.120 213.168.112.3ISP 2allocates address block128.195.4.0/24 to privatenetwork:

IP masquerading Also called: Network address and port translation(NAPT), port address translation (PAT). Scenario: Single public IP address is mapped to multiplehosts in a private network. NAT solution: Assign private addresses to the hosts of the corporatenetwork NAT device modifies the port numbers for outgoing traffic11

IP masqueradingSource 10.0.1.2Source port 2001Source 128.143.71.21Source port 2100private address: 10.0.1.2H1Private networkNATdevice128.143.71.21private address: 10.0.1.3H212Source 10.0.1.3Source port 71.21/4444 128.143.71.21 4444Internet

Load balancing of servers Scenario: Balance the load on a set of identical servers,which are accessible from a single IP address NAT solution: Here, the servers are assigned private addresses NAT device acts as a proxy for requests to the server fromthe public network The NAT device changes the destination IP address ofarriving packets to one of the private addresses for a server A sensible strategy for balancing the load of the servers is toassign the addresses of the servers in a round-robin fashion.13

Load balancing of serversPrivate network10.0.1.2S1SouDes rcetination 12 10 8.195.4.12.0.10.2NATdeviceSourceDestination 128.195.4.120 128.143.71.21SourceDestination 213.168.12.3 .4S314rcenSou tinatiosDe204.195.1.28 1 .0.1.401 Inside networkOutside 21213.168.12.3

Concerns about NAT Performance: Modifying the IP header by changing the IP address requiresthat NAT boxes recalculate the IP header checksum Modifying port number and IP address requires that NATboxes recalculate TCP and UDP checksum (pseudo header) Fragmentation Care must be taken that a datagram that is fragmentedbefore it reaches the NAT device, is not assigned a differentIP address or different port numbers for each of thefragments.15

Concerns about NAT End-to-end connectivity: NAT destroys universal end-to-end reachability of hosts onthe Internet. A host in the public Internet often cannot initiatecommunication to a host in a private network. The problem is worse, when two hosts that are in a privatenetwork need to communicate with each other.16

Concerns about NAT IP address in application data: Applications that carry IP addresses in the payload of theapplication data generally do not work across a privatepublic network boundary. Some NAT devices inspect the payload of widely usedapplication layer protocols and, if an IP address is detectedin the application-layer header or the application payload,translate the address according to the address translationtable.17

Overview of DHCP DHCP – Dynamic Host Control Protocol

Dynamic Assignment of IPaddresses Dynamic assignment of IP addresses is desirable forseveral reasons: IP addresses are assigned on-demand Avoid manual IP configuration Support mobility of laptops19

DHCP Message TypesValueMessage E5DHCPACK6DHCPNAK7DHCPRELEASE8DHCPINFORM20

Message Types DHCPDISCOVER: Broadcast by a client to find available DHCPservers." DHCPOFFER: Response from a server to a DHCPDISCOVER andoffering IP address and other parameters." DHCPREQUEST: Message from a client to servers that does one ofthe following:" Requests the parameters offered by one of the servers anddeclines all other offers." Verifies a previously allocated address after a system or networkchange (a reboot for example)." Requests the extension of a lease on a particular address.21

Contd. DHCPACK: Acknowledgement from server to client with parameters, includingIP address." DHCPNACK: Negative acknowledgement from server to client, indicating thatthe client's lease has expired or that a requested IP address is incorrect." DHCPDECLINE: Message from client to server indicating that the offeredaddress is already in use." DHCPRELEASE: Message from client to server canceling remainder of a leaseand relinquishing network address." DHCPINFORM: Message from a client that already has an IP address(manually configured for example), requesting further configuration parametersfrom the DHCP server.22

Client Server Interactions The client broadcasts a DHCPDISCOVER message on its localphysical subnet. " The DHCPDISCOVER message may include some options suchas network address suggestion or lease duration." Each server may respond with a DHCPOFFER message that includesan available network address (your IP address) and otherconfiguration options." The servers record the address as offered to the client to preventthe same address being offered to other clients in the event offurther DHCPDISCOVER messages being received before the firstclient has completed its configuration.23

DHCP Interaction (simplified)Argon00:a0:24:71:e4:44DHCP ServerDHCP Request00:a0:24:71:e4:44Sent to 44DHCP ServerDHCP Response:IP address: 128.143.137.144Default gateway: 128.143.137.1Netmask: 255.255.0.024

Contd. T\If the client receives one or more DHCPOFFER messagesfrom one or more servers. " The client chooses one based on the configurationparameters offered and broadcasts a DHCPREQUESTmessage that includes the server identifier option to indicatewhich message it has selected and the requested IPaddress option, taken from your IP address in the selectedoffer." In the event that no offers are received, if the client hasknowledge of a previous network address, the client mayreuse that address if its lease is still valid, until the leaseexpires.25

DHCP OperationDHCP Client00:a0:24:71:e4:44DHCP ServerDHCPDISCOVER DCHP DISCOVERSent to 255.255.255.255DHCP ServerDHCP Client00:a0:24:71:e4:44 DCHP OFFERDHCPOFFERDHCP ServerDHCPOFFERDHCP Server26

Contd. The servers receive the DHCPREQUEST broadcast from the client. " Those servers not selected by the DHCPREQUEST message usethe message as notification that the client has declined thatserver's offer. " The server selected in the DHCPREQUEST message commitsthe binding for the client to persistent storage and responds with aDHCPACK message containing the configuration parameters forthe requesting client.27

DHCP OperationDHCP Client00:a0:24:71:e4:44DHCP ServerDHCPREQUEST DCHP REQUESTDHCPACKAt this time, the DHCPclient can start to use the IPaddressDHCP ServerDHCP Client00:a0:24:71:e4:44 Renewing a Lease (sentwhen 50% of lease hasexpired) If DHCP server sendsDHCPNACK, then addressis released when timerexpires28DHCP ServerDHCPREQUESTDHCPACKDHCP Server

Contd. The combination of client hardware and assignednetwork address constitute a unique identifier for theclient's lease and are used by both the client and serverto identify a lease referred to in any DHCP messages. " The your IP address field in the DHCPACK messages isfilled in with the selected network address.29

Contd. The client receives the DHCPACK message with configurationparameters. " The client performs a final check on the parameters, forexample with ARP for allocated network address, and notesthe duration of the lease and the lease identification cookiespecified in the DHCPACK message. At this point, the clientis configured." If the client detects a problem with the parameters in theDHCPACK message (the address is already in use on thenetwork, for example), the client sends a DHCPDECLINEmessage to the server and restarts the configurationprocess.30

Contd. The client should wait a minimum of ten seconds beforerestarting the configuration process to avoid excessive networktraffic in case of looping." On receipt of a DHCPDECLINE, the server must mark theoffered address as unavailable (and possibly inform the systemadministrator that there is a configuration problem)." If the client receives a DHCPNAK message, the client restartsthe configuration process.31

Contd. The client may choose to relinquish its lease on anetwork address by sending a DHCPRELEASE messageto the server." The client identifies the lease to be released by includingits network address and its hardware address."32

DHCP OperationDHCP Client00:a0:24:71:e4:44DHCP ServerDHCPRELEASE DCHP RELEASEAt this time, the DHCPclient has released the IPaddress33DHCP Server

Lease Renewal When a server sends the DHCPACK to a client with IP addressand configuration parameters, it also registers the start of thelease time for that address. This lease time is passed to the client as one of the options inthe DHCPACK message, together with two timer values, T1and T2. The client is rightfully entitled to use the given address for theduration of the lease time.34

Contd. On applying the receive configuration, the client also starts thetimers T1 and T2. At this time, the client is in the BOUND state. Times T1 and T2 are options configurable by the server but T1must be less than T2, and T2 must be less than the lease time. According to RFC 2132, T1 defaults to (0.5 * lease time) andT2 defaults to (0.875 * lease time).35

Contd. When timer T1 expires, the client will send a DHCPREQUEST(unicast) to the server that offered the address, asking to extend thelease for the given configuration. The client is now in the RENEWINGstate" The server would usually respond with a DHCPACK messageindicating the new lease time, and timers T1 and T2 are reset at theclient accordingly." The server also resets its record of the lease time. " Under normal circumstances, an active client would continually renewits lease in this way indefinitely, without the lease ever expiring.36

Contd. If no DHCPACK is received until timer T2 expires, theclient enters the REBINDING state." Client now broadcasts a DHCPREQUEST message toextend its lease. " This request can be confirmed by a DHCPACK messagefrom any DHCP server on the network."37

Contd. If the client does not receive a DHCPACK message afterits lease has expired, it has to stop using its current TCP/IP configuration. " The client may then return to the INIT state, issuing aDHCPDISCOVER broadcast to try and obtain any validaddress."38

DHCP Pros It relieves the network administrator of a great deal of manualconfiguration work. " The ability for a device to be moved from network to network and toautomatically obtain valid configuration parameters for the currentnetwork can be of great benefit to mobile users." Because IP addresses are only allocated when clients are actuallyactive, it is possible, by the use of reasonably short lease times andthe fact that mobile clients do not need to be allocated more than oneaddress, to reduce the total number of addresses in use in anorganization.39

DHCP Cons Uses UDP, an unreliable and insecure protocol. DNS cannot be used for DHCP configured hosts.40

Overview of DNSDNS – Domain Name Service41

Outline What is DNS? What services does it provide? How does it operate? Message format Types of messages42

What is DNS? DNS is a host name to IP address translation service DNS is a distributed database implemented in a hierarchy ofname servers an application level protocol for message exchangebetween clients and servers43

Why DNS? It is easier to remember a host name than itis to remember an IP address. A name has more meaning to a user than a4 byte number. Applications such as FTP, HTTP, email, etc.,all require the user to input a destination. The user generally enters a host name. The application takes the host namesupplied by the user and forwards it to DNSfor translation to an IP address.44

How does it work? DNS works by exchanging messages between clientand server machines. A client application will pass the destination hostname to the DNS process (in Unix referred to as thegethostbyname() routine) to get the IP address. The application then sits and waits for the responseto return.45

Distributed, Hierarchical DatabaseRoot DNS Serverscom DNS serversyahoo.comamazon.comDNS servers DNS serversorg DNS serverspbs.orgDNS serversedu DNS serverspoly.eduumass.eduDNS serversDNS serversClient wants IP for www.amazon.com; 1st approx: client queries a root server to find “com” DNS server client queries “com” DNS server to get “amazon.com”DNS server client queries “amazon.com” DNS server to get IPaddress for “www.amazon.com”46

DNS: Root name servers contacted by local name server that cannot resolve name root name server: contacts authoritative name server if name mapping not known gets mapping returns mapping to local name serverVerisign Dulles, VACogent Comm. Herndon, VAU Maryland College Park, MDUS DoD Vienna, VAARL Aberdeen, MDVerisignRIPE LondonAutonomica, StockholmWIDE TokyoNASA Mt View, CAInternet Systems Consortium. Palo Alto, CA13 root nameserver operatorsworldwideUSC-ISI Marina del Rey, CAICANN Los Angeles, CA49

TLD and Authoritative Servers Top-level domain (TLD) servers: responsible for com, org, net, edu, etc, and alltop-level country domains uk, fr, ca, jp. Network Solutions maintains servers for comTLD Educause for edu TLD Authoritative DNS servers: organizationʼs DNS servers, providingauthoritative hostname to IP mappings fororganizationʼs servers (e.g., Web, mail). can be maintained by organization or serviceprovider50

Local Name Server does not strictly belong to hierarchy each ISP (residential ISP, company, university) hasone. also called “default name server” when host makes DNS query, query is sent to itslocal DNS server acts as proxy, forwards query into hierarchy51

DNS Queries Recursive: The client machine sends a request to the local nameserver, which, if it does not find the address in itsdatabase, sends a request to the root name server,which, in turn, will route the query to an intermediateor authoritative name server. Note that the root nameserver can contain some hostname to IP addressmappings. The intermediate name server always knowswho the authoritative name server is.52

DNS name resolution example Host at cis.poly.eduwants IP addressfor:gaia.cs.umass.edulocal DNSserverroot DNSserver23dns.poly.edurecursive query: puts burden ofname resolution oncontacted rootname server heavy loadTLD DNSserver675148authoritative DNS serverdns.cs.umass.edurequesting hostcis.poly.edugaia.cs.umass.edu53

DNS Queries (contʼd) Iterative: The local server queries the root server. If address notin its database, will have the name/address of anintermediate or authoritative name server and forwardthat information to the local name server so that it candirectly communicate with the intermediate orauthoritative name server. This is to prevent theoverloading of the root servers that handle millions ofrequests.54

DNS name resolution exampleroot DNSserver Host at cis.poly.eduwants IP address forgaia.cs.umass.edu234local DNS serverTLD DNSserver5dns.poly.eduiterated query: contacted serverreplies with name ofserver to contact- “I don’t know thisname, but ask thisserver”18requesting host76authoritative .edu55

DNS: caching and updatingrecords once (any) name server learns mapping, itcaches mapping cache entries timeout (disappear) after some time TLD servers typically cached in local name servers Thus root name servers not often visited update/notify mechanisms under design byIETF RFC 2136 tml56

Operation of DNS The DNS data is stored in the database in the formof resource records (RR). The RRs are directlyinserted in the DNS messages. The RRs are a 4 tuple that consist of: {name, value,type, TTL}.57

RRs TTL: time to live, used to indicate when an RR canbe removed from the DNS cache. Type A - then NAME is a hostname and Value its IP address NS - then NAME is a domain name and Value is the IPaddress of an authoritative name server CNAME - then NAME is an alias for a host and Value is thecanonical name for the host MX - then NAME is an alias for an email host and Value isthe the canonical name for the email server58

DNS recordsDNS: distributed db storing resource records (RR)RR format:(name, value, type, ttl)o Type A!o name is hostname!o value is IP address!o Type CNAME!o name is alias name forsome “canonical” (thereal) name, eg.,www.ibm.com is reallyservereast.backup2.ibm.com!o Type NSo name is domain (eg.,foo.com)o value is hostname ofauthoritative nameserver for this domainvalue is canonical name!oo Type MX!o value is name ofmailserver associatedwith name!59

Summary DNS provides a mechanism for maintaining the userfriendliness of the Internet by hiding some of theoperational details. DNS servers have to be created manually. Recentlyan update protocol was introduced that allows DNSto exchange data for additions and deletions.60

IP Multicasting61

Multicasting Multicast communications refers to one-to-many or stIP Multicasting refers to the implementation of multicast communication in the Internet62

Multicasting over a PacketNetwork Without support for multicast at the network layer:Multiple copiesof the samemessage istransmitted onthe same link63

Multicasting over a PacketNetwork With support for multicast at the network layer: Requires a set of mechanisms:64(1) Packet forwarding can send multiplecopies of same packet(2) Multicast routing algorithm which buildsa spanning tree (dynamically)

Semantics of IP MulticastIP multicast works as follows: Multicast groups are identified by IP addresses in the range224.0.0.0 - 239.255.255.255 (class D address) Every host (more precisely: interface) can join and leave amulticast group dynamically no access control Every IP datagram sent to a multicast group is transmitted toall members of the group The IP Multicast service is unreliable65

The IP Protocol Stack IP Multicasting only supports UDP as higher layer There is no multicast TCP !User LayerSocket LayerStream SocketsDatagram SocketsTCPUDPIPNetwork Interface66Multicast SocketsIP Multicast

Multicast Addressing All Class D addresses are multicast addresses:1 1 1 0Class Dmulticast group id28 bitsClassFromToD224.0.0.0239.255.255.255 Multicast addresses are dynamically assigned. An IP datagram sent to a multicast address is forwarded to everyonewho has joined the multicast group If an application is terminated, the multicast address is (implicitly)released.67

Types of Multicast addresses The range of addresses between 224.0.0.0 and 224.0.0.255,inclusive, is reserved for the use of routing protocols and otherlow-level topology discovery or maintenance protocols Multicast routers should not forward any multicast datagram withdestination addresses in this range. Examples of special and reserved Class D l systems on this subnetAll routers on this subnetNTP (Network Time Protocol)RIP-2 (a routing protocol)

Multicast Address Translation In Ethernet MAC addresses, a multicast address is identified bysetting the lowest bit of the “most left byte”-------1 -------- -------- -------- -------- --------Not all Ethernet cards can filter multicast addresses in hardwareThen: Filtering is done in software by device driver.69

Multicast Address MappingIdentifesClass DEthernet Addresseswith 01:00:5e in thefirst 3 bytes arereserved for IPmulticastIgnored23-bitaddress1110xxxx x------- -------- --------00000001 00000000 01011110 0------- -------- --------70Class DIP AddressEthernetAddress

IGMP The Internet Group Management Protocol (IGMP) is a simpleprotocol for the support of IP multicast. IGMP is defined in RFC 1112. IGMP operates on a physical network (e.g., single EthernetSegment. IGMP is used by multicast routers to keep track ofmembership in a multicast group. Support for: Joining a multicast group Query membership Send membership reports71

6 Basic operation of NAT NAT device has address translation table One to one address translation H