Sunday, June 30, 2013

Using Zend Debugger with PHP 5.3 installed on Debian 6

1. This entry is followed from this youtube post:-
http://www.youtube.com/watch?v=1kwQFzwSifE

The same is described in text:-

2. Zend studio web debugger  can be downloaded from this link
http://www.zend.com/en/products/studio/downloads

3. click the linux tab and copy the tar file to a folder in your linux system. untar the contents

4. create a folder zenddebugger in /usr/lib
5. copy the contents of the untarred folder to zenddebugger folder created  in /usr/lib in your linux system.

6. nano -w /etc/apache2/conf.d/debugger.ini  //creates a debugger.ini file
//write the following lines in the file:-

zend_extension=/usr/lib/zenddebugger/5_3_x_comp/ZendDebugger.so

zend_debugger.allow_hosts=192.168.1.0/24 //depends on the hosts which you want to allow

zend_debugger.expose_remotely=always

7. copy /usr/lib/zenddebugger/dummy.php to the directory in webserver where you have the code to debug. if your files are /var/www, then copy dummy.php there.

8. Restart apache /etc/init.d/apache2 restart

9. write a php script to show phpinfo( ) and verify whether zend debugger line is shown and an entry for zend debugger exists in the phpinfo( ) page.

Next post on integrating this with eclipse IDE..




Wednesday, July 4, 2012

LED indication in Cisco Switch

The following are the modes  of LED of a cisco switch port

1. Stat - status
solid green/flashing green- activity

2. Duplx
off-half duplex
green full duplex

3. speed

off-10 Mbps
green- 100 Mbps

4. RPS
indicates if Redundant power supply is present

Wednesday, November 2, 2011

installing debian using local mirror

A 'local' mirror comes in handy when debian is to be installed in multiple number of computers using netboot.

Usually, after the target system is booted by a debian 'image' loaded from a DHCP/TFTP server using bootp protocol by the target system, the installation program gives a choice of debian mirrors located in different countries to download files and complete the full system install on the hard-disk.

However, if this process is ok if its done to a single system. To install to many number of systems, it becomes tedious and time consuming, and if the internet connection fails, the process needs to be restarted from the beginning.

Taking these factors, I decided to have a very own local mirror for installation purpose.

I. First, I downloaded ISO image of CD #1 (containing installation files for debian MIPS systems).There are many such CDs containing the full debian packages. Usually, CD#1 is enough to make a system completely bootable. I can't use this CD for SGI O2 because, O2 does not recognize the ISO-9660 format which most CD burners use. The CDs to boot O2 needs to be burned with the linux CDRECORD command with some kind of 'boot' partition. Anyway, that is cumbersome, therefore, we opt for netboot approach.


II. Preparing the ftp server for installation:-

1. create a folder in your ftp server. name it say, debian6.

2. copy the dists and pool folder of the MIPS cd to this folder.





3. Take care that the debian6/dists/squeeze folder contains the files Release and Release.gpg. replace the existing files.

4.Also, please note that there are two folders called contrib and non-free in the /dists/squeeze folder. These folders refer to contributed and non-free software available in debian.

5. CD#1 does not contain much of contributed and non-free software. Therefore, during the installation, just answer 'no' to questions asked for using contrib and non-free software. Answering 'yes' may stop your installation as these files won't be found.

6. The bulk of installation files are present in the /debian6/pool/main/ folder. During the installation, if any files are shown as missing, then the same can be copied from the ftp.debian.org site to the folders located in the /pool/main/ folder to resume installation.


III. INSTALLING FROM THE LOCAL MIRROR
Step by Step installation:-
1. Change DEBCONF priority

2. Select the debconf priority to ‘low’
3. Now go to choose a mirror :-








Since, our mirror server ( otwo 69) supports http, choose http. Had we not done step # 1 and directly proceeded to step # 3, this option of choosing http/ftp would not have come up. This can be useful in situations when you are planning to install from a ftp location.
5. Enter the IP address of the mirror in hostname

6. Enter the directory name where the debian files are stored in the mirror


7. Enter the proxy information (if any), since we have none, select continue
8.The system finds an installation candidate and the version is listed as ‘squeeze’. Select the same and

Choose ‘continue’.
9. Now you are taken to the next step ‘Download Installer components, click ‘continue’

10. you can choose some optional components, but we don’t have to choose any, so we choose

‘continue’.

