BOOTP, DHCP : TErminaL NETwork

Aplicatii Client-Server BOOTP, DHCP, TELNET

Gabriel Ciobanu

Facultatea de Informatic˘a Universitatea A.I. Cuza, Ia¸si [email protected] Nivel Aplicatie

Dorin Huzum ([email protected]) Sinic˘aAlboaie ([email protected]) Cristian Pˆaslaru ([email protected] http://www.info.uaic.ro/∼dorin.huzum/rc

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 1 / 42 BOOTP, DHCP TELNET: TErminaL NETwork Protocoale binecunoscute la nivelul aplicatie

Nivelul aplicatie pune la dispozitie o serie de servicii Internet standard: Configurare retea (BOOTP, DHCP) Terminal la distanta (TELNET, SSH, ...) Posta electronica (SMTP, IMAP, POP,...) Transferul de fisiere (TFTP, FTP) World-Wide Web (HTTP, WWW) Conversatii instantanee (IRC, ICQ, Jabber, ...) Protocoale pentru rezolvarea unor sarcini de sistem - /etc/services, /etc/protocols Sistemul de fisiere in retea (NFS) Conectivitate cu alte sisteme de fisiere (SMB) Servicii de baze de date (MySQL, PostgreSQL, ...)

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 2 / 42 BOOTP, DHCP Static configuration: BOOTP TELNET: TErminaL NETwork Dynamic configuration: DHCP Cuprins

1 BOOTP, DHCP Static configuration: BOOTP Dynamic configuration: DHCP

2 TELNET: TErminaL NETwork

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 3 / 42 BOOTP, DHCP Static configuration: BOOTP TELNET: TErminaL NETwork Dynamic configuration: DHCP BOOTP: Bootstrap Protocol

client-server paradigm is applied to bootstrapping A host connected to an internetwork needs to know its IP address before it can send or receive Overall, a host needs to know at least the following: its IP address its subnet mask the IP address of a router the IP address of a domain name server BOOTP and DHCP make it possible to boot a machine through an IP network without using RARP both are based on UDP, and use specific formats

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 4 / 42 BOOTP, DHCP Static configuration: BOOTP TELNET: TErminaL NETwork Dynamic configuration: DHCP BOOTP: BOOTstrap Protocol

At startup, a diskless workstation has an initialization routine stored in ROM, which is the same for all machines (then its specific IP address cannot be stored in the ROM) Using RARP has at least three draw-backs: RARP is low-level network-dependent protocol, therefore using it requires access to the physical network interface The efficiency of RARP is low, the minimum-size - message is 512-bit long but only contains 32 bits of useful information (the IP address) Because RARP is based on the physical network address, it cannot be used in networks, where the address is assigned dynamically BOOTP and its extension DHCP address these problems

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 5 / 42 BOOTP, DHCP Static configuration: BOOTP TELNET: TErminaL NETwork Dynamic configuration: DHCP BOOTP

BOOTP is based on UDP, and it can be implemented without access to the hardware level BOOTP is more efficient than RARP (more information than the IP address is transferred in the message) BOOTP includes a field that makes it possible to transfer vendor-dependent information using the protocol IP address 255.255.255.255 defines a limited broadcast and it can be used without knowing ones own IP address (it can use ”0.0.0.0” as its sender address) assume that work station A sends a BOOTP request to server B, which chooses an IP address for A but cannot yet use ARP to update its own routing table In practice, B either broadcast its reply or derive the MAC address of A from the BOOTREQUEST message

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 6 / 42 BOOTP, DHCP Static configuration: BOOTP TELNET: TErminaL NETwork Dynamic configuration: DHCP BOOTP packet

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 7 / 42 BOOTP, DHCP Static configuration: BOOTP TELNET: TErminaL NETwork Dynamic configuration: DHCP BOOTP option

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 8 / 42 Table 16.1 Options for BOOTP

TCP/IP Protocol Suite 8 BOOTP, DHCP Static configuration: BOOTP TELNET: TErminaL NETwork Dynamic configuration: DHCP BOOTP client-server

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 9 / 42 BOOTP, DHCP Static configuration: BOOTP TELNET: TErminaL NETwork Dynamic configuration: DHCP Two-Step Bootstrap Procedure

BOOTP does not provide clients with a memory image; it only provides a file name. The client then uses a second protocol (tftp) to obtain the memory image. client can fill BOOT FILE NAME a generic name like “uni; t. The server consults it configuration database to map the generic name into a specific file name for client. If client fills zeros in the BOOT FILE NAME field, BOOTP selects a memory image of the machine. Clients use port 68 instead of an ephemeral port. This is because the reply from the server can be broadcast (received by all hosts). — Relay agent... Error control...

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 10 / 42 Figure 16.2 Client and server on two different networks

TCP/IP Protocol Suite 4 BOOTP, DHCP Static configuration: BOOTP TELNET: TErminaL NETwork Dynamic configuration: DHCP DHCP: Dynamic Host Configuration Protocol

BOOTP was designed for a static environment BOOTP does not apply well to portable workstations, because it only provides a static mapping from the identification of a workstation to its parameters The parameters need to be defined and stored to the config. file of the BOOTP server separately for each host If the hosts often change locations or the number of hosts exceeds the number of available IP addresses, this leads into difficulties To facilitate automatic address allocation, the IETF has defined DHCP, which extends BOOTP in two ways: The host gets all configuration information in one message The host receives its IP address fast and dynamically

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 11 / 42 BOOTP, DHCP Static configuration: BOOTP TELNET: TErminaL NETwork Dynamic configuration: DHCP DHCP: Dynamic Host Configuration Protocol

DHCP makes it possible to allocate an IP address in three ways, out of which the administrator can choose the one that best suits each network or host: Like BOOTP, DHCP allows manual configuration Automatic configuration means, that DHCP assigns a permanent IP address for a new host Dynamic configuration means, that the host leases its IP address from a common address pool when it starts Dynamic configuration is the most interesting one of these alternatives because (it allows any computer to be connected to the network without prior arrangements) If the host is attached to several networks, it has to perform DHCP separately for each network interfaces BOOTP and DHCP facilitate the from another network by using a relay agent Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 12 / 42 BOOTP, DHCP Static configuration: BOOTP TELNET: TErminaL NETwork Dynamic configuration: DHCP DHCP packet

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 13 / 42 Table 16.2 Options for DHCP

TCP/IP Protocol Suite 12 BOOTP, DHCP Static configuration: BOOTP TELNET: TErminaL NETwork Dynamic configuration: DHCP DHCP

A host becomes a DHCP client when it broadcasts the DHCPDISCOVER message to all DHCP servers of the local network Each DHCP server replies with an offer, containing configuration information and the IP address the server is offering to lease to the client, sent in a DHCPOFFER message The host chooses one of the offers and sends a DHCPREQUEST message to the respective server The server confirms the lease with a DHCPACK message A machine may terminate the lease by sending a DHCPRELEASE message The protocol logic of DHCP is presented as a state transition diagram

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 14 / 42 BOOTP, DHCP Static configuration: BOOTP TELNET: TErminaL NETwork Dynamic configuration: DHCP DHCP Transition Diagram

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 15 / 42 BOOTP, DHCP Static configuration: BOOTP TELNET: TErminaL NETwork Dynamic configuration: DHCP DHCP Exchanging Messages

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 16 / 42 BOOTP, DHCP Static configuration: BOOTP TELNET: TErminaL NETwork Dynamic configuration: DHCP DHCP Exchanging Messages

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 17 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Cuprins

1 BOOTP, DHCP

2 TELNET: TErminaL NETwork Telnet

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 18 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Telnet

a general-purpose client-server program for virtual terminal connection to a remote system such that the local terminal appears to be a terminal at the remote system

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 19 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Time-sharing environment

a large computer supports multiple users interaction user-computer is given by a terminal users have login names, passwords, and access rights to resources

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 20 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Time-sharing Environment (local login)

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 21 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Time-sharing Environment (remote login)

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 22 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Telnet

telnet client overrides the local interpretation the keys, allowing a user to interact with a remote machine exactly as one would from a locally connected terminal telnet alllows a TCP connection, and then passes keystrokes from the local keyboard directly to the remote computer as if they had been typed on a keyboard attached to remote machine pseudoterminal: impossible to build a TELNET server unless the OS supplies such a facility TELNET server at application level has advantages (easy to modify) and disadvantages (inefficiency).

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 23 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Network Virtual Terminal (NVT) characters

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 24 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork NVT character sets: data and commands

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 25 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork NVT remote control characters

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 26 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork IAC (Interpret As Control)

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 27 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Option Negotiation

To negotiate an option, either side may send one of four option requests: WILL - The sender wants to set an option. WONT - The sender wants to disable the option. DO - The sender wants the receiver to set the option. DONT - The sender wants the receiver to disable the option.

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 28 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Offer/request to enable

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 29 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Offer/request to disable

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 30 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Example of Echo option

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 31 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Suboption negotiation

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 32 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Controlling the server

Some of the control characters can be used to control the remote server.

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 33 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Control Functions

IP (interrupt process) function requests the server to abort the currently running user process. (e.g., IAC IP (255 244)); this function only terminates the running process, not the entire remote terminal session. AO (abort output) function is used when a user process on the server has generated output the user does not want to see; similar to IP function, except that AO will not abort the user process. AYT (Are you there) facility enables a user to determine whether the server is still active. EC (erase char) function is used to delete the last preceding undeleted character transmitted. EL (erase line) function is used to delete an entire line of input.

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 34 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Example of interruption

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 35 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Out-of-band signalling

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 36 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Example of interruptions

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 37 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Modes of operation

Default mode (half-duplex) echoing is done by the client client does not send until whole line is complete. Character Mode the user enters a char that is sent to the server. server ack the receiving char, and echos the char back. client ack. Line mode (full duplex w/o GA)

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 38 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Example 1

A client and a server negotiate the terminal type and terminal speed and then the server checks the login and password of the user. We use the default mode to show the concept and its deficiencies even though it is almost obsolete today.

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 39 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Example 1

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 40 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Example 2

A client switches to the character mode. This requires a client to ask the server to enable the SUPPRESS GO AHEAD and ECHO options.

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 41 / 42 BOOTP, DHCP Telnet TELNET: TErminaL NETwork Example 2

Aplicatii Client-Server BOOTP, DHCP, TELNET noiembrie 2007 42 / 42