Sunday, November 3, 2013

root port vs designated port

It's probably easy to configure a switch to be a root switch. However, I've just realized that I missed something that I didn't understand the concept of what the root switch is.

There are two type of port, i.e.:

  1. root port
  2. designated port
Root port is a port telling us the path toward the root switch. While designated port is a port in direction of leaving away from the root switch.

By that definition, a root port will always a pair with designated port on its direct neighbor switch. And when a switch doesn't have any root port, it is definitely the root switch itself.


Saturday, November 2, 2013

Day #1 - root bridge and VLAN path

It's about the time to start again the CCIE journey that I've skipped for quite a while. Unfortunately I have to start everything again from zero. The good news, I think that I can start quicker at this time. I used to spend more time on GNS3, but at this time this is not an issue anymore.

Well, today I've started with some bridging configuration. And I decided to write all notes here to help me remembering the lesson

Q: How to configure a switch to be root bridge
A: Here are some items that I noticed

  • configure at the global configuration
  • command is spanning-tree vlan XXX root primary

Q: how to prevent VLAN traverse to a switch?
A: Here are the noted points

  • by restricting the VLAN on the interface level
  • use switchport command

Enough for today. Will continue tomorrow.

Wednesday, January 9, 2013

Inverse-arp

frame-relay scenario 1
---------------------------


R6:
interface Serial0/0
   encapsulation frame-relay
   ip address x.x.x.x y.y.y.y

by default, frame-relay inverse-arp will be on. To confirm, check:
    show frame-relay map

To clear inverse-arp:
    clear inarp

To make sure PVC is active,
    show frame-relay pvc

Tuesday, October 30, 2012

How to reset Cisco configuration



Cat2950# write erase
Erasing the nvram filesystem will remove all files! Continue? [confirm]y[OK]
Erase of nvram: complete
Cat2950#
Cat2950# reload

System configuration has been modified. Save? [yes/no]: n    

!--- Do not save the configuration at this prompt. Otherwise, the switch
!--- reloads with the current running configuration and does not reset to default.

Proceed with reload? [confirm]y                              

2w0d: %SYS-5-RELOAD: Reload requested

C2950 Boot Loader (C2950-HBOOT-M) Version 12.1(11r)EA1, RELEASE SOFTWARE (fc1)
Compiled Mon 22-Jul-02 18:57 by antonino
WS-C2950G-12-EI starting...

source: http://www.cisco.com/en/US/products/hw/switches/ps607/products_tech_note09186a00800c4546.shtml

Friday, October 12, 2012

send break on ILOM


  • Log in to 2 ILOM.
  • go to /HOST namespace.
-> cd /HOST

  • Type the following command and standby
-> set send_break_action="break"

  • In your second ILOM session, first start the system by typing the following command
-> start /SYS
  • After that, accessing the console through this command.
-> start /SP/console

Tuesday, October 9, 2012

how to find out what port is listening


netstat command to find open ports

# netstat --listen
To display open ports and established TCP connections, enter:
$ netstat -vatn
To display only open UDP ports try the following command:
$ netstat -vaun
If you want to see FQDN (full dns hostname), try removing the -n flag:
$ netstat -vat

lsof Command Examples

To display the list of open ports, enter:
# lsof -i
To display all open files, use:
# lsof
To display all open IPv4 network files in use by the process whose PID is 9255, use:
# lsof -i 4 -a -p 9255

turn off firewall on redhat


Here are the command:
service iptables save
service iptables stop
chkconfig iptables off

Tuesday, October 2, 2012

single mode on Solaris

To boot a solaris machine into a single mode. Execute the command below at any terminal
shutdown -i6 -y

Thursday, September 27, 2012

network troubleshooting in Solaris


I had an issue with Solaris where the OS is unable to find the network interface.
One of my college run the command below to troubleshoot:


dladm show-dev
dladm show-link
prtconf -D
vi path_to_inst


I'm not sure yet what the command are for. But I will just record it here for my reference in the future.

Friday, October 7, 2011

How to install kubuntu-desktop

I played with my laptop in struggling to install libgtk2.0-dev. Unfortunately my ubuntu-desktop crashed, I was unable to log-on via the GUI anymore and only able to have the command prompt.

I tried to reinstall ubuntu-desktop but the system doesn't happy at all.
Since I need to get this laptop going immediately, I tried to change the desktop with kbuntu.
here is the command i'm using
sudo apt-get install kubuntu-desktop

I also had to change my network setting to dhcp as well. It was using static before.

auto lo eth0
iface eth0 inet dhcp
iface lo inet loopback


