Cisco Live 2017 Las Vegas Tips and Tricks

This year I was lucky enough to be sent on a trip to Cisco Live in Las Vegas for my work. I had never been to anything like this before, and I thought a small write-up about some tips and tricks I learned along the way would be prudent.

Swag

This one’s easy and well known. There is tons of swag to be had. You get a backpack from Cisco for the event, so use it to fill with swag. Bags, USB drives, whatever. Carry it on the plane back home.

Food

Cisco will feed you breakfast (7 – 8:30 AM), so don’t waste any money on your own breakfast. They will also provide lunch. The only thing you need to worry about is dinner. They even have beer from 5-7 PM.

Coffee-wise, they have you covered, too, but that first cup in the morning when you wake up is on you, unless you roll out of bed and into the event at 7am.

Transportation

I think most of the hotels around have a free shuttle service to the hotels hosting the events. Use these to avoid the cabs. Also, theres a tram that runs from the Excalibur to Mandalay Bay. Exalibur is right across the street from MGM Grand. Figure out how to access the pedestrian bridges that cross Las Vegas blvd and it will make life easier.

Actually Learning Something

There is literally world-class talent here paid to answer your stupid questions, and they are also paid to not make you feel stupid for asking them. In the weeks leading up to the event, start making a list of things you always wanted to know, and do your best to find the right person to ask. Even if you don’t ask the right person, they’ll just point you in the right direction.

Free Certification Exam

Take a free certification exam. It doesn’t matter if you are not prepared, just pick one you are most interested in and give it a go. I had been studying for the CCIE routing and switching for 3 years by this point and still wasn’t ready to take it, but I did anyways. I failed, but at least I wasn’t on the hook for the $400, and I got great benchmark on what I needed to work on (by the way, this exam is crap).

Vegas

Vegas is freaking hot and most everyone is in their own zone. Drink a little and have fun with the other attendees to make the most of it. It’s probably not a good idea to go out at night during the week, as you will likely just spend too much money and lose out on the whole reason you are here: to learn. Drink a little, learn a lot.

From talking to past-attendees, a lot of the stuff is repetitive from year to year, so maybe its not a good idea to come consecutive years. Also, all of the talks get posted online.

I had a ton of fun, and the Vegas experience was fun. I recommend giving it a go if you can get work to fork over the Cisco learning credits and money for travel/food.

Advertisements

Raspberry Pi 2 Timelapse Output to Video

I’ve done some nifty timelapses in the past. This time, I wanted to make them a little more convenient to view and maintain. I had recently gained access to a nice view, so I thought now was a good time to put something together.

The skinny of the project is:

  • A Raspberry Pi 2 with the old V1 camera board, 64GB MicroSD Card
  • Apache2 web server
  • Small script to take all the pics
  • Another small script to convert the pics to mp4 movie, and do some clean up

Here’s what my setup looks like. That’s just a phone windshield mount. I also am using this camera case from Amazon.

IMG_20160804_153321

Script to take the pictures

This script runs every minute. You pass it in a parameter to tell it how often to take the pictures. I know the -t (time to take pictures) and -tl (timelapse mode) parameters exist, but I learned of them after making my script, so I just decided to keep it this way:

#!/bin/bash

# This script takes a variable amount of pictures over 1 minute. The script takes in a parameter
# to indicate how many times per minute to take a pic. The output
# is saved to a directory, ~/camera/time_lapse_images, and a copy is written to the root
# of the web server so you can see a “current view”.

# Loop for a minute, taking a pic every specified amount of seconds
for x in $(seq 1 60)
do

mod=$(( $x % $1 ))

if [[ $mod -eq 0 ]]; then

# We need to name the files sequentially to combine them to mp4 video later. This little loop
# determines what to name the file so they’re sequential.
name=still
if [[ -e /home/pi/camera/time_lapse_images/$name.jpg ]] ; then
i=1
while [[ -e /home/pi/camera/time_lapse_images/$name-$i.jpg ]] ; do
let i++
done
name=$name-$i
fi

#Record the still and copy the current view over to the web server root
sudo raspistill -o /home/pi/camera/time_lapse_images/$name.jpg -w 1280 -h 720
sudo cp /home/pi/camera/time_lapse_images/$name.jpg /var/www/still.jpg -f
fi
done

Script to make the video and clean up the old files

This script runs every night at midnight. I’m using¬†ffmpeg version 0.8.17-6:0.8.17-1+rpi1:

