Presentation is loading. Please wait.

Presentation is loading. Please wait.

資 管 Lee Application Layer and Client-Server Model A3.

Similar presentations


Presentation on theme: "資 管 Lee Application Layer and Client-Server Model A3."— Presentation transcript:

1 資 管 Lee Application Layer and Client-Server Model A3

2 資 管 Lee Application Layer, BOOTP, and DHCP Application Layer in TCP/IP is equivalent to the combined session, presentation, and application layers of the OSI model. IC MP IP AR P RA RP TCP UDP IG MP SM TP FTP TFT P DN S SN MP BO OTP Application layer Transport layer Network layer Data link layer Physical layer Underlying LAN or WAN technology

3 資 管 Lee 資 管 Model Client Server Client Questions: 1.Both application programs be able to request services and provide services ? 2.An application program provide services only to one specific ap.? 3.When should an application program be running? 4.Only one universal application program that can provide any type of service a user wants?

4 資 管 Lee 資 管 Concurrency in server types Server Server types 1.Connectionless iterative 2.Connectionless concurrency 3.Connection-oriented iterative 4.Connection-oriented concurrency Client UDP Ephemeral port UDP Client UDP Ephemeral port Client UDP Ephemeral port One client at a time Connectionless iterative

5 資 管 Lee 資 管 Parent server Client UDP Ephemeral port TCP Client UDP Ephemeral port Client UDP Ephemeral port Well-known port is used only for connection establishment Connection-oriented concurrent sever child server child server child server Ephemeral port

6 資 管 Lee 資 管 Program and Processes 64 xy Data Instruction pointer Data pointer Other information Process 2 (Started later) 12 xy Data Instruction pointer Data pointer Other information Process 1 (Started earlier) int main(void) { /* Declaration */ int x; int y; /* statement */ ……. …… Return (); }