You will see the screen above. Now, Debian installation should proceed, answer any questions which the installation manager will ask, partition the disk as documented/blogged earlier.
11. when you come to the question of using NTP server, select ‘No’ since we are not using NTP server.

Monday, May 9, 2011

Ether channeling on Debian lenny having 2.6 kernel
Used an O2 with an inbuilt Ethernet port (100 Mbps with full duplex support ) and another NE2000 based card (10 Mbps with half duplex support). These two are connected to a Catalyst 2960G switch of CISCO.

These steps have to be followed to the tee:-

1. apt-get install ifenslave-2.6
2. Note the interfaces available for bonding (eth0, eth1 etc)
3. bring down these interfaces ifconfig eth0 down
4. Stop the network services /etc/init.d/networking stop
5. edit /etc/network/interfaces
6. comment out the entries for all interfaces eth0, eth1 etc
7. Add the following new entry:-

auto bond0

iface bond0 inet static
address
netmask 255.255.255.0
network
gateway
slaves eth0 eth1
bond_mode 0 # u can use any mode from 0 to 6
bond_miimon 100
bond_downdelay 200
bond_updelay 200

8. ifconfig bond0 up
9. /etc/init.d/networking start

The debian Ethernet bonding guidelines have been followed from:-
www.debianhelp.co.uk/bonding.htm

As far as my experiments go, I have not made any change in the switch end. The wikis and other sites I have consulted also don’t speak anything to do at switch end.

The main features of the various bond mode are described for reference:-

Mode Description Function
0 Round Robin Packets transmitted in round robin fashion over the available interfaces, provides loadbalancing and fault tolerance
1 Active Backup One active at a time. Only fault tolerance
2 Balance XOR Load balancing and fault tolerance.
Observation:-
However, on actual testing, fault tolerance did not work
3 Broadcast Fault tolerance. Transmits everything on all slave interfaces.
Observation:-
Using this config, If I ping another server, I get duplicate replies, i.e., (DUP) is written in ping replies.
4. 802.3 ad Dynamic Link aggregation. This is classic IEEE 802.3ad dynamic link aggregation. Requires 802.3ad support in switch and driver support for receving speed and duplex of each slave.
Observations:-
Removing eth1 from link did not disrupt the ping, however, removing eth0 from ping disrupted the ping. Activity seems to be happening on both eth0 and eth1 when connected. However, eth1 alone is not able to initiate the traffic nor receive replies. (perhaps because in my case eth1 is operating in half-duplex mode)
5 Balance TLB Transmit Load Balancing. Incoming traffic is received on active slave. Outgoing traffic is balanced according to load on each slave.
Observation:
Disconnecting either eth1 or eth0 stops the ping.
6 Balance ALB Provides both Transmit and Receive Load Balancing.

TRUNKING BETWEEN TWO SWITCHES (Cisco 2960 G) or trunking between a switch and a server with two or more network cards.

Each Etherchannel can consist of 8 ports, so the effective bandwidth achievable is 800 Mbps or 8 Gbps. There can be 6 etherchannel groups maximum.

Pagp,LACP & ON modes in the switch

We can configure ether channel in three modes, Port Aggregation Protocol (Pagp), Link Aggregation control Protocol (LACP) and an ‘on’ mode. Both ends of the etherchannel should be in the same mode. Pagp is a cisco proprietary protocol. LACP is IEEE 802.3 ad dynamic link aggregation protocol.

In case of Pagp and LACP, the system negotiates with other end to determine which ports should be active in the etherchannel. Incompatible ports are suspended. In case of ‘on’ mode, no such negotiations take place and all the ports are expected to be in the channel. If the ports at other end are not in ‘on’ mode, packet loss can occur.
Step by step procedure for configuring L2 Etherchannels:-
First Create a channelgroup

1. Config t

2. int port-channel 1 # 1 is the first port-channel, the second would be 2 and so on.
2. Switch port mode access
# if the etherchannels were between two switches, it would be switch port mode trunk
3. Switchport access VLAN 7
# assuming that these ports belong to vlan 7.If the ports are to be trunked to another switch, skip this step

4. spanning-tree portfast
# skip the above step for configuring ether-channels between switches.
5. no shut

Now, assign the ports to the channel group.Suppose we assign Gi0/30 to Gi0/33 to the channel-group1.
1. config t
2. interface range Gi0/30,Gi0/31,Gi0/32,Gi0/33
3. switchport access vlan 7 # if,used for trunking switches, omit this
4. switchport mode access # trunk if used for trunking between switches.
5. spanning-tree portfast # omit for trunking between switches
6. Channel-group 1 mode
# channel group can take values from 1-6. The parameter mode_name can take the following values:-


