#to remove metacharacter from the script
regsub -all {\^M} $rtr_output " " rtr_output
#To replace old value with new one across file
:%s/old_text/new_text/g
#To run snmp in linux
load net-snmp into execution server.
Login as root into your execution server and execute – “yum install net-snmp net-snmp-utils net-snmp-devel –y”.
#How to create a soft link ?
ln -s test_PROCS test_PROCS.example
#to match no specific pattern in receive
Receive $handle {no pattern^} 2
#Init 0 is used to create the individual qemu for all the process present under one vm
#tar -xvf ltp-full-20110606.bz2
#step to complile ltp
[root@ckim-u10 nlekhak]# ls
ltp-full-20110606.bz2
[root@ckim-u10 nlekhak]# tar -xvf ltp-full-20110606.bz2
[root@ckim-u10 nlekhak]# ls
ltp-full-20110606 ltp-full-20110606.bz2
[root@ckim-u10 ltp-full-20110606]# ./configure
[root@ckim-u10 ltp-full-20110606]# make all
[root@ckim-u10 ltp-full-20110606]# make install
[root@ckim-u10 ltp-full-20110606]# cd /opt/ltp
#too find a total no of testcases found in bin dir
[root@ckim-u10 bin]# ls -l . | egrep -c '^-'
2202
#Package
Package can have multiple patches and series will show a list of patches .We use automake to generate config and make file for cross compilation. All changes that are made eventually will be saved in the form of patches. Quilt is use to manage the patches
#Hypervisor
In computing, a hypervisor, also called virtual machine manager (VMM), is one of many hardware virtualization techniques that allow multiple operating systems, termed guests, to run concurrently on a host computer. It is so named because it is conceptually one level higher than a supervisory program. The hypervisor presents to the guest operating systems a virtual operating platform and manages the execution of the guest operating systems. Multiple instances of a variety of operating systems may share the virtualized hardware resources. Hypervisors are installed on server hardware whose only task is to run guest operating systems. Non-hypervisor virtualization systems are used for similar tasks on dedicated server hardware, but also commonly on desktop, portable and even handheld computers.
The term is often used to describe the interface provided by the specific cloud computing functionality infrastructure as a service (IaaS). The term "hypervisor" was first used in 1965, referring to software that accompanied an IBM RPQ for the IBM 360/65. It allowed the model IBM 360/65 to share its memory: half acting like a IBM 360; half as an emulated IBM 7080. The software, labeled "hypervisor," did the switching between the 2 modes on split time basis. The term hypervisor was coined as an evolution of the term "supervisor," the software that provided control on earlier hardware.The Red Hat Kickstart installation method is used primarily (but not exclusively) by the Red Hat Enterprise Linux operating system to automatically perform unattended operating system installation and configuration. Red Hat publishes Cobbler as a tool to automate the Kickstart configuration process.
#Patch
A patch is a piece of software designed to fix problems with, or update a computer program or its supporting data. This includes fixing security vulnerabilities and other bugs, and improving the usability or performance. Though meant to fix problems, poorly designed patches can sometimes introduce new problems.Patch management is the process of using a strategy and plan of what patches should be applied to which systems at a specified time.
#to remove ^M character form a vi file
:%s/(ctrl-v)(ctrl-m)//g
#. means present dir
#diff source destination > newfile
#copy
10yy p
dd p
#grep -r "test" *
#how to source cshrc file
env
vi ~/.cshrc
source ~/.cshrc
#to provide full permission
chmod 777 *
#how to kill session in vnc
login to main-server with vnc server xxx
execute ps-ef | grep "nlekhak"
see all the session and kill using kill -9 pid
#How to do CVS
cvs add dir
cvs commit dir
cvs stat dir or filename
cvs add filename
cvs commit filename
if need merge option is shown
do cvs update filename
#How to delete certain no of lines from a file.
:set nu
$
Go to current line from where u want to start deleting.
Calcute the difference
Esc
Ndd
:set nonu
#debug process
Debug on
Use debug on in the script where u r having problem
Eg :
#Step 1
#This step is used to configure the aaa authentication
aetest::log -diag [enaFrame -style double "STEP [incr step]: Configure a AAA authentication."]
set rtr $xxx_global($rtr1,handle)
debug on
set result [procAAA -rtr $rtr\
#check the execution window where u are executing the script
xxx-vm:0_RP0_0#34: procAAA -rtr $rtr -user_type $user_type -user_mode $user_mode -ui...
dbg34.0> set rtr $xxx_global($rtr1,handle)
test-1_calv
dbg34.1> c
config terminal
Entering configuration mode terminal
xxx-vm:0_RP0_0(config)# aaa authent
--give c for continue
--give n to execute next command
#meanings
Init 0 === power down
Init 6 === restart
#shell act as interface between user and hardware
#shell is a command interpreter
#shell creates an environment to work on.
Default input: keyboard
Default output/error: console
#to check all rpm packages
rpm -qa
There are 10 directories in linux
1.tmp
contains the temporary files lik e cache
2.var
varibales, logs, rpm database, crash dump, information about mail directoy
3.usr (user shared resource)
contain information about manual pages, 3rd party software like java
4.etc
Systemm configuratiuon information, username,password, uid, gid
5.bin
all user executables binaries and commands . Shell resides in bin dir
6.sbin
system executables .super user can only execute thsese.
7.Optional
third party software information like perl , java packages
8.lib
contains lib files whether 32bit or 64bit
9.home
home dir for that user /home/username
10.dev
device files for each and every componenets hardware.
#linux default shell is bash
Bourne shell sh
bourne again shell bash
korn shell ksh
prompt for these 3 is $
-----------------------------------
c shell csh
tenex c shell tcsh
prompt for these 3 is %
For root user prompt is always # for all shell
Files:
profile files and rc(run control) files resides in home directory
In profile file we set env and paths. default system wide profile file is present at /etc/profile
user profile file gained precedence over system mode profile file.
Rc file is used when u want to move from one shell or another shell
Run levels or states:
by default runlevel is 5
0 - shutdown
1 - maintenance
2 - multiuser/without network
3 - multiuser/withh network/without GUI
4 - user defined
5 - multiuser/with network/with graphical
6 - reboot
default run level is defined in /etc/init
process id for root is 0
We have two harddisk in linux
first harddisk : hda
second harddisk : hdb
#!/bin/bash
#!== predefined header
/bin/bash == absoulte path of the shell
used to make system and other understand that we have written program in bash shell
referencing path to root : absoulte path
referencing path to current directory : relative path
default permission for file in linux is 644
max permission for file in linux is 666
default permission for dir in linux is 755
max permission for dir in linux is 777
#two ways to execute scripts
1. sh name.sh == run time execution , no need of permission to execute
2. ./name.sh absolute path way of execution , need permission to execute
Debugging
echo $-
vx == put immediate after header in script
to disable debug
set +vx
Varibles : two types
environmental variables : system defined . Upper case
User defined : local and global
deamon : which is not associated with any process ie orphan process
zombie : eg defunct . process which does not exist but still appears as if it is running but consume memory space
solution : for every pid there is ppid
find the parent process which is initiating this process or reboot the machine but never kill pid 1
ps -aef == will give ppid also
#advacned security permission
uid 4 == ownwer will provide this level of permission to others for execution in his absence
gid 2 == group id
sticky bit 1 ==used in /tm dir . only owner who has created can delete it.
4 blocks in linux:
booting
filesystem
inode
data block
defualt file system in linux redhat is ext 3 and 4 similar to NTFS on windows.
#to print only hidden files
ls -ad .*
#to find hostname
uname -n
#to create empty file
touch
using touch command we can modify date for file creation as well
#Debugging Code
One of the easiest way is use of puts .
The first step to debugging a Tcl script is to examine the Tcl error output closely. Tcl provides a verbose error information that lead you to the exact line where a coding error occurs. Tcl error messages consist of a set of lines. The first line will describe the immediate cause of the error (Incorrect number of arguments, invalid argument, undefined variable, etc). The rest of the message describes more details about where the error occurs. For example, this procedure has a fairly common error - the closing brace and bracket are in the wrong order:
proc hasError {a} {
return [expr {$a+2]}
}
The error message is:
missing close-bracket
while executing
"return [expr {$a+2]}
"
(procedure "hasError" line 2)
invoked from within
"hasError 1"
The first line describes the error (missing curly bracket), and the rest of the lines show the exact line in the program (return [expr {$a+2]}), and where that line occurs (second line in the hasError procedure)
#bgp takes 3-4 minutes to converge.
Cisco IOS XR operating software maintains two resource management planes from a
router access perspective:
¦ Admin plane
¦ Secure domain router (SDR) plane
#Admin Plane
The admin plane maintains responsibility for the owner SDR, and certain administrative
responsibilities for all other nonowner SDRs. These functions include user control over
power, fan-trays, fabric modules, and environmental aspects of the router required to
maintain normal operations. The admin plane is accessible only to a type of user known as
the root-system user. IOS XR requires configuration of a root-system user using the initial
setup dialog. IOS XR router does not allow the system to operate without a user
group configuration. If all users and external AAA configurations get deleted, IOS XR
prompts the next logged-in user for a new username and password.
#Data Plane:
The data plane (sometimes known as the user plane, forwarding plane, carrier plane or bearer plane) carries the network user traffic. The control plane carries signaling traffic. Control packets originate from or are destined for a router. The management plane, which carries administrative traffic, is considered a subset of the control plane.
#Control Plane :
In routing, the control plane is the part of the router architecture that is concerned with drawing the network map, or the information in a (possibly augmented) routing table that defines what to do with incoming packets. Control plane functions, such as participating in routing protocols, run in the architectural control element.[1] In most cases, the routing table contains a list of destination addresses and the outgoing interface(s) associated with them.
#HSRP has UDP messages and convergence depends on timers configured default is hello : 3 sec and holddown : 10 sec
#Why should IBGP sessions be fully meshed within a Transit AS?
ANy two routers that have formed a TCP connection in order to exchange BGP routing information are called ppers
#AS_PATH attribute must exists in update packet.
#When two routers establish a TCP enabled BGP connection, they are called neighbors or peers. Each router running BGP is called a BGP speaker. Peer routers exchange multiple messages to open and confirm the connection parameters, such as the version of BGP to be used. If there are any disagreements between the peers, notification errors are sent and the connection fails. To be a neighbor of BGP no need to be directly connected.
#eBGP multihop option is required when load sharing over multiple equal-bandwidth parallel links from a single CE router to a single ISP router over eBGP.
#How the type of data is determined in 802.3
Following the type/length field is the actual data contained in the frame. After physical-layer and
link-layer processing is complete, this data will eventually be sent to an upper-layer protocol. In the case of Ethernet, the upper-layer protocol is identified in the type field. In the case of IEEE 802.3, the upper-layer protocol must be defined within the data portion of the frame, if at all. If data in the frame is insufficient to fill the frame to its minimum 64-byte size, padding bytes are inserted to ensure at least a 64-byte frame.
#The maximum number of routers per ospf area typically depends on these factors.
the kind of ospf areas being implemented.
the number of external LSAs in the network.
how well the areas can be summarized.
#Advantages of creating multiple areas in OSPF.
less frequent SPF calculations.
smaller routing tables
reduced LSU overhead.
# In which address the neighbours reply for the hello packet sent by the source router to form adjacency?
Ans: 224.0.0.6
#LSAck:
LSAck packet will be send as an Ack only for the following packet types
Database Description
Link-State Request
Link-State Update
#Router ID:
While sending the "hello packet" the highest configured ip address on an active interface is choosen as a "Router ID" by default, unless a loopback interface or the router id is configured.
#Process ID:
An internally used number to identify the OSPF routing process.The process ID does not need to match process IDs on other routers.
#If we have 70 to 80 areas then how we can connect all the areas to the backbone area?
If we have more areas in OSPF then it is not possible to connect all the areas to the backbone area.For that "Virtual link" is used. We use virtual routes only when we are not able to reach the area-0 directly. usage of virtual routes is a poor design. so how many ever areas we have should connect to area 0 to reach other areas.
CAM VS TCAM
Multilayer switches forward frames and packets at wire speed by using ASIC hardware. Specific Layer 2 and Layer 3 components, such as routing tables or Access Control Lists (ACLs), are cached into hardware. Routing, switching, ACL and QoS tables are stored in a high-speed table memory so that forwarding decisions and restrictions can be made in high-speed hardware. Switches perform lookups in these tables for result information, such as to determine whether a packet with a specific destination IP address is supposed to be dropped according to an ACL. Cisco Catalyst switches deploys these memory tables using specialized memory architectures, referred to as CAM and TCAM.
CAM
CAM stands for Content Addressable Memory which is a special type of memory used by Cisco switches. In the case of ordinary RAM the IOS uses a memory address to get the data stored at this memory location, while with CAM the IOS does the inverse. It uses the data and the CAM returns the address where the data is stored. Also the CAM is considered to be faster than the RAM since the CAM searches the entire memory in one operation. CAM tables provide only two results: 0 (true) or 1 (false). CAM is most useful for building tables that search on exact matches such as MAC address tables. The CAM table is the primary table used to make Layer 2 forwarding decisions. In the case of Layer 2 switching tables, the switch must find an exact match to a destination MAC address or the switch floods the packet out all ports in the VLAN.
The table is built by recording the source address and inbound port of all frames. As frames arrive on switch ports, the source MAC addresses are learned and recorded in the CAM table. The port of arrival and the VLAN are both recorded in the table, along with a timestamp. If a MAC address learned on one switch port has moved to a different port, the MAC address and timestamp are recorded for the most recent arrival port. Then, the previous entry is deleted. If a MAC address is found already present in the table for the correct arrival port, only its timestamp is updated.When a frame arrives at the switch with a destination MAC address of an entry in the CAM table, the frame is forwarded out through only the port that is associated with that specific MAC address. The information a switch uses to perform a lookup in a CAM table is called a key. For example, a Layer 2 lookup would use a destination MAC address and a VLAN ID as a key.
To view the contents of the CAM table, you can use the following EXEC command:
Switch# show mac address-table dynamic [address mac-address | interface type mod/num | vlan vlan-id]
TCAM
TCAM stands for Ternary Content Addressable Memory which can match a third state, which is any value. This makes TCAM a very important component of Cisco Layer 3 switches and modern routers, since they can store their routing table in the TCAMs, allowing for very fast lookups, which is considerably better than routing tables stored in ordinary RAM. TCAM is a specialized CAM designed for rapid table lookups.
TCAM provides three results: 0, 1, and "don't care." TCAM is most useful for building tables for searching on longest matches such as IP routing tables organized by IP prefixes. The TCAM table stores ACL, QoS and other information generally associated with upper-layer processing. As a result of using TCAM, applying ACLs does not affect the performance of the switch.
Most switches have multiple TCAMs so that both inbound and outbound security, as well as QoS ACLs, can be evaluated simultaneously or entirely in parallel with a Layer 2 or Layer 3 forwarding decision.
The term VMR (Value, Mask and Result) refers to the format of entries in TCAM. The "value" in VMR refers to the pattern that is to be matched; examples include IP addresses, protocol ports, DSCP values, and so on. The "mask" refers to the mask bits associated with the pattern and determines the prefix. The "result" refers to the result or action that occurs in the case where a lookup returns a hit for the pattern and mask.
This result might be a "permit" or "deny" in the case of a TCAM for ACLs, values for QoS policies in case of QoS or a pointer to an entry in the hardware adjacency table that contains the next-hop MAC rewrite information in the case of a TCAM used for IP routing.To see the current TCAM resource usage, use the show tcam counts EXEC command. To see the current TCAM partitioning, you can use the show sdm prefer EXEC command.
Most of the traditional Layer 2 Cisco switches has only CAM for Layer 2 switching, while some Layer 2 Cisco switches has TCAM for QoS and not for routing, while layer 3 switches has the routing TCAM. CAM and TCAM are the most important parts of the so called ASICs that Cisco switches leverage for line-speed fast switching.
Catalyst switch architecture supports the ability to perform multiple lookups into multiple distinct CAM and TCAM regions in parallel. As a result of this ability to perform multiple lookups simultaneously, Catalyst switches do not suffer any performance degradation by enabling additional hardware-switching features such as QoS and IP ACL processing.
No comments:
Post a Comment