# move the previous days images to the processing folder
mv /home/pi/camera/time_lapse_images/*.jpg /home/pi/camera/time_lapse_images/timelapse_processing/ -f

# make the movie
ffmpeg -i /home/pi/camera/time_lapse_images/timelapse_processing/still-%d.jpg /home/pi/camera/time_lapse_images/timelapse_processing/video.mp4

# archive the previous day’s movie
now=$(date +”%m_%d_%Y” -d “2 days ago”)
sudo mv /var/www/video.mp4 /var/www/video-archive/timelapse_$now.mp4

# mv the movie to /var/www/
sudo mv /home/pi/camera/time_lapse_images/timelapse_processing/video.mp4 /var/www/ -f

# delete the processed images
rm /home/pi/camera/time_lapse_images/timelapse_processing/*.jpg -f

Super-simple webpage for viewing the current view and timelapses

My webpage to serve the image and timelapse video is really simple. I am using a little bit of JavaScript to update the current view image without refreshing the whole page:

<html>

<body>

<center>

<h1>Raspberry Pi Cam</h1>

<!– <meta http-equiv=”refresh” content=”120″ > –>

<h2>Current view – Refreshes every 10 seconds</h2>

<!– Refreshes the still image every 10 seconds –>

function refreshIt() {
if (!document.images) return;
document.images[‘still.jpg’].src = ‘still.jpg?’ + Math.random();
setTimeout(‘refreshIt()’,10000); // refresh every 10 secs
}

</head>

<body onLoad=” setTimeout(‘refreshIt()’,5000)”>

<img src=”still.jpg” style=”width:1280;height:720px” name=”still.jpg”;>

<br>
<br>

<h2>Timelapse recording of previous day</h2>
<video width=”1280″ height=”720″ controls>
<source src=”video.mp4″ type=”video/mp4″>
<source src=”video.ogg” type=”video/ogg”>
</video>

<br>

<a href=”video-archive/”>Archived Timelapse Videos</a>

</center>

</body>
</html>

Timelapses

And here’s some fruit of the labor! Pardon the reflection and dirty window ūüė¶

Generating Random Network Traffic with IPerf

When you setup a nice bandwidth monitoring application, it is generally acceptable to just set it and forget it; the data you get is usually taken at face value. I started to wonder how I could test the accuracy of the data given by a bandwidth monitoring application. I could use an Ethernet test set, like a JDSU T-berd to pump accurate amounts of traffic through an interface then match that up with what the graph sees, but I have to manually adjust the traffic if I want to test if the graph is accurately representing the peaks and troughs that come along with typical data use.

So I finally got around to coding up a little bash script to fire off iperf to generate random amounts of traffic over a given time. For those unfamiliar with iperf, it¬†is an easy to use, client/server application you can use to generate all types of network traffic. It’s trivial to setup two end devices to transfer data from one to the other, but this method suffers the same problem as the Ethernet test set scenario, in that you must manually adjust the traffic between tests.

So the following script generates random bits of UDP traffic from iperf from the client side over a given amount and outputs a CSV you can use to match up against your graph. It takes in two parameters: server hostname/ip and the time length of the test. Its a pretty simple script, so you can adjust it to your liking, such as the bandwidth limits and the output file.


#/bin/bash

# Usage: ./random_iperf_traffic.sh &amp;lt;hostname/IP&amp;gt; &amp;lt;time length&amp;gt;
# Outputs to filename &quot;random_traffic_iperf_date_time&amp;gt;

#Read in the command line params: time and target

host=$1

totalTime=$2

# Get the current date for the filename
fileDate=`date +%m_%d_%y_%T`
touch random_traffic_iperf_&quot;$fileDate&quot;.csv

# Now I need to run the iperf loop. The trick here is to stay within the time limit.
# For now, I'm going to take the target time ($time), and divide it in half before the loop. I'll start with a random
# length of time within that time contraint divided by 4, then work up to the $totalTime from there. This way, I ensure we'll have
# at least some random traffic generated.

splitTime=$(( totalTime / 4 ))

# Get a random time between the new time
time=`shuf -i 1-$splitTime -n 1`

while [ $totalTime -ne 0 ]
do

# nerfing this var due to the Pi limits of about 40Mbps
targetBandwidth=`shuf -i 1-40 -n 1`

# Output the current time and bandwidth target
echo `date +%D_%T`,&quot;$targetBandwidth&quot;Mbps &amp;gt;&amp;gt; random_traffic_iperf_&quot;$fileDate&quot;.csv 

echo Running iperf3 in client mode towards host $host at target bandwidth of &quot;$targetBandwidth&quot;Mbps for $time seconds.  

iperf3 -c $host -t $time -u -b &quot;$targetBandwidth&quot;m

totalTime=$((totalTime - time))

time=`shuf -i 1-$totalTime -n 1`

done

Quickest VNC Server Setup on Raspian to View the Actual Desktop

Scenario: You need to use a Raspberry Pi hooked to a TV to view a network monitor or something.

Easily setup x11vnc to be your vnc server:

I found this thread featured a working fix:

https://www.raspberrypi.org/forums/viewtopic.php?p=108862#p108862

steps:
install and set password
– sudo apt-get install x11vnc
– x11vnc -storepasswd

create autostart entry

– cd .config
– mkdir autostart
– cd autostart
– nano x11vnc.desktop
– paste following text:

[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=X11VNC
Comment=
Exec=x11vnc -forever -usepw -display :0 -ultrafilexfer
StartupNotify=false
Terminal=false
Hidden=false

– save and exit (Ctrl-X, Y, <Enter>)

This start x11vnc when lxde starts.

Then remove the pesky screensaver with:

Found here: http://raspberrypi.stackexchange.com/questions/2059/disable-screen-blanking-in-x-windows-on-raspbian

Edit /etc/xdg/lxsession/LXDE-pi/autostart and add these three lines

@xset s off
@xset -dpms
@xset s noblank

Log out, log in, verify it’s working with

xset -q

Then just use your VNC client of choice to connect to the ip with :5900 on the end.

RingMon: An application to monitor Cisco REP and Ciena RAPs Ring Topologies

Service providers often build their layer 2 Ethernet networks in ring typologies. By connecting devices in the shape of a ring, all devices can still communicate with the rest of the network in case there is a single break in the ring.

Two breaks, however, results in a device being isolated from the rest of the network, usually resulting in an outage.

Device_Isolated

To connect switches in a ring topology without causing a loop, protocols like Cisco REP and G.8032 (the open standard) exist to assign a blocking port (just like STP). In the event of a break, the blocking port switches to forwarding traffic. Once the ring heals, the blocking port will return to prevent a loop.

When these rings break, administrators usually configure them to send SNMP traps to a listener that is being monitored by NOC personnel or something similar. But if these traps are missed, or no stateful alerting mechanism is in place to notify personnel of the break, broken rings can go unnoticed.

Enter RingMon. RingMon is designed to keep track of the current status of rings in a network. You just open it up, add the IP addresses of switches with rings you want to track, and it will show you the current state. It sure beats logging into all the switches and manually checking the status.

RingMon

I wrote this application in VB.NET for my solo Senior project at the University of South Alabama. The code is up on github if you would like to have a look.

To download and use the application, here is a link to the .exe and SNMP code library used (library must be in same directory as the .exe).

 

Cisco ASR 920 CDP Config

Getting CDP to work on an ASR 920 trunk link is strange. I found that just enabling CDP globally with “cdp run” isn’t enough. And further, enabling “l2protocol peer cdp” on the trunk service instance is also not the ticket. Using “Show cdp traffic”, I could see that I was sending version 2 CDP frames, but not receiving them. I dug deep and took a packet¬†dump of the CDP¬†frames¬†going between an ASR 920 and ME3400 over a dot1q trunk link. I found the ME3400 CDP frames¬†come tagged via VLAN 1 (the native vlan), but the ASR 920 frames¬†are untagged.

Capture

With some help from a dude on the Cisco forums, we determined that we needed to implement a workaround on the ASR 920 to allow it to interpret the native VLAN¬†frames it was getting. The following config tells the ASR 920 to accept VLAN 1 frames on the trunk link, thus processing the CDP frames. I confirmed after implementing I was able to see the neighbor via CDP, and confirmed the receipt of CDP packets with “show cdp traffic”.

Note the first service instance basically designates VLAN 1 as native, while the second handles the trunk config.

interface GigabitEthernet0/0/4
no ip address
load-interval 30
media-type auto-select
negotiation auto
cdp enable
service instance 1 ethernet
encapsulation untagged
l2protocol peer cdp
bridge-domain 1
!
service instance trunk 2 ethernet
encapsulation dot1q 99,3001-3002
rewrite ingress tag pop 1 symmetric
bridge-domain from-encapsulation
!
end

My Cisco Forums post