1. If you are planning to use PAgp
(a) Channel-group 2 mode auto
(b) Channel-group 2 mode desirable
2. If you are planning to use LACP
(a) Channel-group 2 mode active
(b) Channel-group 2 mode passive
3. If you are planning to use mode ON
(a) Channel-group 2 mode on

7. end
8. sh run
# verify your config.
9. To verify the channel-group assigned to ports run:-
sh run int Port-channel 1
10. To verify if etherchanneling is correctly setup, run:-
sh etherchannel 1 summary
Output will same as given below in last line (P) should be there.
*********************************************************************** Flags: D - down P -
bundled in port-channel I - stand-alone s - suspended
H - Hot-standby (LACP
only) R -
Layer3 S - Layer2 U - in use f - failed to allocate
aggregator
M - not in use, minimum links not met u - unsuitable for bundling
w - waiting to be
aggregated Number of
channel-groups in use: 34 Number of aggregators: 34
Group Port-channel Protocol
Ports ------+-------------+-----------+----------------------------------------------- 41
Po41(SU) LACP Gi9/27(P) Gi10/39(P)
*************************************************************************




The various modes are explained in detail here1:-
auto—Enables PAgP only if a PAgP device is detected. It places the port into a passive negotiating state, in which the port responds to PAgP packets it receives but does not start PAgP packet negotiation.
•desirable—Unconditionally enables PAgP. It places the port into an active negotiating state, in which the port starts negotiations with other ports by sending PAgP packets.
•on—Forces the port to channel without PAgP or LACP. In the on mode, an EtherChannel exists only when a port group in the on mode is connected to another port group in the on mode.
•non-silent—(Optional) If your switch is connected to a partner that is PAgP-capable, configure the switch port for nonsilent operation when the port is in the auto or desirable mode. If you do not specify non-silent, silent is assumed. The silent setting is for connections to file servers or packet analyzers. This setting allows PAgP to operate, to attach the port to a channel group, and to use the port for transmission.
•active—Enables LACP only if a LACP device is detected. It places the port into an active negotiating state in which the port starts negotiations with other ports by sending LACP packets.
•passive—Enables LACP on the port and places it into a passive negotiating state in which the port responds to LACP packets that it receives, but does not start LACP packet negotiation
EtherChannel Configuration Guidelines 2
If improperly configured, some EtherChannel ports are automatically disabled to avoid network loops and other problems. Follow these guidelines to avoid configuration problems:
•Do not try to configure more than 6 EtherChannels on the switch.
•Configure a PAgP EtherChannel with up to eight Ethernet ports of the same type.
•Configure a LACP EtherChannel with up to16 Ethernet ports of the same type. Up to eight ports can be active, and up to eight ports can be in standby mode.
•Configure all ports in an EtherChannel to operate at the same speeds and duplex modes.
•Enable all ports in an EtherChannel. A port in an EtherChannel that is disabled by using the shutdown interface configuration command is treated as a link failure, and its traffic is transferred to one of the remaining ports in the EtherChannel.
•When a group is first created, all ports follow the parameters set for the first port to be added to the group. If you change the configuration of one of these parameters, you must also make the changes to all ports in the group:
–Allowed-VLAN list
–Spanning-tree path cost for each VLAN
–Spanning-tree port priority for each VLAN
–Spanning-tree Port Fast setting
•Do not configure a port to be a member of more than one EtherChannel group.
•Do not configure an EtherChannel in both the PAgP and LACP modes. EtherChannel groups running PAgP and LACP can coexist on the same switch. Individual EtherChannel groups can run either PAgP or LACP, but they cannot interoperate.
•Do not configure a Switched Port Analyzer (SPAN) destination port as part of an EtherChannel.
•Do not configure a secure port as part of an EtherChannel or the reverse.
•Do not configure a port that is an active or a not-yet-active member of an EtherChannel as an IEEE 802.1x port. If you try to enable IEEE 802.1x on an EtherChannel port, an error message appears, and IEEE 802.1x is not enabled.
•If EtherChannels are configured on switch interfaces, remove the EtherChannel configuration from the interfaces before globally enabling IEEE 802.1x on a switch by using the dot1x system-auth-control3 global configuration command.
•For Layer 2 EtherChannels:
–Assign all ports in the EtherChannel to the same VLAN, or configure them as trunks. Ports with different native VLANs cannot form an EtherChannel.
–If you configure an EtherChannel from trunk ports, verify that the trunking mode (ISL or IEEE 802.1Q) is the same on all the trunks. Inconsistent trunk modes on EtherChannel ports can have unexpected results.
–An EtherChannel supports the same allowed range of VLANs on all the ports in a trunking Layer 2 EtherChannel. If the allowed range of VLANs is not the same, the ports do not form an EtherChannel even when PAgP is set to the auto or desirable mode.
–Ports with different spanning-tree path costs can form an EtherChannel if they are otherwise compatibly configured. Setting different spanning-tree path costs does not, by itself, make ports incompatible for the formation of an EtherChannel
Testing Etherchannel by enabling bonding on server and LACP on switch.

