i need help woth only task 3
1 Prince George’s Community College INT-2240: Introduction to Python 0. Introduction to the Project: Basic Automation of System and Network Configuration • Project Objectives: This project is designed to introduce students to using Python to automate network configuration and management. Upon completion of this project, students will be able to: o design and build basic architecture of a Python application for network automation; o build network topologies in an emulation tool such as GNS3; o use pip to install Python virtual environments and packages; o create and use multiple Python modules as part of a program; o connect and configure remote network devices using Python; o retrieve and use configuration data from a .csv file; o retrieve data from a remote device and save the data to file using Python; o use the Netmiko package to programmatically connect to and configure a Linux system and network devices; o use Python conditions to automate configuration decisions based on device output. • Project Parts Part 1: Setup of GNS3 lab environment Part 2: Deployment of the devices and the out-of-band management network Part 3: System and network configuration using Python Part 4: Final project submission • Network Architecture Figure 1: Project's network architecture 2 In secure production networks, there is another network used to manage the devices (e.g., routers and switches) and systems (e.g., servers) which is generally different from the user data network. The management network is secured, and system/network administrators only have access to it. For automated system configuration using Python in this project, we will use an out-of-band management system, as shown (in green) in Figure 2. The automated commands generated by the Python scripts will travel through the management network (green), and the user data will travel though the user data network (blue). Tasks will be as follows: • Management network manual configuration in GNS3 (Project Part 2) • Data network automated configuration via Python scripts • Ubuntu Server configuration automated configuration via Python scripts Figure 2: Out-of-band management network Note: This project does not test networking skills, all required networking commands are provided. If you need assistance with networking commands, reach out to me. Due dates: Consult Blackboard for due dates of each project part. 3 1. Part 1: Setup of GNS3 Lab Environment [10 points] In this unit, we will learn to use Python for network automation. For that, we need a network infrastructure with adequate appliances. In this lab, you will install the required virtual infrastructure for a smooth learning experience. We will install and configure the following: 1.1. VMware Workstation Player (free) or VMWare Workstation Pro or VMware Fusion (Mac) 1.2. VMware VIX API (improves interaction between VMWare Player and GNS3) [for VMWare Player ONLY] 1.3. GNS3 GUI 1.4. GNS3 VM 1.5. Additional VM VMware player is a type 2 hypervisor that allows you to create and use virtual machines on top of your current Windows or Linux OS. If you are using a Mac, you may have to buy VMware Fusion. It is affordable on Ebay. Even though other hypervisors such as Virtual Box can be used, VMware’s product deliver the smoothest experience with GNS3 Graphical Network Simulator-3 (shortened to GNS3) is a free network software emulator used by professionals worldwide. It will allow us to create and run virtual networks in VMware Player. The graphical user interface (GUI) is the interface to use GNS3, while the VM will allow an integration of the virtual appliances to your computer’s resources. 1.6. Part 1 Tasks 1.6.1. Download and Installing VMware Workstation Player (different from Workstation) from https://www.vmware.com/products/workstation-player/workstation-player- evaluation.html: https://www.youtube.com/watch?v=23oD3Ab__Tk (You tube video) 1.6.2. Download and Install VMware VIX API from this link (Windows) https://customerconnect.vmware.com/downloads/details?downloadGroup=PLAYER-1400- VIX1170&productId=687 1.6.3. Installing GNS3 GUI : To download GNS3 products from www.gns3.com, you will have to register a free account. https://www.youtube.com/watch?v=4ukwpvCuxHI (You tube video) 1.6.4. Integrating GNS3 GUI and GNS3 VM (you do not need to install VMware anymore; skip that part, and start watching the video from 5:23). https://www.youtube.com/watch?v=0T9YZssqDyE (Youtube video) 1.6.5. Additional Software: As needed (later) 1.7. Submission: https://www.vmware.com/products/workstation-player/workstation-player-evaluation.html https://www.vmware.com/products/workstation-player/workstation-player-evaluation.html https://www.youtube.com/watch?v=23oD3Ab__Tk https://customerconnect.vmware.com/downloads/details?downloadGroup=PLAYER-1400-VIX1170&productId=687 https://customerconnect.vmware.com/downloads/details?downloadGroup=PLAYER-1400-VIX1170&productId=687 http://www.gns3.com/ https://www.youtube.com/watch?v=4ukwpvCuxHI https://www.youtube.com/watch?v=0T9YZssqDyE 4 Launch you GNS3 GUI with your GNS3 VM displayed, take a snapshot, and submit on Bb as indicated. See next page for Part 2! 5 2. Part 2: Deployment of the devices and the out-of-band management network [20 points] In Part 2, we download and load required appliances, build the network, and configure the management network. We also deploy the devices and connect them to the host computer through an out-of-band management network manually. This network is used to control the devices through Python scripts running on the host computer. Upon completion of this part, students will be able to: • Download, load, and deploy appliances in GNS3 (manual) • Build a network topology and an out-of-band management network (manual) • Connect GNS3 appliances to the host computer through the GNS3 Cloud appliance (manual) 2.1. Part 2 Tasks (Watch video on Blackboard before completing this task) 2.1.1. Task 1: Create a project folder on your PC. In this folder, create another directory where you download the content of the following link: https://drive.google.com/drive/folders/1TL0qoh3Mmr2vibWW_9om- koiS9n8VP13?usp=sharing (You might need to use Google Chrome or Microsoft Edge for the download). Make sure all the files are unzipped in case you compress them during the download. 2.1.2. Task 2: Create templates and load all the required appliances (i.e., the Ubuntu server and the Arista vEOS layer 3 switch). Follow the instructional videos linked in Blackboard. 2.1.3. Task 3: Build the architecture with the appliances and links 2.1.4. Task 4: Ensure that you can ping the management interfaces of the Arista switches and the Ubuntu server from your PC. 2.1.5. vEOS configuration commands: Note: Arista switch have “zero touch” provisioning enabled by default. You need to disable this feature using the “zerotouch cancel” in configuration mode. The device will reboot after you administer that command. enable configure terminal username username secret password [username = admin, password = int-2240] hostname hostname-n [hostname = vEOS, n = switch number (1 or 2)] interface Management 1 ip address a.b.c.d/24 [IP address and subnet mask: use IP on the same network as your GNS VM, watch set up video] no shutdown copy run start show management ssh [confirm that ssh is enabled] 2.2. Submission of Part 2 2.2.1. Take a screenshot of your topology and the ping results, paste then in a word file, answer the following question, and submit the word file as your assignment submission. 2.2.2. Question: For each of the managed devices (the vEOS switches and the Ubuntu server), specify the management interface (interface on the management network) and its IP address. https://drive.google.com/drive/folders/1TL0qoh3Mmr2vibWW_9om-koiS9n8VP13?usp=sharing https://drive.google.com/drive/folders/1TL0qoh3Mmr2vibWW_9om-koiS9n8VP13?usp=sharing 6 See next page for Part 3! 7 3. Part 3: System and network configuration using Python [70 points] In this part, you write the Python scripts to configure the Arista switches, test endpoint connectivity, and save device information to file. 3.1. Create a virtual environment and a script (module) (10 points): 3.1.1. Create a project folder, which will be the working directory. 3.1.2. Inside the project folder, create a virtual environment named “venv” using the CLI tool. 3.1.3. Install required project packages in the virtual environment using pip. 3.1.4. Activate the virtual environment and take a screenshot of it. 3.1.5. Name the file (module) abc_xyz.py, where “abc” is your first name and “xyz” your last name. 3.1.6. Include an initiation block starting with if __name__ == “__main__”: from where all the functions in the module will be called. 3.2. Write a function to automatically import the .csv file and (15 points): 3.2.1. Programmatically configure default routes on the vEOS switches and IP addresses on all their connected interfaces accordingly. Save configurations to disk. Commands (after “enable”, watch my recording on how to use Python to get there): • configure terminal • ip routing • ip route 0.0.0.0/0 default_route_ip [according to the .csv file] • interface interface_name • no switchport • ip address ip_address/24 [according to the .csv file] • no shutdown • end • copy run start 3.2.2. Programmatically configure an IP address on the ens1 interface of the Ubuntu Server. Command (after “enable”, watch my recording on how to use Python to get there): • ip addr add ip_address/24 dev ens1 [according to the .csv file] – Do “ip add” in the CLI to ensure that the interface name is “ens1.” Yours may be different, e.g., ens4 • ip route add default via default_gateway_ip dev ens1 3.3. Write a function to test the connectivity from the vEOS devices to other devices (10 points): 3.3.1. The function with receive two arguments: 1) the specific vEOS device to ping from, and 2) the IP address that will be pinged 3.3.2. The function will return the ping result 8 3.3.3. Test the connectivity between vEOS-1 and the Ubuntu Server’s ens1 interface’s IP address. The calling instruction will print the result. Example: print(test_func(vEOS-1, ’10.10.5.1’)) where ‘test_func’ is the function’s name, and 10.10.5.1 is the IP address 3.4. Write a function to collect information from