Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Cisco Press CCNA ICND 2004 - Cisco Press.pdf
Скачиваний:
122
Добавлен:
24.05.2014
Размер:
13.19 Mб
Скачать

Miscellaneous TCP/IP Topics 285

Example 8-5 Secondary IP Addressing Configuration and the show ip route Command on Yosemite

! Excerpt from show running-config follows...

Hostname Yosemite ip domain-lookup

ip name-server 10.1.1.100 10.1.2.100 interface ethernet 0

ip address 10.1.7.252 255.255.255.0 secondary ip address 10.1.2.252 255.255.255.0

interface serial 0

ip address 10.1.128.252 255.255.255.0 interface serial 1

ip address 10.1.129.252 255.255.255.0

Yosemite# show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR

P - periodic downloaded static route

Gateway of last resort is not set

10.0.0.0/24 is subnetted, 4 subnets

C10.1.2.0 is directly connected, Ethernet0

C10.1.7.0 is directly connected, Ethernet0

C10.1.129.0 is directly connected, Serial1

C10.1.128.0 is directly connected, Serial0 Yosemite#

The router has routes to subnets 10.1.2.0/24 and 10.1.7.0/24, so it can forward packets to each subnet. The router also can receive packets from hosts in one subnet and can forward them to the other subnet using the same interface.

FTP and TFTP

File Transfer Protocol (FTP) and Trivial File Transfer Protocol (TFTP) are two popularly used file transfer protocols in a typical IP network. Most end users use FTP, but Cisco router and switch administrators often use TFTP. Which is “better” depends partially on what is being done. A more important question might be, “Which is supported on the devices that need to transfer the file?” Given the choice today, most end users choose FTP because it has more robust features. However, Cisco IOS software did not originally support FTP for moving files in and out of the router, so many people continue to use TFTP out of habit.

286 Chapter 8: Advanced TCP/IP Topics

FTP

FTP is a TCP-based application that has many options and features, including the capability to change directories, list files using wildcard characters, transfer multiple files with a single command, and use a variety of character sets or file formats. More important in this context is the basic operation of FTP. Figures 8-16 and 8-17 show a typical FTP connection—or, better stated, connections.

Figure 8-16 FTP Control Connection

SYN, DPORT=21, SPORT=1030, No Data

SYN, ACK, DPORT=1030, SPORT=21, No Data

ACK, DPORT=21, SPORT=1030, No Data

FTP Client

FTP Server

ACK, DPORT = 1030, SPORT = 21, ‘Username:’

The connection shown in Figure 8-16 is called an FTP control connection. When a user (FTP client) asks to connect to an FTP server, a TCP connection is established to the FTP server’s well-known port (21). The connection is established like any other TCP connection. The user typically is required to enter a username and password, which the server uses to authenticate the files available to that user for read and write permissions. This security is based on the file security on the server’s platform. All the commands used to control the transfer of a file are sent across this connection—hence the name FTP control connection.

At this point, the user has a variety of commands available to enable settings for transfer, change directories, list files, and so forth. However, whenever a get or put command is entered (or mget or mput—m is for multiple) or the equivalent button is clicked on the user interface, a file is transferred. The data is transferred over a separate FTP data connection. Figure 8-17 outlines the FTP data connection process.

Figure 8-17 FTP Data Connection

 

 

 

 

 

 

 

get, myport=1031, file=zzz

 

 

 

 

 

 

 

 

 

 

 

 

TCP ACK

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SYN, DPORT=20, SPORT=1031

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SYN, ACK, DPORT=1031, SPORT=20

 

 

 

 

 

FTP Client

 

 

FTP Server

 

 

 

 

 

 

 

ACK, DPORT=20, SPORT=1031

 

 

 

 

 

Represents New FTP Data Connection

Represents FTP Control Connection

Miscellaneous TCP/IP Topics 287

As shown in Figure 8-17, another TCP connection is established for the actual data transfer, this time to well-known port 20. Using this convention, a file can be transferred without getting in the way of the control connection. If many files are to be transferred rather than making a single control/data connection for each file, the control connection is made once. The environment is defined using the control connection, and these settings affect the functioning of the data connection. For example, the default directory to use in future transfers can be defined using commands on the control connection as well as the type of data (binary or ASCII). You might choose to use binary when transferring text files between computers that might use slightly different ASCII character sets but use binary to transfer executable files. The control connection stays up until the user breaks it or the connection times out. While the control connection is up, a separate data connection is established for each file transfer.

An additional step helps prevent hackers from breaking in and transferring files, as shown in Figure 8-17. Rather than just creating a new connection, the client tells the server, with an application layer message over the control connection, which port number will be used for the new data connection. The server does not transfer the file (zzz in this case) over any other data connection except the one to the correct socket—the one with the client’s IP address, TCP, and the port number declared to the server (1031 in this case).

TFTP

Trivial File Transfer Protocol (TFTP) performs basic file transfer with a small set of features. One of the reasons that such an application is needed, even when the more robust FTP is available, is that TFTP takes little memory to load and little time to program. With the advent of extremely low-cost memory and processing, such advantages seem trivial. Practically speaking, if you intend to frequently transfer files from your PC, you probably will use FTP. However, Cisco has supported TFTP for a much longer time, and many people still use it.

TFTP uses User Datagram Protocol (UDP), so there is no connection establishment and no error recovery by the transport layer. However, TFTP uses application layer recovery by embedding a small header between the UDP header and the data. This header includes codes—for example, read, write, and acknowledgment—along with a numbering scheme that numbers 512-byte blocks of data. The TFTP application uses these block numbers to acknowledge receipt and resend the data. TFTP sends one block and waits on an acknowledgment before sending another block.