GNS3 Talks: Python for Network Engineers with GNS3 (Part 14) - Netmiko, SSH, Python Cisco switches

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 พ.ย. 2024

ความคิดเห็น • 20

  • @TheEmperorXavier
    @TheEmperorXavier 6 ปีที่แล้ว +2

    This is soo amazing, I can't wait to finish the CCNA course that I bought from you to start automating. But I will need to learn a bit of Linux first. I am soo excited to learn this. Thank you David.

  • @refaiabdeen5943
    @refaiabdeen5943 7 ปีที่แล้ว

    Hi David, As you know while watching your wonderful videos, I'm labbing it too.
    When I run the following command:
    root@Ubuntu-1:~# python netmiko3
    I get the following output:
    ['vlan 2', 'nt range f1/2 - 5', 'switchport mode access', 'switchport access valn 2', 'int range f1/0 - 5', 'switchport trunk encapsulation dot1q', 'switchport mode trunk', 'switchport nonegotiate', 'switchport trunk allowed vlan 1,2']
    followed by the following errors:
    Traceback (most recent call last):
    File "netmiko3", line 48, in
    output = net_connect.send_config_set(lines)
    File "/usr/local/lib/python2.7/dist-packages/netmiko/base_connection.py", line 965, in send_config_set
    output += self.exit_config_mode()
    File "/usr/local/lib/python2.7/dist-packages/netmiko/cisco_base_connection.py", line 50, in exit_config_mode
    pattern=pattern)
    File "/usr/local/lib/python2.7/dist-packages/netmiko/base_connection.py", line 915, in exit_config_mode
    if self.check_config_mode():
    File "/usr/local/lib/python2.7/dist-packages/netmiko/cisco_base_connection.py", line 32, in check_config_mode
    pattern=pattern)
    File "/usr/local/lib/python2.7/dist-packages/netmiko/base_connection.py", line 896, in check_config_mode
    output = self.read_until_pattern(pattern=pattern)
    File "/usr/local/lib/python2.7/dist-packages/netmiko/base_connection.py", line 338, in read_until_pattern
    return self._read_channel_expect(*args, **kwargs)
    File "/usr/local/lib/python2.7/dist-packages/netmiko/base_connection.py", line 289, in _read_channel_expect
    raise NetMikoTimeoutException("Timed-out reading channel, data not available.")
    netmiko.ssh_exception.NetMikoTimeoutException: Timed-out reading channel, data not available.
    I trust that there is a configuration error on my line 48 on my netmiko3 file
    would appreciate if you could advise me what it is.
    My line 48 reads as follows:
    output = net_connect.send_config_set(lines)
    would much appreciate a reply. Cheers

  • @alreid12345
    @alreid12345 7 ปีที่แล้ว

    Very interesting David. Must get myself a larger scale lab setup in GNS3 now to replicate scenarios like this.
    Been having a few intermittent issues in GNS3 RC2 and need to check out the GNS3 forums for more details.

    • @davidbombal
      @davidbombal  7 ปีที่แล้ว +2

      I was thinking of creating a bigger lab with more devices to show this scale. What do you think?

    • @alreid12345
      @alreid12345 7 ปีที่แล้ว

      Larger lab would be interesting but think adding VLAN's for an example stops having a wow factor after you realise how much this scales when you understand the basics of Python scripting.
      Possibly making a 10-12 switch lab with a VLAN deployment would give people a good example of this for clariity.
      Maybe and example of a change required of a fairly large number of devices such as remove a current SNMP config and add a new one or remove an old standard ACL and update with a new named numbered standardised company policy ACL.
      Basically a task that you have to do on 20+ but in theory 100+ devices.
      There are tools like Solarwinds NCM but they can be expensive to purchase, deploy and manage and these example show what can be done with a little investment of time and learning Python and utilising libraries.
      When talking about replacing a product then possibly Ansible is a better fit her for templating and standardising and pushing large scale changes from my limited understanding.
      I have only done very simple tasks with Ansible but a lot of people seem really excited that Red Hat may Open Source Ansible Tower later this year which will give a GUI or easier control and use of Ansible.
      Open Source is awesome and there are so many projects that network engineers can leverage and use if they invest a little time in learning what is fairly basic Linux admin.
      Sorry for the long answer.

  • @kishorekannanp
    @kishorekannanp 7 ปีที่แล้ว

    Very nice video david thank you, please show us how to open a file with the list of device IP's in it and to capture the output in a file

  • @vishalkanojia1983
    @vishalkanojia1983 4 ปีที่แล้ว +1

    david, like in earlier videos we call a file myswitches, how we can do that with netmiko???

  • @yuanjie1802
    @yuanjie1802 7 ปีที่แล้ว

    thank you, david , good video

    • @davidbombal
      @davidbombal  7 ปีที่แล้ว

      Thank you for watching!

  • @RezwanRahman
    @RezwanRahman 7 ปีที่แล้ว

    Dear sir can you show if else conditional programing

  • @gauravbamania3794
    @gauravbamania3794 5 ปีที่แล้ว

    @david : do I have to install netmiko for python3 each new lab in network automation container?
    I find netmiko pre-installed for python 2.

  • @refaiabdeen5943
    @refaiabdeen5943 7 ปีที่แล้ว

    Hi David,
    Do disregard my last comment and request for help, as it was a syntax error as to how I had named my switches.
    But my out put fails to increment as to the switch been configured as it successfully configures the individual switches. It only displays the last switch which is S1.
    Please be kind enough to advise if time permits. Cheers.

  • @shivanandb7258
    @shivanandb7258 7 ปีที่แล้ว

    Hi David, Nice videos i am following your channel from past few months. I see all places you are using static username and password which will not be the same scenario in real time. Would like to know if you can emulate the same setup using netmiko and paramiko using dynamic passwords like RSA.

    • @davidbombal
      @davidbombal  7 ปีที่แล้ว +2

      Thanks! In my Python course we extend this to use an encrypted password file. You could also prompt the user for a password when a file is run. More here: www.cciepython.com

    • @shivanandb7258
      @shivanandb7258 7 ปีที่แล้ว

      Does that course has any inputs on RSA authentication where password keeps changing every 60 sec ? Because other videos of your i did not see anything about that.

    • @davidbombal
      @davidbombal  7 ปีที่แล้ว +1

      No. But if you write code that does that, please share with the GNS3 community.

    • @shivanandb7258
      @shivanandb7258 7 ปีที่แล้ว

      Sure i am already into it. Once i test and confirm it i will share it with you all.

    • @davidbombal
      @davidbombal  7 ปีที่แล้ว

      Thanks!

  • @solarisdreamz
    @solarisdreamz 5 ปีที่แล้ว

    Question, why would you want to program a router in this way?

    • @brade1208
      @brade1208 3 ปีที่แล้ว

      Automation. Save time doing repetitive tasks. Especially if you have lots of devices. This type of automation is unneeded if you only manage a few devices.