As debian Ethernet bonding supports 802.3 ad (mode 4), I guess, we can configure two ports in the switch in LACP mode active and the network interface in the server as mode 4 and then test the connection.

Result:
The lights in the switch did not turn green after the cables were connected. I suspect that I am using the onboard card in FDUP and the add on PCI card in half duplex. This might be the issue as it is explained in point No. 4 of etherchannel configuration guidelines.


Refrences :
1 & 2 : http://www.cisco.com/en/US/docs/switches/lan/catalyst2960/software/release/12.2_25_see/configuration/guide/swethchl.html
3. http://en.wikipedia.org/wiki/IEEE_802.1X

Saturday, June 19, 2010

subnet tutorial

Subnetting
Subneting is the procedure to create logical sub-networks of a given network using bits assigned to the host address space. Obviusly, subnetting therefore, reduces the address space for hosts as each subnet also needs to reserve addresses for network and broadcast.

Lets take the example of a class C network address. A class C network address is in the form of n.n.n.h, implying that the first three octets of the 32 bit IP address is used to refer to the network and the last 8 bit octet is used to represent the host. therefore, a class C network can address 256 no of hosts.

Subnet Mask


Subnet mask is a 32 bit number, which helps to identify the network portion in an IP address. This is done by bit anding the subnet mask with the IP address. The default subnet mask for a class C address is 255.255.255.0, this mask implies that no subnets have been created for the IP address, and the entire host address space ( 256) is under one network.

Creation of subnet masks other than default subnet masks for class C nework:-

x x x x x x x x denotes 8 bits of the host address space.

1 0 0 0 0 0 0 0 -> 128

1 1 0 0 0 0 0 0 -> 192

1 1 1 0 0 0 0 0 -> 224

1 1 1 1 0 0 0 0 -> 240

1 1 1 1 1 0 0 0 -> 248

1 1 1 1 1 1 0 0 -> 252

1 1 1 1 1 1 1 0 -> 254

Notice that, there is no zero between the ones, this is one rule of subnet masking. It is quite simple for class C addresses, but for class A and B address, it may get a bit unwieldy as the number of bits in the host portion are more.If you keep this rule of continous ones as above, it should be easy enough to list out the subnets for class A and B as well.

The last subnet mask is not used as it leaves just one bit for defining hosts and none for broadcast address and leaves you with many subnets without any hosts.

Finding out the network address from an IP address.


IP address 10.205.15.20
Subnet mask : 255.255.255.192

Bit AND result : 10.205.15.0

So, host number 20 is part of the 0 subnet and its the 20th host in the 0 subnet.

Another example:

IP address : 10.205.15.130
Subnet mask : 255.255.255.192
Bit AND result : 10.205.15.128
so, it is the 2nd host in 128 subnet

Finding out the subnets in an network, given the subnet mask


Suppose, the network given is 10.205.15.34
and subnet mask is 255.255.255.192

1. The number of subnets is 2^x (not applicable to 128 mask) where x is the number of masked bits. masked bits are the bits which are 1 in the host portion

The no of masked bits in 192 mask is 2. so, there are 4 subnets. Out of these 4 subnets , one subnet is the 0 subnet (00) and one is the 1 subnet (11). Earlier these two subnets were not considered as subnets, but from a new RFC released in 1995, 0 and 1 subnet is also allowed.


so the subnets are :

0 0 0 0 0 0 0 0 -->0

0 1 0 0 0 0 0 0 --> 64

1 0 0 0 0 0 0 0 --> 128

1 1 0 0 0 0 0 0 --> 192

Since the no of possible subnets using the 192 mask is given above, we can write out the network, first host, last host and the broadcast address of these subnets.

subnet 0

first host-1
last host- 62
broadcast-63
No of hosts=62
subnet 64


