Switch basics

Collision domain: How many devices can send or receive at a same time.

Broadcast domain: How far broadcast will travel before it stops.

SWITCH>                     User mode
SWITCH#                     Privileged mode [command >enable]
SWITCH(CONFIG)#    Global configuration mode [command #configure terminal]

Switch Security

sets enable password –> (config)# enable password cisco
encrypted enable password –> (config)# enable secret cisco

MOTD

Set motd –> (config)#banner motd [

*********************************************
DO NOT LOG IN
*********************************************[

Telnet

  1. Set password for telnet –> (config-line)# password cisco
  2. Enable login –> (config-line)#login

SSH

  1. Create User –> (config)# username nikhsil password cisco
  2. Assign domain name –> ip domain-name njoshi.com
  3. Create certificate –> crypto key generate rsa
  4. IP SSH V2 –> ip ssh version 2
  5. Force SSH –> trasport input ssh

Display all messages #terminal monitor

Port Security

  • Way to lock down what devices can plugin to your switch or how many devices can plugin to your switch
  • Prevent private devices to plugin to your network

List all mac address –> #show mac address table

Mac address security –> (config-if)# switchport mode access
Access mode means only end devices are allowed to connect to given port. No other switch can connect to given port.

Enable switch port security (config-if)# switchport port-security

Allow only one device to connect (config-if)# switchport port-security maximum 1

Policy violation action (config-if) # switchport port-security violation <protect/restrict/shutdown>
protect: Ignore if other devices are connected, don’t allow access other devices
restrict: Ignore and  log it

Security by particular mac address (config-if)# switchport port-security mac-address <H.H.H/sticky>
H.H.H: particular mac address
sticky: get address of connected device and mark it for security

Check Security status for port –> # show port-security interface fastEathernet 0/5

Speed and Duplex

Usually switch detects speed correctly issues is with duplex.

Set duplex (config-if)# duplex half

Set speed (config-if)#speed <10/100/auto>

CCNA – network simulation

I was looking for good network simulator for CCNA. After lot of search I found two very useful simulators.

  1. Cisco Packet Tracer – Cisco propitiatory simulator. This one is awesome for network device support they have provided. You can drag and drop router, links, PC, server and most importantly switches. There are very few simulators which supports switch operations out of the box. GUI mode operations are very very easy, also CLI mode is easily accessible. Only problem is this is closed box simulator hence you can not connect it with real life network.
  2. GNS3 - Open source graphical network simulator. Its free, easy to use and supports meany Cisco devices. Catch – no support for switch and more than that you must have your own Cisco IOS image. Concept is simple, feed the IOS to GNS3 and it will simulate whole network for you. But you can connect your GNS3 to real life network.

JNDI resources: JDBC connection pooling

What is JNDI resource? in simplest term the name that we will be using to identify resource(in our case connection JDBC connection pool to Oracle)

Resource creation

We will create global resource by adding its details in server.xml in tomcat.
$CATALINA_HOME/conf/server.xml

<Resource name="jdbc/myDB"
		    auth="Container"
		    type="javax.sql.DataSource"
		    username="<<DB_user>" password="<<DB_pass>>"
		    driverClassName="oracle.jdbc.OracleDriver"
		    factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
		    url="jdbc:oracle:thin:@localhost:1521:XE"
		    maxActive="20"
		    maxIdle="10"
		    maxWait="-1"
		   />

Config is simple as it looks
JNDI Name for resource will be : jdbc/myDB
username: database user name
password: database user password
driverClassName : In our case its Oracle dirvers
url: connection url to db server.

Context reference

Reference of resource will be specified in context.xml
$CATALINA_HOME/conf/context.xml

<ResourceLink name="jdbc/myDB"
           global="jdbc/myDB"
           type="javax.sql.DataSource"/>

Environment:

Tomcat 6
Oracle 10G Express edition

Working code

  1. Create user tomcat in Oracle with password tomcat
  2. Execute SQL to create table in tomcat schema
  3. Replace (or copy content of) server.xml & context.xml from config folder
  4. Copy jstl libs from lib folder
  5. Download and copy ojdbc6.jar from Oracle
  6. Copy JNDI folder in webapps

JNDI

Ref:
http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
http://www.datadisk.co.uk/html_docs/java_app/tomcat6/tomcat6_jdbc.htm