Showing posts with label tftp. Show all posts
Showing posts with label tftp. Show all posts

Friday, April 19, 2019

Cisco switch configuration backup using PowerShell

In this article, I will briefly explain how to back up the running configuration of Cisco switches to a TFTP server location using PowerShell.

Prerequisites
  • A TFTP server should be configured and running.
  • PowerShell module Posh-SSH should be installed on the node from which the script is running.

Workflow
  1. Collect credentials to SSH into the switch
    $creds = Get-Credential
  2. Create a new SSH session to the first switch in the list
    $sw_ssh = New-SshSession -ComputerName <Management IP of Cisco switch> -Credential $creds -Force -ConnectionTimeout 300
  3. Invoke the command to backup running config to TFTP server over the SSH session
    $cmd_backup = "copy running-config tftp://<IP of TFTP server>/config_backup.txt vrf management"
    Invoke-sshcommand -Command $cmd_backup -SSHSession $sw_ssh

You can schedule this PS script using a task scheduler so that the running configuration of switches can be backed up automatically on a daily basis or as per requirements. Hope this was useful. Cheers!

Complete project reference
https://github.com/vineethac/cisco_switch_backup

Related article
Dell EMC switch configuration backup using PowerShell

Sunday, July 29, 2018

Switch configuration backup using PowerShell

In this article, I will briefly explain how to backup running configuration of your Dell switches to a TFTP server location using PowerShell.

Prerequisites

  • A TFTP server should be configured and running
Workflow
  1. Get a list of IP address of switches that needs to be backed up
    list = Get-Content .\switch_list.txt
  2. Collect credentials to SSH into the switch
    $creds = Get-Credential
  3. Create a new SSH session to the first switch in the list
    $sw_ssh = New-SshSession -ComputerName 192.168.10.2 -Credential $creds -Force -ConnectionTimeout 300
  4. Invoke the command to backup running config to TFTP server over the SSH session
    $filename =(Get-Date).tostring("dd-MM-yyyy-hh-mm-ss")
    $cmd_backup = "copy running-config tftp://192.168.11.33/sw01/$filename.txt"
    Invoke-sshcommand -Command $cmd_backup -SSHSession $sw_ssh
  5. Repeat step 3 and 4 for all the switches in the list
Complete project reference

Note
You can schedule this PS script using a task scheduler so that the running configuration of switches can be backed up automatically on a daily basis or as per requirements.

Hope this was useful. Cheers!

Related article
Cisco switch configuration backup using PowerShell

Wednesday, September 17, 2014

Port numbers

Common port numbers :

7 Echo
20 FTP Data
21 FTP Control
22 SSH
23 Telnet
25 SMTP
53 DNS
67 DHCP
69 TFTP
80 HTTP
88 Kerberos
102 MS Exchange
110 POP3
123 NTP
143 IMAP4
161 SNMP
389 LDAP
443 HTTPS

Protocol numbers :

ICMP
IGMP
4 IP-within-IP
TCP
EGP
IGP
17 UDP