Thursday, December 10, 2015

Start service at boot in linux

chkconfig -> check the services status at boot
chkconfig snmpd on -> Make snmpd start at boot

Thursday, October 22, 2015

Nexus 9k Scripting - Part I

Today I have spent some minutes trying out new ways to automate Nexus 9k.

Out of the box, you can get in to Nexus 9k linux OS. Jut do the following:

Switch(config)# feature bash-shell

Switch# run bash
bash-4.2$
bash-4.2$
bash-4.2$
bash-4.2$ cat /proc/cpu
cat: /proc/cpu: No such file or directory
bash-4.2$ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 58
model name      : Intel(R) Core(TM) i3-3227U CPU @ 2.50GHz
stepping        : 9
microcode       : 0x19
cpu MHz         : 2500.000
cache size      : 4096 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips        : 5001.98
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 58
model name      : Intel(R) Core(TM) i3-3227U CPU @ 2.50GHz
stepping        : 9
microcode       : 0x19
cpu MHz         : 2500.000
cache size      : 4096 KB
physical id     : 0
siblings        : 4
core id         : 1
cpu cores       : 2
apicid          : 2
initial apicid  : 2
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips        : 5001.98
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

processor       : 2
vendor_id       : GenuineIntel
cpu family      : 6
model           : 58
model name      : Intel(R) Core(TM) i3-3227U CPU @ 2.50GHz
stepping        : 9
microcode       : 0x19
cpu MHz         : 2500.000
cache size      : 4096 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 2
apicid          : 1
initial apicid  : 1
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips        : 5001.98
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

processor       : 3
vendor_id       : GenuineIntel
cpu family      : 6
model           : 58
model name      : Intel(R) Core(TM) i3-3227U CPU @ 2.50GHz
stepping        : 9
microcode       : 0x19
cpu MHz         : 2500.000
cache size      : 4096 KB
physical id     : 0
siblings        : 4
core id         : 1
cpu cores       : 2
apicid          : 3
initial apicid  : 3
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips        : 5001.98
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

bash-4.2$

! If you want to be root just do the following
bash-4.2# sudo su root
bash-4.2# whoami
root
bash-4.2#
bash-4.2# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       1.0G  485M  540M  48% /
none            1.0G  468M  557M  46% /isan
none             40M   40M     0 100% /nxos/tmp
none             50M  8.1M   42M  17% /var/log
none            5.0M   12K  5.0M   1% /var/home
none            300M  156K  300M   1% /var/tmp
none            3.5G  2.0M  3.5G   1% /var/sysmgr
none            600M  201M  400M  34% /var/sysmgr/ftp
none            100M     0  100M   0% /var/sysmgr/srv_logs
none             10M     0   10M   0% /var/sysmgr/ftp/debug_logs
none            3.0G  310M  2.7G  11% /dev/shm
none            600M     0  600M   0% /volatile
none            5.0M   12K  5.0M   1% /debug
/dev/sda5       4.7G  139M  4.3G   4% /mnt/cfg/0
/dev/sda6       4.7G  139M  4.3G   4% /mnt/cfg/1
/dev/sda4        21G  474M   20G   3% /bootflash
none            400M  3.3M  397M   1% /var/sysmgr/startup-cfg
/dev/sda3       4.7G  139M  4.3G   4% /mnt/pss
/dev/sda2       2.4G   69M  2.2G   4% /mnt/plog
/dev/sda7        21G  254M   20G   2% /logflash
bash-4.2#

bash-4.2$ sudo su -
Linux#
Linux#
Linux#
Linux#
Linux#
Linux#
Linux# whoami
root
Linux#
Linux#
Linux#
Linux#
Linux#
Linux#
Linux#
Linux# cat /proc/meminfo
MemTotal:       16402672 kB
MemFree:        12235656 kB
Buffers:          471856 kB
Cached:          1947636 kB
SwapCached:            0 kB
Active:          2382132 kB
Inactive:        1276432 kB
Active(anon):    1552648 kB
Inactive(anon):  1240200 kB
Active(file):     829484 kB
Inactive(file):    36232 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 4 kB
Writeback:             0 kB
AnonPages:       1239144 kB
Mapped:           174804 kB
Shmem:           1553800 kB
Slab:              83676 kB
SReclaimable:      34568 kB
SUnreclaim:        49108 kB
KernelStack:        3440 kB
PageTables:        16296 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     8201336 kB
Committed_AS:   10795204 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      887816 kB
VmallocChunk:   34358789872 kB
HardwareCorrupted:     0 kB
DirectMap4k:       14336 kB
DirectMap2M:    16754688 kB
Linux# run bash ps -el
-su: run: command not found
Linux# python


bash-4.2$ pwd
/bootflash/scripts
bash-4.2$ vi myteste-tcl
! write your script
bash-4.2$ cat myteste-tcl
puts "my first tcl script in Nexus 9k"
bash-4.2$ exit
Switch#  tcl bootflash:/scripts/myteste-tcl
my first tcl script in Nexus 9k
Switch#


Tuesday, September 22, 2015

Cisco 7600 with Total output drops on an interface

interface G1/1
  Input queue: 0/2000/0/0 (size/max/drops/flushes); Total output drops: 6469513


Diagnose:
show counters interface GigabitEthernet 1/1  | inc Dis
 8.                       ifInDiscards = 0
10.                      ifOutDiscards = 116890291
11.            txDelayExceededDiscards = 0
23.                         InDiscards = 0
24.                        OutDiscards = 116890273
48.              DelayExceededDiscards = 0


https://fasterdata.es.net/network-tuning/router-tuning/cisco/

interface G1/1
  hold-queue 4096 out
  hold-queue 1024 in

Wednesday, June 3, 2015

IOS-XR ASR 9k dhcp relay

When trying to configure dhcp in ASR 9k, got into some problems.
First, ASR 9k does not have dhcp server, at least till version 4.3.2. You will always need a external dhcp server. 
So, when configuring dhcp relay to my corporate dhcp, here's what I found:

Does not work:
interface  bvi2
   ipv4 helper-address vrf CORP 10.1.100.10
   ipv4 helper-address vrf CORP 10.2.100.10

Works:
dhcp ipv4
 profile CORP_DHCP relay
  helper-address vrf CORP 10.1.100.10
  helper-address vrf CORP 10.2.100.10
!
dhcp ipv4 interface bvi2 relay profile CORP_DHCP



Hope it helps! Regards

Sunday, March 15, 2015

ASAv Initial Configuration

Here is an inital configuration for ASAv in order to allow ssh access and start working with it:

INIT CONFIG ASAv MANUAL PROVISION

What do you need:
hostname: MYASAVxxx
mgmt ip: 10.1.2.x
interface: mgmt0/0 interface must be in mgmt vlan


hostname MYASAVxxx
interface Management0/0
 management-only
 nameif management
 security-level 100
 ip address 10.1.2.xxx 255.255.255.0
!
route management 0.0.0.0 0.0.0.0 10.1.2.1 1
ssh 0.0.0.0 0.0.0.0 management
username restclient password restclient encrypted privilege 15
aaa authentication enable console LOCAL
aaa authentication ssh console LOCAL
username restclient password restclient privilege 15 
crypto key generate rsa modulus 1024