CiscoSnips

From Custard
Jump to: navigation, search

Contents

Cisco Snippets

Layer 2 traceroute

as1-cisco#traceroute mac 64:b9:e8:cb:b7:26 00:0c:29:5c:af:84 vlan 42
Source 64b9.e8cb.b726 found on as1-cisco
1 as1-cisco (192.168.50.227) : Fa0/16 => Gi0/1
2 cs1-cisco (192.168.50.223) : Gi0/21 => Gi0/23
3 cs2-cisco (192.168.50.221) : Gi0/20 => Gi0/11
Destination 000c.295c.af84 found on cs2-cisco
Layer 2 trace completed

Enter privileged mode

  • enable
    • Enter the enable password

Show Interface Status

  • show interfaces

Show Running Configuration for everything

  • show running-config

Show Running Configuration for an Interface

  • show running-config interface Gi0/1

nb. Interface names can be shortened eg.

  • GigabitEthernet0/1 becomes Gi0/1
  • FastEthernet0/12 becomes Fa0/12

Enter config mode

  • config terminal
    • Enter config commands
  • exit or Ctrl-Z

Can be abbreviated.

  • conf term

Configure an interface

  • config terminal
    • interface Gi0/1
    • switchport mode trunk
    • media-type rj45 ( other options: sfp )
    • no shutdown
    • ...
  • exit

Example session

octopus:~ jamesb$ telnet 192.168.50.231
Trying 192.168.50.231...
Connected to 192.168.50.231.
Escape character is '^]'.


User Access Verification

Password: Kerberos: No default realm defined for Kerberos!

Password: 
Password: 
access-switch-1>enable
Password: 
Password: 
Password: 
access-switch-1#show running-config
Building configuration...

Current configuration : 6989 bytes
!
version 12.2
no service pad
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname access-switch-1
!
boot-start-marker
boot-end-marker
!
enable secret 5 mysecret
enable password mypassword
!
no aaa new-model
system mtu routing 1500
ip subnet-zero
!
!
...
...

Change IP address of telnet console

  • enable
    • config (terminal)
      • interface Vlan1
      • ip address 192.168.1.254 255.255.255.0
      • exit
    • exit
  • write

Grab Cisco config using Perl

Bit of a [PerlSnips] crossover this one.

#!/usr/bin/perl

package Main;

use Net::Telnet::Cisco;
use Moose;

has 'cisco' => (is => 'rw');

sub run {
	my $self = shift;
	
	$self->cisco( Net::Telnet::Cisco->new( Host => '192.168.1.199' ) );
	$self->cisco->login( Password => 'oh_really' );
	$self->cisco->enable( Password => 'really_really' );
	print $self->cisco->cmd( 'show running-config' );
}

Main->new->run;

Change passwords on 2950 Switch


conf terminal
enable secret newEnablePassword
enable password oldStyleEnablePassword
line con 0
 password newTelnetPassword
 login
line vty 0 4
 password newTelnetPassword
 login
line vty 5 15
 password newTelnetPassword
 login
exit
exit
write

VTP

  • show vtp status
switch.my.network.local#show vtp status
VTP Version capable             : 1 to 3
VTP version running             : 2
VTP Domain Name                 : my.network.local
VTP Pruning Mode                : Disabled
VTP Traps Generation            : Disabled
Device ID                       : cafe.1111.2222
Configuration last modified by 192.168.1.1 at 3-14-12 17:05:32

Feature VLAN:
--------------
VTP Operating Mode                : Client
Maximum VLANs supported locally   : 255
Number of existing VLANs          : 21
Configuration Revision            : 111
MD5 digest                        : 0xAA 0xBB 0xAA 0xBB 0xAA 0xBB 0xAA 0xBB  
                                    0xAA 0xBB 0xAA 0xBB 0xAA 0xBB 0xAA 0xBB  
switch.my.network.local#show vtp password
VTP Password: thepassword


Cisco 2811 ATM/ADSL

Before:

FastEthernet0/0 is up, line protocol is up 
  Hardware is MV96340 Ethernet, address is 0023.048d.ce50 (bia 0023.048d.ce50)
  Internet address is 192.168.1.200/24
  MTU 1500 bytes, BW 100000 Kbit/sec, DLY 100 usec, 
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Half-duplex, 100Mb/s, 100BaseTX/FX
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input never, output 00:00:01, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/40 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     0 packets input, 0 bytes
     Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
     0 watchdog
     0 input packets with dribble condition detected
     741 packets output, 165852 bytes, 0 underruns
     0 output errors, 0 collisions, 1 interface resets
     0 unknown protocol drops
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out
FastEthernet0/1 is administratively down, line protocol is down 
  Hardware is MV96340 Ethernet, address is 0023.048d.ce51 (bia 0023.048d.ce51)
  MTU 1500 bytes, BW 100000 Kbit/sec, DLY 100 usec, 
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Auto-duplex, Auto Speed, 100BaseTX/FX
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input never, output 01:35:37, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/40 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     0 packets input, 0 bytes
     Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
     0 watchdog
     0 input packets with dribble condition detected
     7 packets output, 420 bytes, 0 underruns
     0 output errors, 0 collisions, 0 interface resets
     0 unknown protocol drops
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out
ATM0/0/0 is administratively down, line protocol is down 
  Hardware is DSLSAR (with Alcatel ADSL Module)
  MTU 4470 bytes, sub MTU 4470, BW 1024 Kbit/sec, DLY 500 usec, 
     reliability 0/255, txload 1/255, rxload 1/255
  Encapsulation ATM, loopback not set
  Encapsulation(s): AAL5  AAL2, PVC mode
  23 maximum active VCs, 256 VCs per VP, 0 current VCCs
  VC Auto Creation Disabled.
  VC idle disconnect time: 300 seconds
  Last input never, output never, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: Per VC Queueing
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     0 packets input, 0 bytes, 0 no buffer
     Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     0 packets output, 0 bytes, 0 underruns
     0 output errors, 0 collisions, 0 interface resets
     0 unknown protocol drops
     0 output buffer failures, 0 output buffers swapped out

Config DSl:

conf t

interface ATM0/0/0
pppoe enable
pppoe-client dial-pool-number 1
no shut
exit

int dialer0
ip address negotiated [this depends on your ISP settings]
ip mtu 1492 [adjust MTU for PPPoE header]
encap ppp
ppp authentication chap callin (assuming non-Cisco end point, and assuming we're using chap and not pap for the password credentials you mention)
ppp chap hostname [whatever the hostname/username is]
ppp chap password [whatever the password is]
dialer pool 1
dialer-group 1
exit

dialer-list 1 protocol ip permit
ip route 0.0.0.0 0.0.0.0 dialer0 

AAISP:

IPv6:

Personal tools