7 資 管 Lee Examples of a server program ……. int main(void) { ……; pid_t pod; for (;;) { /* Connection from client 8? pid= fork(); if( pid !=0) { /* code for parent */ } else { /* code for child */ } For a fork instruction: When fork is called, it returns two values, The returned value available to the parent process is the process is the processid of the created child. The returned value available to the child process is simply 0.

8 資 管 Lee Each computer that is attached to a TCP/IP internet must know the following information: ◦ Its IP address ◦ Its subnet mask ◦ The IP address of a router ◦ The IP address of a name server Usually stored in a configuration file and accessed by the computer during the bootstrap process.

9 資 管 Lee BOOTP (Bootstrap Protocol) Op. code: request (1) reply (2) Hardware type: Ethernet (1) Hardware length: address (6) Transaction ID: client tag ID Server name: contains a null- terminated string consisting of the domain name of the server. Boot filename: in a reply packet from the server. Full name pathname of the boot file. Options: additional information (network mask or default router address. Used only in a reply message. The serer uses a number of 99.130.83.99, if present, the next 60 bytes are options. Operation code Hardware type Hardware length Hop count Transaction ID Number of seconds Unused Client IP address Your IP address Server IP address Gateway IP address Client hardware address (16bytes) Server name (optional, 64bytes) Boot file name (optional, 128 bytes) options

10 資 管 Lee 資 管 Option format Description Tag Lengt h Value Padding 0 Subnet mask 1 4 Time offset 2 4 Time of the day Default routers 3 variab le IP addresses Time servers 4 variab le IP addresses DNS servers 6 variab le IP addresses Print servers 9 variab le IP addresses Host name 12 variab le DNS name Boot file size 13 2 Integer Vendor specific 128~2 54 variab le Specific information End of list 255 Tag (0) Tag Length Value (Variable length) Tag (255)

11 資 管 Lee 資 管Operation Client Server 67 Server 67 Server 67 Client 68 Client 68 Passive open UDP Request Reply Request DPSP DASA SP: Source port (68) DP: Destination port (67) SA: Source address (All 0s) DA: Destination address (All 1s) Reply DPSP DASA SP: Source port (67) DP: Destination port (68) SA: Source address (Server unicast addr.) DA: Destination address (All 1s or client addr.)

12 資 管 Lee Operation steps: ◦ The BOOTP server uses UDP port number 67 and waits for a client. ◦ The client sends a BOOTP request message to the server. The message is encapsulated in a UDP user datagram, using the UDP port number 68. the UDP user datagram, in turn, is encapsulated in an IP datagram. The reader may ask how the client can send an IP datagram when it knows neither its own IP address nor the server’s IP address. The client uses all 0s as the source address and all 1s as the destination address. ◦ The server replies to the client with either a broadcast or a unicast message using UDP destination port 68. the unicast reply message is preferred because. UDP port for a client is well-known port 68 instead of an ephemeral port. Since the server defines the pathname of a file, client can use TFTP to obtain the rest of the needed information.

13 資 管 Lee Dynamic Host Configuration Protocol (DHCP) BOOTP is a static configuration protocol. DHCP provides dynamic configuration. It is an extension to BOOTP and is backward compatible with BOOTP. DHCP is also needed when a host move from network to network or is connected and disconnected from a network. Provides temporary IP addresses for a limited period of time. A DHCP server has two database. The first database statically binds physical addresses with IP addresses. The same type as BOOTP. DHCP has a second database with a pool of available IP addresses. When a DHCP client requests a temporary IP address, the DHCP server goes to the pool of available unused IP address, and assigned an IP address for a negotiable period of time.

14 資 管 Lee DHCP packet format DHCP format is backward compatible with BOOTP. Except: Flag. specify a forced broadcast reply. Options. Several options have been added to the list of options. And up to 312 bytes. Operation code Hardware type Hardware length Hop count Transaction ID Number of seconds FUnused Client IP address Your IP address Server IP address Gateway IP address Client hardware address (16bytes) Server name (optional, 64bytes) Boot file name (optional, 128 bytes) options

15 資 管 Lee 資 管 Option format Description Tag Lengt h Value Padding 0 Subnet mask 1 4 Time offset 2 4 Time of the day Default routers 3 variab le IP addresses Time servers 4 variab le IP addresses DNS servers 6 variab le IP addresses Print servers 9 variab le IP addresses Host name 12 variab le DNS name Boot file size 13 2 Integer Vendor specific 128~2 54 variab le Specific information End of list 255 Tag (0) Tag Length Value (Variable length) Tag (255)

16 資 管 Lee 資 管 Client Server 67 Server 67 Client 68 Passive open UDP DHCPDISCOVER Server 67 Client 68 UDP DHCPOFFER Server 67 Client 68 UDP DHCPREQUEST Server 67 Client 68 UDP DHCPACK Server 67 Client 68 UDP DHCPREQUEST Before 50 percent of lease time expires Server 67 Client 68 UDP DHCPREQUEST If the server does not respond, the request is repeated. Server 67 Client 68 UDP DHCPNACK If the server responds with a NACK, the client must start all over again. Server 67 Client 68 UDP DHCPACK If the server responds with a ACK, the client has a new lease. Server 67 Client 68 UDP DHCPRELEASE Operation in DHCP: 1.The client broadcast a DHCPDISCOVER message. 2.DHCPOFFER offer an IP address and also the duration of the lease 3.The client chooses one of the offers and sends a DHCPREQUEST message to the selected server. 4.The server responds with a DHCPACK message and creates the binding between the client physical address and its IP address. Now the client can use the IP address until the lease expires. 5.Before 50 percent of the lease period is reached, the client sends another DHCPREQUEST and asks for renewal. 6.If the server responds with a DHCPACK, the client has a new lease agreement and can reset its timer. If DHCPNACK is received, the client must stop using the IP address and to step 1. 7.If the server does not respond, the client sends another DHCPREQUEST when the lease time reaches 87.5 percent.


Download ppt "資 管 Lee Application Layer and Client-Server Model A3."

Similar presentations


Ads by Google