Back to Browse

Python learning for Network Engineers | Part 17 |Netmiko introduction for Cisco SSH configuration

8.0K views
Mar 30, 2019
18:37

๐—™๐—ผ๐—ฟ ๐—–๐—ผ๐—บ๐—ฝ๐—น๐—ฒ๐˜๐—ฒ ๐—ฃ๐˜†๐˜๐—ต๐—ผ๐—ป ๐—™๐—ผ๐—ฟ ๐—ก๐—ฒ๐˜๐˜„๐—ผ๐—ฟ๐—ธ ๐—˜๐—ป๐—ด๐—ถ๐—ป๐—ฒ๐—ฒ๐—ฟ๐˜€ ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ: ๐—˜๐—ป๐—ฟ๐—ผ๐—น๐—น ๐—ณ๐—ผ๐—ฟ ๐—ฏ๐—ฒ๐—น๐—ผ๐˜„ ๐—จ๐—ฑ๐—ฒ๐—บ๐˜† ๐—–๐—น๐—ฎ๐˜€๐˜€: ๐Ÿ๐ŸŽ๐Ÿ๐Ÿ ๐•๐ž๐ซ๐ฌ๐ข๐จ๐ง ๐‘ซ๐’Š๐’”๐’„๐’๐’–๐’๐’•๐’†๐’… ๐‘น๐’†๐’‡๐’†๐’“๐’“๐’‚๐’ ๐‘ณ๐’Š๐’๐’Œ: https://www.udemy.com/course/python-for-network-engineers/?referralCode=35A75AAE1ACA94A15829 Python Series Complete video Playlist URL :https://www.youtube.com/watch?v=sG_RiytUA38&list=PLOocymQm7YWakdZkBfCRIC06fv7xQE85N To stay updated with my latest videos Please subscribe to my channel by clicking below https://www.youtube.com/channel/UCcA2nhdC0wzqyv9x1lk5NnA?sub_confirmation=1 Introduction to Netmiko. Simplifies SSH to the networking device Simplifies execution of show command as well as configuration in to the device textfsm:can extract the date from output and give it in a structured way. Installation Command: pip install netmiko Netmiko commonly-used methods: net_connect.send_command() - Send command down the channel, return output back (pattern based) net_connect.send_command_timing() - Send command down the channel, return output back (timing based) net_connect.send_config_set() - Send configuration commands to remote device net_connect.send_config_from_file() - Send configuration commands loaded from a file net_connect.save_config() - Save the running-config to the startup-config net_connect.enable() - Enter enable mode need to import the ConnectHandler function from Netmiko. then define a network device dictionary which contains device_type, ip, username, and password. verbose in for detailed logging. Dictionaries: will have mapping between key and value Order is not mandatory here Script sample: from netmiko import ConnectHandler from getpass import getpass password = getpass() RTR_10 = { 'ip': '10.10.10.10', 'username': 'admin', 'password': 'admin', 'device_type': 'cisco_ios', } net_connect = ConnectHandler(**RTR_10) config_commands = [ 'int lo0', 'ip add 1.1.1.1 255.255.255.0', 'no shut' ] output = net_connect.send_config_set(config_commands) print(output) output = net_connect.send_command('show ip int brief') print(output) #NetmikoCiscoSSH #CiscoPythonConfiguration #NetmikoCiscoConfiguration

Download

0 formats

No download links available.

Python learning for Network Engineers | Part 17 |Netmiko introduction for Cisco SSH configuration | NatokHD