Saturday, August 20, 2011

Create VIEW on MySQL

Here is the example to create a VIEW on MySQL

mysql> CREATE TABLE t (qty INT, price INT);
mysql> INSERT INTO t VALUES(3, 50);
mysql> CREATE VIEW v AS SELECT qty, price, qty*price AS value FROM t;
mysql> SELECT * FROM v;


Saturday, August 6, 2011

Move a table into different database on MySQL

I'm working with MySQL lately so I want to record some notes on the experience so I can refer back to this post when I need it again in the future.

Here is the command:
alter table old_db.foo rename new_db.foo

Simple, isn't it?

Sunday, June 26, 2011

To find out what application is listening on a port

I keep forgotten the command as mentioned on the subject of this blog.
Hopefully I can find out this command easily without having to googling anymore.
lsof -i :80

Tuesday, June 22, 2010

How to install VPN Client on Ubuntu 10.04

I was trying to install Cisco VPN client to enable my laptop -which is runing on Ubuntu 10.04- to allow this machine connect to my office via VPN.

I got several error messages when I tried to compile this application.
Fortunately, I found the page below.

Thanks to L.A.M.N.K for documenting the step-by-step so that I'm now able to use Cisco VPN client on
my Ubuntu.

First, download the source from the tuxx website.
Then, follow the steps that I copied and pasted from the L.A.M.N.K below

Cisco module again doesn’t let us compile against the new kernel in Ubuntu 9.04 and 9.10 beta:

/home/lamnk/vpnclient/interceptor.c: In function ‘interceptor_init’:
/home/lamnk/vpnclient/interceptor.c:132: error: ‘struct net_device’ has no member named ‘hard_start_xmit’
/home/lamnk/vpnclient/interceptor.c:133: error: ‘struct net_device’ has no member named ‘get_stats’
/home/lamnk/vpnclient/interceptor.c:134: error: ‘struct net_device’ has no member named ‘do_ioctl’
/home/lamnk/vpnclient/interceptor.c: In function ‘add_netdev’:
/home/lamnk/vpnclient/interceptor.c:271: error: ‘struct net_device’ has no member named ‘hard_start_xmit’
/home/lamnk/vpnclient/interceptor.c:272: error: ‘struct net_device’ has no member named ‘hard_start_xmit’
/home/lamnk/vpnclient/interceptor.c: In function ‘remove_netdev’:
/home/lamnk/vpnclient/interceptor.c:294: error: ‘struct net_device’ has no member named ‘hard_start_xmit’
make[2]: *** [/home/lamnk/vpnclient/interceptor.o] Error 1
make[1]: *** [_module_/home/lamnk/vpnclient] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.31-1-generic'
make: *** [default] Error 2
Failed to make module "cisco_ipsec.ko".

Before installtion I assume that you have the latest version 4.8.02.0030 and the required packages for compiling ie gcc, libstdc++6 … The kernel version should be from 2.6.30 to 2.6.32

  • Download the client and extract it
  • Go to vpnclient folder:
    cd vpnclient

  • Download patch file for 64 bit and apply it (users on 32bit systems can skip this step):

    wget http://lamnk.com/download/vpnclient-linux-4.8.02-64bit.patch

    patch < ./vpnclient-linux-4.8.02-64bit.patch

    sed -i 's/^CFLAGS/EXTRA_CFLAGS' Makefile

  • Download patch file for newer kernel (2.6.30+) and apply it:

    wget http://lamnk.com/download/vpnclient-linux-2.6.31-final.diff

    patch < ./vpnclient-linux-2.6.31-final.diff

  • Next we must edit a kernel source file

    sudo sed -i 's/const\ struct\ net_device_ops\ \*netdev_ops;/struct\ net_device_ops\ \*netdev_ops;/' `find /usr/src -name netdevice.h`

    Yes, it is a one liner, you should copy & paste that command instead of typing ;)The command's translation into English: find the string const struct net_device_ops *netdev_ops; and change it to struct net_device_ops *netdev_ops; in the file locates at

    find /usr/src -name netdevice.h

  • And finally, install Cisco VPN Client:

    sudo ./vpn_install

The patch files are not from me. All credit goes to the people at tuxx-home.at forum

Sunday, May 30, 2010

SSH with PHP

I want to create an application that will be able to connect to an SSH server via PHP. I was thinking of using TCL expect and then integrate PHP and the expect script somehow. Fortunately, before I tried that, I did some searching on google and found that there is an SSH wrapper already that can suit my need.

To install the wrapper on Ubuntu, please find the steps below:

1. Install apache and PHP first
sudo apt-get install apache2 php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart
2. Make sure that the server/computer have a fully qualified domain name (FQDN). Otherwise, apache2 may not be able to start.
sudo vi /etc/hosts
sudo vi /etc/hostname

3. Install the library for ssh wrapper
sudo apt-get install libssh2-1-dev libssh2-php

4. Confirm that ssh has been installed correctly
php -m | grep ssh2

You are expecting to see "ssh2"

5. Finish

Now you can start to write PHP script to connect to an SSH server



Sunday, May 9, 2010

Linux system monitoring command

I was trying to remember what commands I will have to remember when monitoring performance of a Linux server. Luckily, I found this blog and it has the list of the commands.

The explanation and example on the blog is very good. However, it is too long for me as I will only need to recall the command in the future and don't need to many explanation. Therefore, I think it will be good for me if I summarize the command here for my reference in the future.

Here are the tools:
#1: top - Process Activity Command
#2: vmstat - System Activity, Hardware and System Information
#3: w - Find Out Who Is Logged on And What They Are Doing
#4: uptime - Tell How Long The System Has Been Running
#5: ps - Displays The Processes
#6: free - Memory Usage
#7: iostat - Average CPU Load, Disk Activity
#8: sar - Collect and Report System Activity
#9: mpstat - Multiprocessor Usage
#10: pmap - Process Memory Usage
#11 and #12: netstat and ss - Network Statistics
#13: iptraf - Real-time Network Statistics
#14: tcpdump - Detailed Network Traffic Analysis
#15: strace - System Calls
#16: /proc file system - Various Kernel Statistics

Reference : here

Sunday, April 18, 2010

Removing Ubuntu from dual-boot with Vista

My computer is now running dual-boot Ubuntu and Vista. I've been using Ubuntu on my day-to-day working and almost never coming back to Vista for a while.
However, I will give this machine to someone else, and therefore I need to remove Ubuntu from the machine and switch it back to Vista.

Before completely removing Ubuntu, I did a research of how to recover back the MBR. Luckily, I found this website, and here are the steps to restore the MBR for Vista:

1. Put the Windows Vista installation disc in the disc drive, and then start the computer.
2. Press a key when you are prompted.
3. Select a language, a time, a currency, a keyboard or an input method, and then click Next.
4. Click Repair your computer.
5. Click the operating system that you want to repair, and then click Next.
6. In the System Recovery Options dialog box, click Command Prompt.
7. Type Bootrec.exe /FixMbr, and then press ENTER.

I haven't tried that yet, I will try it when I'm ready to hand-over this machine. Hope it will works as expected.



Thursday, April 8, 2010

Remote Desktop on Linux


As previously mentioned on the previous post, I'm now trying to use my Ubuntu and leave Vista.
There were several small problems I experienced when I had to remove some servers which are running Windows 2003. The small problem is that I'm unable to copy some text on my destop and paste it into the remote server.

I've just discovered that this can be solved by using RDPv5.


Linux to Cisco console via USB

I've been moving to Ubuntu linux for a while on my daily work. Therefore I have to find a way of using my Ubuntu to do whatever I used to do with Vista.
Today I've just managed to connect my Ubuntu to Cisco console via USB. (note: I'm using USB-to-serial converter).

Here are the steps of make it works:
1. check what is the name of the USB tty
$ dmesg | grep ttyUSB
[ 4272.667300] usb 2-1: pl2303 converter now attached to ttyUSB0

2. Configure the mincom to connect to the port
$ minicom -s

3. Configure the setting below
speed = 9600
parity = none
stop bit = 1
serial = ttyUSB0

4. save setup as dfl
5. exit from mincom
5. start minicom
$ minicom

you should be able to see the Cisco console right now.

Monday, February 22, 2010

Cisco Regular Expression

Below is the important table need to be noted for regular expression in Cisco.
Use \ (backslash) to match the character as is.

source: here

Character Special Meaning

period

.

Matches any single character, including white space.

asterisk

*

Matches 0 or more sequences of the pattern.

plus sign

+

Matches 1 or more sequences of the pattern.

question mark

?

Matches 0 or 1 occurrences of the pattern.

caret

^

Matches the beginning of the input string.

dollar sign

$

Matches the end of the input string.

underscore

_

Matches a comma (,), left brace ({), right brace (}), left parenthesis, right parenthesis, the beginning of the input string, the end of the input string, or a space.

brackets

[]

Designates a range of single-character patterns.

hyphen

-

Separates the end points of a range.