_89-100_ Mohammed I. Younis 89 A Fully Computerized Method to Backup the Router Configuration File Mohammed I. Younis Dr. Ghassan H.Majeed College of Engineering Computer Center Baghdad University Baghdad University (Received 17 October 2006; accepted 19 September 2007) Abstract: This paper presents a fully computerized method to backup the router configuration file. The method consists of a friendly graphical interface programmed by Java programming language. The proposed method is compared with the two existing methods, namely: TFTP server method and Copy/Paste method. The comparison reveals that the proposed method has many advantages over the existing ones. The proposed method has been implemented on Cisco routers (series 2500, 2600 and 2800). Keywords:CLI, Router, TFTP, GUI, NVRAM, Hyper Terminal Introduction: Communication between different networks requires special networking devices called routers (Fig.1). The purpose of a router is to examine incoming packets (layer 3 data), choose the best path for them through the network and then switch them to the proper outgoing part [1]. This means that routers are the most important traffic-regulating devices on large networks .In short routers let virtually any type of computer communicate with any other computer anywhere in the world [2]. Routers require configuration before performing the above function. Configuration includes the followings [3]: • Password setting. • Routing protocols setting. • Routing tables setting. • IP Addresses of the interfaces. • Access lists setting. • Advanced security setting. All these settings are saved under one file (called configuration file). This file is stored in a nonvolatile random access memory (NVRAM), Al- Khwarizmi Engineering Journal Vol.3 , No.3 , pp 89-100 (2007) Al- Khwarizmi Engineering Journal Mohammed I. Younis /Al-khwarizmi Engineering Journal ,Vol. 3, No.3, PP 89-100 (2007) 90 which retains content when the router is powered down or restarted [4]. To configure the router, we have to first establish a connection with the router (hardware side) and second use a special application (software side) to define the above settings. Hardware side: Fig.2 shows the connection parts of a Cisco router. As can be seen, two management ports are existed: the Console port and the Auxiliary port. Most network administrators preferred the console port because it displays router startup, debugging and error messages by default. To connect to the console port with the PC a rollover cable and an RJ-45 to db-9 adapters are used as shown in Fig.3. Software side: To define the parameters of the configuration, the user has to use a text or graphic mode interface. The application that provides these interfaces called terminal emulation applications .Table.1 lists the available emulation for the well known operating systems. Fig.4 shows the hyper terminal emulation used by Microsoft operating systems. The literature [5] suggested two methods to create the configuration file: using the setup mode and using the command line interface (CLI). Setup mode is not commonly used because of the limits in what the user can actually configure. In the CLI mode, the commands are entered by the administrator and executed one line at a time. The results of execution are stored in the RAM of the router and called a running configuration, which can be saved on the NVRAM with any name and extension. Literature refers to this file as a startup configuration file. The administrator may spend a long time when configuring the router, so it is recommended to back up the startup configuration file. Cisco's experts presented two methods to backup the startup file: • Using Trivial File Transfer Server. • Using Copy/Paste. The first method is simple and quick, but it requires special software to be installed on the PC and also requires an Ethernet connection (network connection) between the Ethernet port of the PC and the Ethernet of the router. This connection can not be established without a previous setting of IP address of both ports. The second method does not require a special software or Ethernet connection, but it is time consuming and needs a human intervention. The purpose of the present work is to suggest a simple, quick and fully computerized method to back up the configuration file without the need of an Ethernet connection and any special software. In the following sections, we will describe and analyze the above two methods using Windows XP [6] as operating system. TFTP Server Method This method includes the following sequential steps: 1. Connect the Ethernet port of the PC with the Ethernet of the router using cross-over UTP cable. 2. Assign the IP address of the Ethernet port of the PC. 3. Install the TFTP server software on the PC. 4. Execute the Hyper Terminal Emulator on the PC. Mohammed I. Younis /Al-khwarizmi Engineering Journal ,Vol. 3, No.3, PP 89-100 (2007) 91 5. Go to the global level and assign the IP address of the Ethernet port of the router. 6. From the privilege level, issue the command : Copy run TFTP The above steps will save a backup copy of the running configuration file on the TFTP server. The restoring process is done by repeating steps 1 through 5 then issue the command Copy TFTP run. Copy/Paste Method This method consists of three parts (capturing, filtering and restoring): Part One: Capturing the configuration file 1. Open the Hyper Terminal Emulator with default setting (baud rate=9600 bps, 8 data- bits, no parity, 1 stop-bit, no flow control [7]). 2. Go to the privilege level by using enable command. 3. From the transfer menu, click capture text. 4. Specify the name for the text file to save the capture configuration. 5. From the sub menu of the capture text click start. 6. Display the current configuration by entering (at the prompt) show run. 7. Press the space bar when each –More- prompt appears, which continues with the configuration until the end is reached. 8. When the complete configuration has been displayed, select the stop from the sub menu of the capture text. After completing the above steps, all the displayed information will be saved on hard disk under the name specified in step 4. Part Two: Editing the file In this part, the network administrator can perform the following: 1. Filtering the capturing file by removing the lines that will cause errors when executing the file. 2. Adding comments to the file by beginning lines with an exclamation mark (!). 3. Adding some necessary commands, like no shutdown at the end of each of the interface section. The lines that must remove include: • show running-config • Building configuration... • Current configuration: • - More - • Any lines that appear after the word End. The administrator can use any text editor (like Notepad) to edit the file and then save the clean version of the configuration file. Part Three: Restoring the file This part includes three operations: erasing the startup configuration file (from the NVRAM), restoring the clean configuration file (from the hard disk) and copying the clean file to the NVRAM through the console port. These operations can be achieved by the following steps: 1. From privilege mode, issue the command erase start. 2. From privilege mode, issue the command reload. 3. Go to global level (by entering Conf T). Mohammed I. Younis /Al-khwarizmi Engineering Journal ,Vol. 3, No.3, PP 89-100 (2007) 92 4. In the Hyper Terminal window, select Text File from Transfer Menu. 5. Select the name of the clean file. 6. The lines of the file are entered into the router as if they are being typed (stored in the RAM). 7. Exit the global level by pressing CTRL+Z. 8. From the privilege level, copy the running configuration to the NVRAM with copy run start. 9. In order to check for changes to take effect the router must be reloaded. By issuing reload command from hyper terminal. The above procedure reveals that Copy/Paste method is tedious and requires human intervention in every step of the three parts. This of course makes it subject to several errors, like missing or error typing. Also some literature suggested to use object originated programming for router configuration in terms of modular design but still have limitation of using CLI[8][9][10]. The Proposed Method We use Java programming language to implement a friendly graphical user interface (GUI), as shown in Fig. 5.This interface including scrollable text area, six buttons, and status bar. Clicking on any of the buttons will result in executing one or more Java objects to perform certain functions. Before using the program the PC must be connected to the Console port of the router using rollover UTP cable with default setting. Bellow is a description of how to use the proposal method: • Execute the program by double clicking its icon (Fig. 5 will be displayed). • Click the capture button to display the content of the current configuration (running configuration), the status bar indicates that the capture is done (Fig. 5). In compare with the Copy/Paste method, one click on the capture button is equivalent to the 8 steps maintained in part one. • The filter button is used to filter the captured file by removing the extra lines. The filtered content is displayed on the text area and the status bar indicates that the Filtering is done (Fig. 6). This step is replacement of tedious task for removing extra lines; that is done by the program not by the administrator. • Click the edit button to add extra commands or comments, this button is used to Toggle (enable/disable) the editing in the text area; the status bar indicates whether the text area is editable or not (Fig. 7). The text editor included in the program and not requires third party programs (such as text editor). • The send button is for saving the clean file to the NVRAM of the router. Using the default configuration file name (Router-Config) and the status bar indicate that the sending is done. In compare with the Copy/Paste method, one click on the send button in he proposed method is equivalent to the first 8 steps maintained in part three in Copy/Paste method (Fig. 8). Mohammed I. Younis /Al-khwarizmi Engineering Journal ,Vol. 3, No.3, PP 89-100 (2007) 93 • The save button is for saving the clean file to the hard disk, the administrator will choose the backup file name and in which directory the saving is done. The status bar indicate that the file saving is done (Fig. 9). The filtering, edit, and saving buttons in the proposed method are the replacement of part two in Copy/Paste method. • The reload button is designed to reload the router. It is equivalent to use reload command from the hyper terminal, but we add it to enable the user to perform reloading without using the Hyper Terminal Emulator. i.e., replacement of step 9 maintained in part three in Copy/Paste method. Conclusions 1. A fully computerized method to backup the router configuration file has been proposed in this work with friendly GUI and easy to use. 2. The proposed method has the following advantages over TFTP Server method: • It dose not require the Hyper Terminal software. • It dose not require an Ethernet connection between the PC and the router. • It dose not require a special software such as a TFTP server software and text editor. 3. The proposed method has the following advantages over Copy/Paste method: • It dose not require the Hyper Terminal software and text editor. • It is very simple and quick. • It is time conversing. • The administrator dose not requires entering any command to perform the backup operation. Mohammed I. Younis /Al-khwarizmi Engineering Journal ,Vol. 3, No.3, PP 89-100 (2007) 94 Fig. 1 Internal Configuration of the Router Fig. 2 External connection of 2600 routers Mohammed I. Younis /Al-khwarizmi Engineering Journal ,Vol. 3, No.3, PP 89-100 (2007) 95 Fig.3 Console Port to Pc Connection Fig. 4 Hyper Terminal Emulator Program Mohammed I. Younis /Al-khwarizmi Engineering Journal ,Vol. 3, No.3, PP 89-100 (2007) 96 Fig.5: Capturing the Running Configuration of the Router Fig. 6: Filtering the Captured Configuration of the Router Mohammed I. Younis /Al-khwarizmi Engineering Journal ,Vol. 3, No.3, PP 89-100 (2007) 97 Fig. 7: Enable the Text Area Fig.8: Sending the Configuration to NVRAM Mohammed I. Younis /Al-khwarizmi Engineering Journal ,Vol. 3, No.3, PP 89-100 (2007) 98 Fig. 9 Saving the Configuration to Hard disk Table 1 List of operating systems and the terminal emulation software that may be used Mohammed I. Younis /Al-khwarizmi Engineering Journal ,Vol. 3, No.3, PP 89-100 (2007) 99 List of Abbreviations CLI Command Line Interface GUI Graphical User Interface NVRAM Non Volatile Random Access Memory PC Personal Computer TFTP Trivial File Transfer protocol UTP Unshielded twisted Pair cable References 1. “Computer Networks”, Andrew S. Tanenbaum, fourth edition, Prentice-Hall, Inc., 2003. 2. "CCNA1: Networking Basic V3.1", Cisco Systems, Inc., 2003. 3. "Networking Lab Practice Kit for Microsoft and Cisco Systems", John Chirillo, John Wiley and Sons, Inc., 2002. 4. "CCNA Cisco Certified Network Associate Study Guide", Todd Lammle, 5th Edition, Sybex, Inc., 2005. 5. "CCNA2: Router and Routing Basic V3.1", Cisco Systems, Inc., 2003. 6. "HP IT Essentials I: PC Hardware and Software V3.1", Cisco Systems, Inc., 2003. 7. "Hardware Troubleshooting for the Cisco 2600 Series Router", Cisco Systems, Inc., 2006. 8. "Router plugins: A software architecture for next generation routers", Dan Decasper, Zubin Dittia, Guru Parulkar, and Bernhard Plattner. In Proc. ACM SIGCOMM Conference (SIGCOMM '98), pages 229-240, October 1998. 9. "The Click modular router", Eddie Kohler, Robert Morris, Benjie Chen, John Jannotti, and M. FransKaashoek,. ACM Trans. Computer Systems, November 2000. 10. "Programming language techniques for modular router configurations", Eddie Kohler, Benjie Chen, M. Frans Kaashoek, Robert Morris, and Massimiliano Poletto, Parallel and Distributed Operating Systems Group, Laboratory for Computer Science, MIT, Cambridge, 2002. Mohammed I. Younis /Al-khwarizmi Engineering Journal ,Vol. 3, No.3, PP 89-100 (2007) 100 طریقة الكترونیة كاملة لحفظ نسخة احتیاطیة من ملف ترتیب الموجھ غسان حمید عبد المجید. د محمد عصام یونس مركز الحاسبة االلكترونیة، جامعة بغداد كلیة الھندسة، جامعة بغداد :صةالخال تحتوي ھذه الطریقة على . یعطي البحث طریقة الكترونیة كاملة لحفظ نسخة احتیاطیة من ملف الترتیب للموجھ .اة االستخدام والمبرمجة بلغة جافواجھات الصدیقة للمستخدم والسھل ھيالبدیطریقة خادم نظام إرسال الملفات :الطریقة المقترحة قورنت مع الطریقتین التقلیدیتین، وھما )(TFTP Server اللصق /وطریقة النسخ)Copy/Paste(، حیث تحتوي ھذه الطریقة على العدید من الفوائد إذا ما قورنت بالطریقتین الحالیتین ). ٢٨٠٠، و ٢٦٠٠، ٢٥٠٠سلسلة (الطریقة المقترحة قد طبقت على موجھات سسكو