Perl – Get files and directories with the glob function

Recently, as part of a larger Perl application, I had to get all the files and sub-directories of the working directory. Using the built-in ‘glob’ function, I was able to quickly implement a subroutine to do this and also differentiate a file from a directory. In a list context, as demonstrated below, the ‘glob’ function returns a list of file/directory names that match the pattern. I then loop through this list and differentiate a file from a directory and store it in its respective array. Pretty quick and simple! Continue reading

Posted in Perl, Programming Languages | Tagged , , , , , , , | 3 Comments

Setup Telnet Access on Cisco Switches

This quick lab assumes you already have an IP address for telnet assigned on the Cisco switch. Once that is setup and you are able to ping the IP address, you can setup telnet access on the Cisco switch with the following commands: Continue reading

Posted in Cisco, Labs, Networking | Tagged , , , , | Leave a comment

Possible Reasons for LAN Traffic Congestion

If you are experiencing slowness on your LAN here are some possible reasons that you can investigate:
Continue reading

Posted in Networking | Tagged , , , , , , , , , , , , | Leave a comment

Useful FTOS “show” commands

There are several FTOS “show” commands that can provide very useful information regarding Force10 Networks switches/routers. I have outlined a number of these very useful commands with a short description of each below. However, keep in mind that although most of the commands I reference below are available on all Force10 platforms some of the commands may only pertain to specific Force10 platforms such as the C-Series or E-Series. Continue reading

Posted in Force10 Networks, Networking | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Use Perl’s regex to count the # of words in a file

In the below code I use Perl’s regex capabilites to count the # of words in a file. Notice I used “\s” in the regex expression to account for not only spaces but also tab and new line characters. In addition, it is important to account for whitespace characters at the start of a sentence, because the “split” function would end up counting the starting whitespace as a valid entry. Continue reading

Posted in Perl, Programming Languages | Tagged , , , , , , , , , , , , , , , , , | Leave a comment

Port Monitoring on Force10 Switches

In this lab I will demonstrate how to do port monitoring on Force10 switches and capture the packets using a network protocol analyzer (Wireshark in this case). Port monitoring allows the copying of all incoming/outgoing packets on a specific port to be mirrored/forwarded to another port where a network protocol analyzer is attached to analyze the traffic. Port monitoring is sometimes also referred to as packet sniffing, and, as you have probably guessed, packet sniffing can be used for malicious purposes. For the majority though port monitoring or packet sniffing is used for a variety of troubleshooting, security, and reporting tasks. Continue reading

Posted in Force10 Networks, Labs, Networking | Tagged , , , , , , , , , , , | 1 Comment

Scalar and List Contexts in Perl

One of the most important concepts to understand in Perl programming is that of evaluation based on context. In Perl, an operation such as an assignment or function call can give two different results based on the context of the expression. You see, in Perl, every operation behavior depends on the context in which it is called. A classic example is when using the “localtime” function. In a scalar context, the “localtime” function returns the current date and time. However, in a list context the function returns a nine-element list as shown below. Continue reading

Posted in Perl, Programming Languages | Tagged , , , , , , , , , , , | Leave a comment

Setup VRRP with Force10 Switches

In this lab I setup Force10 switches with Virtual Router Redundancy Protocol (VRRP). VRRP is a redundancy protocol used to eliminate a single point of failure between a gateway and its respective hosts within the same subnet. I use three different Force10 switches: E1200 [FTOS 8.4.2.1], S60 [FTOS 8.3.3.4], and S55 [FTOS 8.3.5.0]. Below is a diagram of the network and the commands I used to configure VRRP. Continue reading

Posted in Force10 Networks, Labs, Networking, Protocols | Tagged , , , , , , , , , , , , , , , , | 2 Comments

Unix shell script – convert Mac ASCII file to Unix ASCII file

With some applications like Microsoft Word you can save a file in ASCII format. However, for new lines Macs use a carriage return (ASCII character 015) while Unix uses a linefeed (ASCII character 012). If you save the file as ASCII on a Mac and open the file up in Unix it will look like one very long paragraph. Just to be complete, I will mention that Microsoft Windows uses a carriage return + linefeed combination between lines of text. Below is a shell script that will take a number of file inputs in Unix and convert the Mac files to the correct Unix format. The original file will be overwritten. At the command prompt you would enter the command as “mactounix [macfile 1] [macfile 2] [macfile 3]” etc… The is assuming you save the code to a file called mactounix and made it executable (chmod +x mactounix). Continue reading

Posted in Linux, Operating Systems, Programming Languages, Shell Scripts | Tagged , , , , , , , , , | 1 Comment

Setting up Cisco EtherChannels – Static, PAgP, and LACP

In this lab I used a Cisco Catalyst WS-C3750G-24TS switch [IOS 12.2(25)SEE3] and a Cisco Catalyst WS-C3560G-24TS switch [IOS 12.2(40)SE]. I also physically connected GigabitEthernet 1/0/17 on the Catalyst 3750G to GigabitEthernet 0/17 on the Catalyst 3560G; I did the same for GigabitEthernet 1/0/18 and GigabitEthernet 0/18 respectively. At this point I have two GigabitEthernet connections between the switches. Continue reading

Posted in Cisco, Labs, Networking, Protocols | Tagged , , , , , , , , | 1 Comment