The Illustrated Network- P59

Thể loại: Quản trị mạng
Lượt xem: 86,129Lượt tải: 1Số trang: 10

Mô tả tài liệu

The Illustrated Network- P59:In this chapter, you will learn about the protocol stack used on the global public Internet and how these protocols have been evolving in today’s world. We’ll review some key basic defi nitions and see the network used to illustrate all of the examples in this book, as well as the packet content, the role that hosts and routers play on the network, and how graphic user and command line interfaces (GUI and CLI, respectively) both are used to interact with devices.

Tóm tắt nội dung

and even as executable code (much to the chagrin of network administrators). Base64 encoding converts a binary data stream to a sequence of “text” characters. This usually results in the size of the binary fi le growing by about 33% in terms of bytes. This is because 6 bits can indicate the numbers 0 through 63. But bytes are 8 bits, of course, at least where the Internet and TCP/IP are concerned. An Example of a MIME Message Consider a writer delivering a short story to an editor as an email attachment (been there, done that). What would the MIME headers that form the overall body of the email message look like? Well, they would resemble the following: Content-Type: multipart/mixed; boundary = "--- = _NextPart_000_027HB582.0E7E0F6" This is a message in MIME format. --- = _NextPart 000_027HB582.0E7E0F6 Content-Type: text/plain Table 21.3 MIME Content Types and Subtypes Type Subtypes text plain, richtext, tab-separated-values, html, sgml image jpeg, gif, ief, tiff, g3fax, png video mpeg, quicktime, audio basic, 32kadpcm, application octet-stream, postscript, rtf, pdf, zip, macwriteii, msword, remote-printing, EDI-X12, EDIFACT, dec-dx, dca-rft, activemessage, applefi le, mac-binhex40, news-message-id, mews-transmission, wordperfect5.1, mathematica, pgp-encrypted, pgp-signature, pgp-keys, andrew-inset, slate, set-payment, set-registration, sgml, wita, lotus-wordpro, lotus-1-2-3, lotus-organizer, ms-excel, powerbuilder-6 multipart mixed, alternative, digest, parallel, appledouble, header-set, form-data, report, voice-message, signed, encrypted message rfc822, partial, external-body, news, http, delivery-status Table 21.4 MIME Encoding Methods and Meanings Method Meaning 7bit Ordinary ASCII as used in the United States. quoted-printable Adds a few special characters and coding to ASCII text. base64 Content is mapped into a “text” package (very common). 8bit Similar to 7bit, but can include 8-bit characters. binary True binary data. x-(name) Experimental encodings must have a name starting with “x”. CHAPTER 21 SMTP and Email 549 Please take a look at the attached short story. Thanks. W --- = _NextPart_000_027HB582.0E7E0F6 Content-Type: application/msword; name = "new story.doc" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename = "new story.doc" (Lots of nonsense characters form the base64 table.) --- = _NextPart_000_027HB582.0E7E0F6 The lines in bold are the MIME headers. USING POP3 TO ACCESS EMAIL The original host-to-host SMTP did not allow for attachments, limited messages to 1000 bytes, was a purely connection-oriented application, and never imagined a world of personal computers and intermittent email checking. STMP was built for immediate email delivery to a specifi c host, sort of what we think of as instant messaging (IM) today. Email today is often delivered to mailboxes on mail servers, not directly to the end user, that is, users who might only have dial-up Internet access. FIGURE 21.8 A POP3 capture, highlighting how the email listing is sent to the user. 550 PART IV Application Level Client–Server POP3 Connection (TCP 3-way handshake and close omitted) �OK POP3 Inxserver...(etc.) �OK User name accepted, password please �OK Mailbox open, 1 message USER admin1 PASS admin11 DELE 1 QUIT STAT (SERVER) port 110 Inxserver (CLIENT) port 2447 Inxclient �OK 1 1108 �OK Mailbox scan listing follows\r\n1 1108...(etc.) �OK 1108 octets �OK Message deleted �OK Sayonara LIST RETR 1 FIGURE 21.9 A POP3 connection used to fetch email, showing a more schematic view than the capture. These intermittent Internet users log in and access their mailbox with POP3 (com- monly just called POP). POP3 does not send email: SMTP does that. But POP3 retrieves the email, and the IMAP4 protocol maintains and controls access to the mailbox accounts. POP3 uses TCP port 110, and users are authenticated by userID and password. POP3 then places a lock on the mailbox to avoid access confl icts. The POP3 server then enters transaction mode for user access to messages. POP3 features include the abil- ity to view a list of email messages and their sizes and to selectively retrieve or delete messages, but many implementations simply dump all waiting mail to the client. POP3 servers can be the same device as the SMTP mail server, but this is not a requirement. Let’s add POP3 to our network. We used the BSD hosts before, so let’s make lnxserver ( into our email server for the network. We can then compose a fairly long (1108 bytes) message and send it to user admin1. Figure 21.8 shows the sequence of packets used to retrieve the message from host lnxclient ( POP3 employs a characteristic +OK and not a code when responding normally to a client. The series of packets shown in Figure 21.8 is boiled down to its POP3 essentials in Figure 21.9. CHAPTER 21 SMTP and Email 551 Note that the retrieval of the message (RETR) by the client and its deletion from the server (DELE) are separate steps. You don’t have to delete email as you read it, of course. The +OK Sayonara is also part of the POP3 protocol implementation. HEADERS AND EMAIL We’ve mentioned email headers already and supplied some details about MIME headers (header extensions). Email has its own proper set of headers as well, and an Internet email message is little more than a sequence of headers and their values, one after the other, from the start of the email message to the end. Table 21.5 outlines the basic email header fi eld names and groups established by RFC 822. Now we have everything in place to examine the headers created when sending a short email message through our email server (lnxserver) from a client host to another user. We’ll use the admin account on lnxclient to send a message to the admin user on Table 21.5 RFC 822 Email Header Fields and Characteristics Field Group Field Name Appearance Occurrences per Message Comment Destination Address Field To: Usually present 1 Primary recipient list Cc: Optional 1 Copy recipient Bcc: Optional 1 “Blind” copy Identifi cation Fields Message-ID: Usually present 1 Unique code applied when sent In-Reply-To: Optional, normal for replies 1 Provides method to coordi- nate responses References: Optional 1 Other documents or mes- sage IDs Informational Fields Subject: Usually present 1 Topic of the message Comments: Optional Unlimited Describe message Keywords: Optional Unlimited Useful search item Origination Date Date: Mandatory 1 Date and time stamp for mail Originator Fields From: Mandatory 1 Source address of “originator” Sender: Optional 1 If different from “originator” Reply-To: Optional 1 If absent, reply goes to “from” 552 PART IV Application Level lnxserver (these are not necessarily the same users: they just share a mailbox name). Then we’ll fetch the message from the email server mailbox using the admin account, showing that we can fetch our email almost anywhere, even from the sending host. We can use the same basic mail program as we did on the BSD hosts. This time, we’ll use the –s fl ag to create a subject for the message. The text is simple, and we end our message with a single dot as before. [[email protected] admin]$ mail –s "Here is another example" [email protected] This is text… . Cc: (enter) Now we’ll use fetchmail to “fetch” the mail message with POP3 from the email server (lnxserver) and bring it back to lnxclient. Note that when we run the program and have email we get a version of the familiar “you’ve got mail” prompt. [[email protected] admin]$ fetchmail Enter password for [email protected]: (not shown) You have new mail in /var/spool/mail/admin Usually, our complete email application would display the information and the mes- sage. But there’s nothing magical about that. We can do the same with the command prompt, listing the mailbox content and displaying the email message with normal Unix commands. [[email protected] admin]$ ls –l /var/spool/mail/admin -rw------- 1 admin mail 3122 Jan 17 16:42 /var/spool/mail/admin Table 21.5 (continued) Field Group Field Name Appearance Occurrences per Message Comment Resent Fields Resent-Date: Resent-From: Resent-Sender: Resent-To: Resent-Cc: Resent-Bcc: Resent-Message-ID: Each time message is resent, this block is generated Resent-Date: and Resent- Sender: are mandatory; all others optional Special, used for forwarding an email message to others Trace Fields Received: Return-Path: Inserted by email system Unlimited Used to trace the message through the email system CHAPTER 21 SMTP and Email 553 [[email protected] admin]$ cat /var/spool/mail/admin From [email protected] Wed Jan 16 13:04:50 2008 Return-Path: <[email protected]> Received: from localhost (localhost.localdomain []) by (8.12.9/8.12.8) with ESMTP id jBGL4onD026830 for <[email protected]>; Wed, 16 Jan 2008 13:04:50 -0800 Received: from by localhost with POP3 (fetchmail-6.2.0) for [email protected] (single-drop); Wed, 16 Jan 2008 13:04:50 -0800 (PST) Received: from ([]) by (8.12.8/8.12.8) with ESMTP id jBGL4HFa027257 for <[email protected]>; Wed, 16 Jan 2008 13:04:17 -0800 (PST) Received: from (localhost.localdomain []) by (8.12.8/8.12.8) with ESMTP id jBGL4HnD026820 for <[email protected]>; Wed, 16 Jan 2008 13:04:17 -0800 Received: (from [email protected]) by (8.12.8/8.12.8/Submit) id jBGL4HHf026818 for [email protected]; Wed, 16 Jan 2008 13:04:17 -0800 Date: Wed, 16 Jan 2008 13:04:17 -0800 From: [email protected] Message-Id: <200801172104.jBGL4HHf-26818> To: [email protected] Subject: Here is another example X-IMAPbase: 1134766876 8 Status: o X-UID: 8 X-Keywords: This is text… The important fi elds are highlighted. Most of the other headers were added when the email was created, of course. Most useful is the series of Received: headers, which allows us to trace the message back to its origin. It might seem odd that there are fi ve receiver headers along the trace for a message that has gone from client to email server and then back to client. But the application adds a localhost step at each end, at the sender ([email protected]) and receiver (from localhost) to the message trace. The complete path of the message recorded in the headers (from “bottom to top”) is: 1. The mail application receives the composed message from the local user. 2. The local mailbox receives the message using ESMTP. 3. The email server receives the message using ESMTP. 554 PART IV Application Level 4. The other client retrieves the message from the email server using POP3 (fetchmail). 5. The local host transfers the message to the local mailbox using ESMTP. 6. The use of these protocols is highlighted in the headers. HOME OFFICE EMAIL Let’s end our email discussion by showing that Windows uses the same protocols and headers to send and receive email over the Internet. This time, we’ll send a mes- sage from lnxclient on the Illustrated Network to my home offi ce host (which uses Outlook). Almost all email applications have an option to view the complete headers. In Out- look, it’s just “Message Header” in the singular, but the following is the result of viewing the message headers in Outlook. Only the headers are displayed, not the message text itself. Microsoft Mail Internet Headers Version 2.0 Received: from ([]) by with Microsoft SMTPSVC(5.0.2195.6713); Thu, 17 Jan 2008 07:37:14 -0700 Received: from ([]) by over TLS secured channel with Microsoft SMTPSVC(6.0.3790.1830); Thu, 17 Jan 2008 07:37:13 -0700 Received: from ( []) by (8.11.3/8.11.3) with ESMTP id k9JEbDH15244 for <[email protected]>; Thu, 17 Jan 2008 07:37:13 -0700 (PDT) (envelope-from [email protected]) Received: from (localhost.localdomain []) by (8.12.8/8.12.8) with ESMTP id k9JEacUg026193 for <[email protected]>; Thu, 17 Jan 2008 07:36:58 -0700 Received: (from [email protected]) by (8.12.8/8.12.8/Submit) id k9JEaSlp026191 for [email protected]; Thu, 17 Jan 2008 07:36:28 -0700 Date: Thu, 17 Jan 2008 07:36:28 -0700 From: [email protected] Message-Id: <[email protected]> To: [email protected] Subject: here is an email example Return-Path: [email protected] X- OriginalArrivalTime: 17 Jan 2008 14:37:13.0230 (UTC) FILETIME=[10F80AE0: 01C6F38C] CHAPTER 21 SMTP and Email 555 This page intentionally left blank QUESTIONS FOR READERS Figure 21.10 shows some of the concepts discussed in this chapter and can be used to answer the following questions. FIGURE 21.10 POP3 session capture. 1. Which port does POP3 use? 2. Which password is provided by the user? 3. Was the email message deleted after it was retrieved? 4. How long was the message? 5. How many other messages are in the user’s mailbox? 557 Cover Contents Foreword Preface About the Author Protocols and Layers 1 TCP/IP Protocols and Devices 2 Network Link Technologies 3 IPv4 and IPv6 Addressing 4 Address Resolution Protocol 5 IPv4 and IPv6 Headers 6 Internet Control Message Protocol 7 Routing 8 Forwarding IP Packets 9 User Datagram Protocol 10 Transmission Control Protocol 11 Multiplexing and Sockets 12 Routing and Peering 13 IGPs: RIP, OSPF, and IS–IS 14 Border Gateway Protocol 15 Multicast 16 MPLS and IP Switching 17 Dynamic Host Conf guration Protocol 18 The Domain Name System 19 File Transfer Protocol 20 SMTP and Email 21 Hypertext Transfer Protocol 22 Securing Sockets with SSL 23 Simple Network Management Protocol 24 Secure Shell (Remote Access) 25 MPLS-Based Virtual Private Networks 26 Network Address Translation 27 Firewalls 28 IP Security 29 Voice over Internet Protocol 30 List of Acronyms Bibliography Index