first host-65
last host- 126
broadcast-127
No of hosts=126-65=62
Subnet 128


first host-129
last host- 190
broadcast-191
No of hosts=190-129=62
Subnet 192

first host-193
last host 254
broadcast 255

No of hosts=254-193=62

So, total no of hosts in these 4 subnets is 62X4=248

had we used the default subnet mask of 255.255.255.0, we would have had 254 hosts. so we loose six addresses for defining the network and broadcast address for the four subnets.

Finding the no of subnets for a given mask (easier method)



for example you want to find out the number of subnets in 252 subnet mask

1 1 1 1 1 1 0 0 -> 252

subtract the subnet mask from 256 and add the result to itself till you reach the subnet mask.

256-252=4
so the subnets are 4, 8,12,16,20,24,28,so on upto 252.

No of hosts per subnet is 2^ (no of unmasked bits)-2
so, in this case it is 2^2-2=2

CIDR notation


classless internet routing domain represents IP address and subnet mask in a new notation:-

10.205.15.30/24 implies that 24 bits are masked, so this is a class C IP address, with no subnets (255.255.255.0). 255 is 8 nos of 1. so, 3x8=24

10.205.15.30/25 implies one bit of the host is masked so the subnet mask is 255.255.255.128

10.205.15.30/26 denotes 255.255.255.192 and so on.

Sunday, May 30, 2010

installing debian using local file server

I had been installing debian on O2 systems using internet wherein the machine after net booting would download the necessary components from the internet. However this was getting difficult for installing to large number of systems. So, the alternate method had to be found to install debian on these systems. I summarize the steps:-)
1. Use get to copy ftp.debian.org/debian/lists/lend

Sunday, May 2, 2010

CREATING HD VIDEOS USING SONY CAMCORDER

Info #2 : The video output from the analog cables (component) is of the interlaced type (denoted by initial i. With resolution of ------

The video output from HDMI is non interlaced type (progressive scan denoted by initial p)

Camcorder send info in SD if the analog input is used, even if content is recorded in HD.

HD content is only delivered through HDMI.


 

Info# 3: Burning and playing HD content on DVD.

Camcorder records in MPEG4 AVC/H.264 AVCHD format. HD content can be burned by connecting external Sony DVD writer capable of AVCHD format .The connection between DVD writer and camcorder is via USB cable supplied with camcorder. Note that l DVD writers are not capable of playing HD content. HD content can only be played using a BD player. This method just enables creation of HD content on DVD media. Some DVD players may not eject such HD-DVD.


 

Info # 4: Recording modes, bit rate , avg file size and max duration possible:

S.No

Camcorder Format

Codec & bit rate

Max duration

Avg file size/hr

1.

HD FH

AVC HD 16Mbps

9 h 40 m

8.27 GB

2.

HD HQ

AVC HD 9Mbps

19 h 40 m

4 GB

3.

HD SP

AVC HD 7Mbps

24 h

3.3 GB

4.

HD LP

AVC HD 5Mbps

32 h

2.5 GB

5.

SD HQ

MPG2 9Mbps

19h 40m

8.27 GB

6.

SD SP

MPG2 6Mbps

29h 10m

2.8 GB

7.

SD LP

MPG2 3Mbps

56 h

1.4 GB


 


 

Info : Exporting video to computer

Use PMB to export movies and pics from camcorder . Its quite intuitive interface and can be done easily. Software is smart, and movies once imported to the computer are not imported again.


 

Info: Exporting video to hard disk

Only HD movies can be exported back to camcorder. Another reason for recording in HD J. Again, the PMB interface is intuitive and can be done easily.

Info: converting videos to wmv and mpg2

Can be done through PMB very easily.

Info: Playing the HD video on PC

Can be done through PMB .Splash player also plays the MPEG4 AVC/H.264 AVCHD created by sony camcorder fairly well. Splash player has fullscreen mode which is not there in the PMB interface.


 

Info: Burning HD DVD using Camcorder one touch button

Connect camcorder to computer using USB cable. Insert a DVD in the computer. Simply pressing the DISC BURN button on camcorder burns the HD video and photos to the DVD. But, the DVD so created can only be readable in blu ray players or Play Station3 not ordinary DVD players.


 

Info: Burning SD-DVD from HD content in the camcorder.

Use PMB software to create SD-DVD from the transferred HD content on computer.


 


 

Info: Playing HD disc on computer

HD DVD discs can be played using the AVCHD player included with PMB software.