Sunday, April 13, 2014

Raspberry Pi – Make Your Own Pirate Radio ( PiFM )

Raspberry Pirate Radio

This simple hack turns your Raspberry Pi into a powerful FM transmitter! It has enough range to cover your home, DIY drive-in movie, a high school ball game, or even a bike parade (depending on the stragglers).

PiFM software not only boldly enhances the capability of your Pi, but does so with nothing more than a single length of wire. This hack starts with the absolute minimum you need to run a Raspberry Pi — an SD card, a power source, and the board itself — and adds one piece of wire. It’s the coolest Pi device we’ve ever seen with so few materials.

PiFM was originally created by Oliver Mattos and Oskar Weigl, and revised by Ryan Grassel. We’d like to thank the whole PiFM community for inspiration. MAKE’s contribution to the project, the PirateRadio.py script, now enables playback without using the command line, and handles all the most common music file formats automatically. It was written by MAKE Labs engineering intern Wynter Woods. You can find the source code here.

clip_image001

NOTE: The Raspberry Pi’s broadcast frequency can range between 1Mhz and 250Mhz, which may interfere with government bands. We advise that you limit your transmissions to the standard FM band of 87.5MHz–108.0MHz (see Step 3) and always choose a frequency that’s not already in use, to avoid interference with licensed broadcasters.

Steps

  • 1. Make the antenna.
  • 2. Flash the SD card and add music.
  • 3. Edit the config file.
  • 4. Start it up!
  • 5. How the PiFM software works.
  • 6. Going further.

Step #1: Make the antenna.

clip_image002

· Technically, all you need for an antenna is a piece of wire. For an optimal antenna, you could attach a 75cm wire to pin 4, with a 75cm power cable pointed in the other direction. (That would effectively make a half-wave dipole antenna at 100MHz, near the middle of the FM band.) We just used 40cm of 12 AWG solid wire, since things started tipping over when the wire got longer.

· Cut and strip a female jumper wire. Solder it to one end of your antenna, and insulate with heat-shrink tubing.

· Dab hot glue around the joint for support, and stick it on pin 4 of the GPIO pins of your Raspberry Pi. The glue makes the antenna more rigid so it stands up better.

· NOTE: If you have the Raspberry Pi Starter Kit and you're in a hurry, you can just use a male jumper wire plugged into the Cobbler breakout board! (Both are included in the kit.) It will work, but the range will be roughly half of what you'd get with 40cm of 12 AWG solid copper.

Step #2: Flash the SD card and add music.

clip_image005

· To save you time configuring everything, MAKE Labs made a disk image. Download ithere. (Advanced users who just want the source can find the link in the intro.)

· The original PiFM code proved the concept with impressive results. The MAKE image takes the work out of partitioning the card into system and data partitions. It also auto-mounts the data partition. It uses a fraction of the CPU of the original code and enables playback from MP3, FLAC, and more. And it runs the PirateRadio.py script on startup, so your music starts broadcasting immediately once the transmitter boots up. Ultimately, this will save you a lot of time. But you can't just drag the files to your SD card; it must be flashed to work.

· Flash the image to your SD card. If you're not familiar with the process, it’s easy. Good tutorials can be found here. You can use Win32DiskImager on Windows, or the Command Line Tools (1) instructions if you're on OSX. I'll assume Linux users have moved on already.

· For OSX and Linux users, simply open up the PirateRadio partition and get started. Windows users, follow our instructions for connecting to your Pi via SSH using WinSCP.

· To add music, simply add your artist or album folders to the root of the “Pirate Radio” partition of the SD card. Your music files can be nested within these folders, so there's no need to dump all your music into one mess on the main directory.

Step #3: Edit the config file.

clip_image009

· You can set the frequency you want to broadcast on in the pirateradio.config file. Open it up in a text editor. You should see something like: [pirateradio] frequency = 108.2 shuffle = True repeat_all = True

· Set frequency to the station you want to broadcast on. Useable FM frequencies are typically from 87.5MHz to 108.0MHz. (108.2 was the highest our test radio could reach, and it didn't have any competition from other stations.)

· Set shuffle to True to shuffle files, or to False to play files alphabetically.

· Set repeat_all to True if you want to loop forever through your playlist.

Step #4: Start it up!

clip_image010

Tune your FM radio (or you Mobile Phone) to your frequency of choice and plug in the Raspberry Pi. It will take about 15 seconds to warm up. Once it does, you should hear your music loud and clear.

Step #5: How the PiFM software works.

clip_image013

· From the PiFM wiki: "It uses the hardware on the Raspberry Pi that is actually meant to generate spread-spectrum clock signals on the GPIO pins to output FM radio energy. This means that all you need to do to turn the Raspberry Pi into a (ridiculously powerful) FM transmitter is to plug in a wire as the antenna (as little as 20cm will do) into GPIO pin 4 (aka GPCLK0) and run the code."

raspberry-pi-rev-1-gpio-pin-out1

· Frequency modulation "is done by adjusting the frequency using the fractional divider." For example, for a target broadcast frequency of 100MHz, the signal is fluctuated between 100.025Mhz and 99.975Mhz, which makes the audio signal.

· The Python code defaults to 87.9 FM with shuffle and repeat turned off. It scans the SD card for music files and builds a playlist based on the options in the config file. It then passes each file along to a decoder based on the filetype. Each file is then re-encoded into a mono format the PiFM radio can handle. This lets you play more than just WAV files: use your MP3, FLAC, M4A, AAC, or WMA files too.

Step #6: Going further.

clip_image014clip_image016clip_image017

· Tuck everything in the acrylic case that comes with your Raspberry Pi Starter Kit and you're good to go. Or, if you want something cooler or more subversive, try building an awesome housing of your own. MAKE Labs manager Sam Freeman drew up this little number, a cool radio tower; download it at thingiverse.com/makelabs.

· Add RadioShack's handy USB battery pack so you can carry your station wherever you need to take over the airwaves. (It fits inside the radio tower, too.)

· NOTE: If you have trouble with range, double-check which pin your antenna is plugged into. At MAKE Labs we spent a few hours puzzled by our antenna's performance, only to discover it was one pin over!

Publicado em 06/03/2014

Complete instructions for this episode of Weekend Projects can be found at http://makezine.com/projects/raspberr...
Using a readymade disk image and one simple solder connection, turn your Raspberry Pi into a streaming pirate radio.
This project was originally created by Oliver Mattos and Oskar Weigl. It was revised by Ryan Grassel and extended by MAKE Labs engineering intern Wynter Woods. Go team!
NOTE: The Raspberry Pi's broadcast frequency can range between 1Mhz and 250Mhz, which may interfere with government bands. We advise that you limit your transmissions to the standard FM band of 87.5MHz--108.0MHz and always choose a frequency that's not already in use, to avoid interference with licensed broadcasters.

Taken From: http://makezine.com/projects/make-38-cameras-and-av/raspberry-pirate-radio/

How does This Hack Works / Problems

@StavrosKorokithakis Raspberry Pi has clock generators, that can output square wave to the GPIO pins. If you program clock generator to the desired frequency you'll get the signal, and when you change the frequency, the signal becomes a frequency modulated (FM) radio. Bad points of this approach are: 1) square wave is very noisy -- plenty of harmonics and other frequencies are transmitted, 2) RasPi can output a lot of RF power, blocking some other transmissions in the very wide frequency spectrum.

http://raspberrypi.stackexchange.com/questions/7725/how-does-the-rf-fm-gpio-transmitter-hack-work

 

There's no such thing as square radio waves it's a mixture of multiple sinusoidal waves that make up the squares.
So your FM radio will work but it can only tune into the main sinusoidal component of your signal the rest are nasty harmonic distortions that pollute the entire FM band and beyond to Air Band. Building a radio receiver is very easy with the right transistor like the BF199, however getting a circuit to operate at high frequencies with little or no tuning drift and good reception is difficult.
As I had said earlier the RX/TX boards from eBay have everything you need to broadcast and receive digital signals in one direction you just need to wire it up to the Pi.

http://www.raspberrypi.org/forums/viewtopic.php?t=68201

Square Waves: http://en.wikipedia.org/wiki/Square_wave

Sunday, April 6, 2014

Control Anything With a TV Remote (via Arduino)

Control Any Circuit With a TV Remote (and an Arduino)

clip_image001[5]

Most of the buttons on a remote control are never used. So why not use them to control appliances and other electronics around your house. In this project, I am going to show you how to use an Arduino to decode the signal from your remote and use it to make an outlet switch that can turn your electronics on and off.
When you are done, you will be able to control lights, fans and even your coffee maker with your TV remote.

Step 1: Materials

clip_image002[5]

Here are the materials and tools that you will need for this project:


Materials:
Arduino Microcontroller
AC Power Adapter For the Arduino
38 kHz Infrared Receiver Module  (Radio Shack part# 276-640)
Red LED
Green LED
Momentary Pushbutton Switch
Two 100 ohm Resistors
10 kohm Resistor
Diode
5V Relay or Relay Shield
Printed Circuit Board
Plastic Project Housing
Extension Cord


Tools:
Wire Strippers
Soldering Iron and Solder
Drill and Bit Set
Sharp Knife
Hot Glue Gun

Step 2: Download and Install the IR Remote Library

clip_image003[5]

clip_image004[5]

clip_image005[6]

clip_image006[5]

This project uses an IR remote library that was developed by Ken Shirriff. This library lets you decode the signal coming from your remote. You can check out his original project and setup here: http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html


The first thing that you need to do for this project is download the library zip file. You can find it here: https://github.com/shirriff/Arduino-IRremote
Click "Download ZIP" on the right side of the page and save the zip file. Then unzip it. Rename the folder "IRRemote" (unless that name is already being used).


Then copy the folder into your libraries directory. The libraries directory should contain the folder "IRremote." If for some reason you already have a folder with this name, then you may need to rename it. The IRremote folder should contain the files. A lot of problems experienced when uploaded in the code, are caused be the library not being loaded in the correct location.

Step 3: The Arduino Code

clip_image007

// Upload this code to your Arduino
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
unsigned long CurrentValue = 0;
unsigned long StoredCode = 0;
const int buttonPin = 6;     // the number of the pushbutton pin
const int ledPin =  4;      // the number of the LED pin
const int outputPin =  3;      // the number of the output LED pin
const int relayPin =  2;      // the number of the relay pin
int buttonState = 0;         // variable for reading the pushbutton status
int RecordState = 0;         //is the reciever in record mode
int outputState = 1;         //is the output on or off
void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
    // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);    
  // initialize the pushbutton pin as an input:
  pinMode(outputPin, OUTPUT);    
  // initialize the pushbutton pin as an input:  pinMode(buttonPin, INPUT);   
  pinMode(relayPin, OUTPUT);    
  // initialize the pushbutton pin as an input:  pinMode(buttonPin, INPUT);   
}
void loop() {
   // read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
   // if a signal is detected, store the value
if (irrecv.decode(&results)) {
  CurrentValue = (results.value);
   // if the recieved value equals the programed value, then toggle the output state
  if(CurrentValue == StoredCode) {
      outputState = !outputState;
   }
   // if the record mode is activated store the current value as the programed value
  if (RecordState == 1) {
    StoredCode = CurrentValue;
    RecordState = 0;
    digitalWrite(ledPin, LOW);  
    Serial.println(StoredCode);  //displays stored code for reference
   }
   // Receive the next value
  irrecv.resume();
}
else //if no signal is detected, then the current value is 0
{
  CurrentValue = 0;
}
  // check if the record button is pressed.
  // if it is, the buttonState is HIGH:
if (buttonState == HIGH) {   
  //wait for the button to be released
  while (buttonState == HIGH) {
    buttonState = digitalRead(buttonPin);
  }
   //turn on the LED to indicate that record mode is on
    digitalWrite(ledPin, HIGH); 
    RecordState = 1;
}
   //set the appropriate output state
if(outputState == 1) {
      digitalWrite(outputPin, HIGH);
      digitalWrite(relayPin, HIGH);
}
else {
        digitalWrite(outputPin, LOW);
        digitalWrite(relayPin, LOW);
}
}

Step 4: The Circuit

clip_image008

clip_image009

This circuit uses a 38 kHz Infrared Receiver Module to detect the signal from the remote. The right pin of this connected to 5V. The middle pin is connected to GND. The Left pin connects to digital pin 11 on the board.

The circuit also has two indicator LEDs. One indicates that the receiver is in programming mode and the other indicates whether the output is on or off. One end of each LED is connected to GND. The other end is connected to a 100 ohm series resistor. The resistors are then connected to digital pins 3 and 4.
A momentary switch is used to set programming mode. One end of the switch is connected to 5V. The other end of the switch is connected to digital pin 6 and a 10 kohm resistor. The other end of the resistor is connected to GND.

An optional relay/relay shield can be connected to digital pin 2 and GND.

You can add any additional outputs that you want. This can let you control multiple devices or multiple functions on the same device.

Step 5: Test the Circuit on a Breadboard

clip_image010

clip_image011

clip_image012

clip_image013

clip_image014

It is always a good idea to test your circuit on a breadboard before soldering it together.

When the Arduino is powered, the output indicator (green) LED should turn on. This indicates that the output at pin 2 is HIGH and can be used to activate another circuit. To program the receiver, press the button. When the button is released, the programming mode indicator (red) LED will turn on.

Now point your remote at the receiver module and press a button. If the Arduino registered the signal, the programming mode LED will turn off. The receiver is now programmed. Pressing this button on the remote again will cause the output at pin 2 to toggle between off and on. The output state is indicated by the LED.

You can use the signal from pin 2 to activates another circuit directly or you can use a relay/relay shield to turn an appliance on and off.

If you connect the Arduino to your computer you can use the serial monitor function to observe the value for the signals that you are programming.

Step 6: Solder the Circuit Together on a Printed Circuit Board

clip_image015

clip_image016

After testing the circuit on a breadboard, you can solder it together on a printed circuit board. The IR receiver module, the switch and the LEDs would be mounted to the housing. So I connected them to the board with jumper wires.

I added a small relay that would be activated by the output of pin 2. In most cases you will want to connect a relay driver circuit. This is because the maximum output of an Arduino digital pin is 40 mA and most relays require more than this to operate. However, I found a relay that only required 25mA to operate. So I was able to connect it directly to the digital pin. It is always a good idea to attach aflyback diode across the terminals of the coil of a relay. This helps to protect against voltage spikes when the relay is turned off.

The relay can act as a general switch and activate just about anything. In this case, I attached an extension cord. This will allow it to act as a remote controlled outlet. Always check to make sure that your relay is rated high enough for your intended load.

Step 7: Mount the Circuit in an Insulated Housing

clip_image017

clip_image018

clip_image019

clip_image020

clip_image021

Now you need to find a good insulated housing to hold your project. I used a 6x3x2 plastic project housing from RadioShack. On one end, I drilled two holes from the LEDs, one hole for the IR receiver and one hole for the switch. Then I made holes in the opposite end for the Arduino power cord and the extension cord.
I used hot glue to secure the LEDs and the Receiver. The switch was held in place with its own nut and lock washer. You can also use hot glue to secure loose wires and to hold the boards in place.
Be very careful not to accidentally pull any wires out of the Arduino as you are fitting everything into the housing.

Step 8: Use Your Remote Controlled Switch to Activate Appliances and Other Electronics

clip_image022

clip_image023

clip_image024

clip_image025

clip_image026

clip_image027

clip_image028

clip_image029

Plug in the power supply for the Arduino and it will automatically turn on. Then plug the male end of the extension cord into an outlet and plug the device that you want to control into the female end of the extension cord. The device should turn on.

To program the receiver, press the red button. The red light will turn on. Then point your remote at the receiver and press a button. If the Arduino registered the signal, then the red light will turn off. Now you can use that button to turn the attached device on and off.

You can use this to remotely control lights, fans or even your coffee maker.

Step 9: Manually Insert IR Values into the Arduino Code (optional)

clip_image030

If you plug the Arduino into your computer, you can use the Serial Monitor tool to view the value of the IR signals for the various buttons on your remote. This gives you the option of manually inserting these values into the code. By doing this you can program responses to multiple buttons. It also means that you will not have to reprogram the receiver whenever the power is disconnected.

Taken From: http://www.instructables.com/id/Control-Any-Circuit-With-a-TV-Remote-and-an-Arduin/

https://www.youtube.com/watch?v=tvRLz4RLoeo

Thursday, April 3, 2014

Windows Concurrent Remote Desktop (RDP)

Professional and Ultimate editions of Windows come with a built in Remote Desktop (RDP) feature that allows you to access your machine remotely while away from home or the office. Unfortunately, it is limited by default to one concurrent user per session, meaning that if someone remotely connects to the computer, whoever was logged in at the moment will be automatically logged off, even if the user is physically at the computer.

This is not a technical limitation but rather a licensing one. Case in point, Remote Desktop in server editions of Windows by default supports two concurrent connections to remotely troubleshoot or administer a computer. More users can connect simultaneously, too, as long as the machine can handle it with the resources it has available and you have the required client access licenses for that particular server.

However, there are a few reasons why concurrent sessions would come in handy for power users not necessarily running a server. For example, if you have a dedicated Media Center PC running in the living room, you'll be able to remotely access all files on the machine without interrupting the person watching TV.

Or if you are sharing a computer with other users, concurrent Remote Desktop sessions will allow more than one person use that system under a different or even the same user account, without kicking each other off. By patching a file called termsrv.dll, located in %SystemRoot%System32, this is possible in all editions of Windows 7, Windows Vista and Windows XP.

clip_image001

Download: UniversalTermsrvPatch_20090425.zip (zip File, 66 KB, mirror #2)

Fortunately for us, Internet user DeepXW already did all the dirty work a while ago and posted his Universal Termsrv.dll Patch for anyone to get their hands on. Simply download and unzip the file, then run the corresponding file as administrator (right-click the exe file and select Run as Administrator). For 32-bit systems use UniversalTermsrvPatch-x86.exe and for 64-bit versions of Windows use UniversalTermsrvPatch-x64.exe.

You should see a window like the one above where you can patch termsrv.dll to remove the Concurrent Remote Desktop sessions limit and restore the original file at any time (a backup file is located at 'windowssystem32termsrv.dll.backup'). After applying the patch, restart your system and you are ready to go.

clip_image002

To test it out simply leave a session open on to the PC where you applied the patch, then from another machine try and connect to the computer remotely. If all goes well both users will be logged on and active.

· Contact the author: Jose Vilches

Taken From: http://www.techspot.com/guides/485-windows-concurrent-sessions/

Multivendor OSPF Lab - With GNS3 and VMware Fusion

clip_image001

DISCLAIMER: The information provided herein is for general informational and educational purposes only. 
Do you have a Mac? Do you have VMware Fusion 6 Professional and GNS3 (with TunTap) installed? Are you ready to implement a multivendor OSPF lab? This post is a culmination of my previous GNS3 posts where we take most of that information to actualize a practical solution. 
The lab contains several virtual devices that consume a significant amount of hardware resources. I recommend your Mac computer have a minimum 8GB of memory, and I also recommend a quad-core CPU because the ASAVM device will absorb the full usage of a single core by default. A dual-core CPU will suffice but expect less "headroom". 
Core components required for this tutorial:

The following table maps each device to its GNS3 object, hypervisor, and software relationship:


Device

GNS3 Object

Hypervisor

Software

ASAVM

Host

VMware

Cisco Adaptive Security Appliance (ASA) 8.4(2)

CSR1000V

Host

VMware

Cisco CSR 1000V Series ADVANCED ENTERPRISE SERVICES 3.11.0S(ED)

R1

Router c3700

Dynamips

c3725-adventerprisek9-mz.124-15.T10.bin

VSRX

Host

VMware

Juniper Networks Firefly Perimeter 12.1X46-D10.2

Ubuntu

Host

VMware

Ubuntu Server 13.10

The R1 device can be any GNS3-compatible Cisco IOS router image that supports the OSPF protocol. The software (for the virtual devices) can be downloaded from their respective websites.

1. GNS3 Topology
Create a new GNS3 project. Drag and drop the GNS3 objects onto the blank workspace. Arrange them so it looks similar to the layout of the network diagram. The network diagram is the reference point for this tutorial.

1.1 Configure the GNS3 Host object attributes (right-click or control-click)

For example, if you were starting with the bottom left GNS3 Host object:

clip_image002

1. Change the hostname from C1 to ASAVM.

clip_image003

2. Change the object symbol.

clip_image004

3. Bind the TAP virtual network device(s) to the GNS3 Host object.

clip_image005

Repeat the previous steps for each of the remaining GNS3 Host objects by matching the specific object attributes with the network diagram.

1.2 Add a link between each of the devices
The GNS3 Host objects will be using their specific TAP interface(s) to connect to the Ethernet switches. In an upcoming section, you will understand why the TAP interface is such a vital component for GNS3 and VMware Fusion integration. 
We can verify all six TAP interfaces are available by running the following command from the terminal:

$ for i in {0..5}; do ifconfig tap$i; done

2. VMware Fusion
The R1 device and the Ethernet switches are ready, from the perspective of GNS3 (Dynamips) connectivity, so we will zero in on creating the VMware virtual machines and their associated vmnets.

2.1 Virtual Network Switches
Our lab configuration will use host-only network switches. A host-only network (switch) is a network that is completely contained within the host computer. Host-only networking provides a network connection between the virtual machine and the host system by using a virtual network adapter that is visible on the host operating system. As the network diagram shows, we will be usingvmnet10 thru vmnet15.

Add a virtual switch with the following steps:

1. Open the Preferences window for VMware Fusion Professional.

2. Select the Network tab.

3. Click the + symbol to add a new virtual switch. As the following screenshot shows, we will leave the Allow virtual machines on this network to connect to external networks (using NAT) and Provide addresses on this network via DHCPoptions unchecked to create the host-only virtual switch (vmnet).

4. Click the Apply button to save the setting.

clip_image006

Close the Preferences window when you're finished creating the virtual switches. 
We can verify the virtual switches have been created by running this command from the terminal:

$ for i in {10..15}; do ifconfig vmnet$i; done

2.2 Juniper Networks VSRX (Firefly Perimeter)
Import the VMware virtual appliance with the following steps:

1. Click File -> Import... from the VMware Fusion menu bar.

2. Click the Choose File... button.

3. Navigate to and select the junos-vsrx-12.1X46-D10.2-domestic.ova file.

4. Click the Open button.

5. Click the Continue button.

6. Rename the package to VSRX.

7. Click the Save button to save the virtual machine in the default Virtual Machines folder.

8. Click the Accept button for the license agreement.

9. Click the Customize Settings button to change the network configuration.

By default, both the virtual network adapters are configured for Bridged Networking. We need to change them to use the virtual switches we created earlier.

1. Click the Network Adapter menu item.

2. Click the vmnet13 radio button.

3. Click the Show All button to return to the virtual machine settings menu.

4. Click the Network Adapter 2 menu item.

5. Click the vmnet14 radio button.

6. Click the Show All button to return to the virtual machine settings menu.

7. Close the settings window.

Directly edit the VSRX.vmx (virtual machine configuration) file to add the custom virtual serial port. My VSRX virtual machine is located in the default VMware Fusion folder (directory), so I would edit the file with the following command from the terminal:

$ nano $HOME/Documents/Virtual\ Machines.localized/VSRX.vmwarevm/VSRX.vmx

The virtual serial port has to be created for console port access. This is very similar to how we interface with our virtual routers in GNS3 (Dynamips). Add the following statements to the end of the VSRX.vmx file to create a virtual serial port that will allow us to emulate a console port connection via telnet:

serial0.present = "TRUE"

serial0.yieldOnMsrRead = "TRUE"

serial0.fileType = "network"

serial0.fileName = "telnet://127.0.0.1:52151"

We are finished configuring the .vmx file, so let's save (control + o) the file, press the enter key to confirm, then exit (control + x) the nano text editor. 
Run the following command to verify the configuration from the terminal:

$ grep serial $HOME/Documents/Virtual\ Machines.localized/VSRX.vmwarevm/VSRX.vmx

serial0.present = "TRUE"

serial0.yieldOnMsrRead = "TRUE"

serial0.fileType = "network"

serial0.fileName = telnet://127.0.0.1:52151

2.3 Cisco CSR1000V
The Open Virtual Appliance (OVA) import process and network configuration is essentially the same as the VSRX. 
Import the VMware virtual appliance with the following steps:

1. Click File -> Import... from the VMware Fusion menu bar.

2. Click the Choose File... button.

3. Navigate to and select the csr1000v-universalk9.03.11.00.S.154-1.S-std-C1-M2560-N3-DS8.ova file.

4. Click the Open button.

5. Click the Continue button.

6. Rename the package to CSR1000V.

7. Click the Save button to save the virtual machine in the default Virtual Machines folder.

8. Click the Customize Settings button to change the network configuration.

By default, all three of the virtual network adapters are configured for Bridged Networking. We need to change them to use the virtual switches we created earlier. We will only use the first two network adapters in our topology. Network Adapter 3 can be attached to the default host-only network (Private to my Mac).

1. Click the Network Adapter menu item.

2. Click the vmnet11 radio button.

3. Click the Show All button to return to the virtual machine settings menu.

4. Click the Network Adapter 2 menu item.

5. Click the vmnet12 radio button.

6. Click the Show All button to return to the virtual machine settings menu.

7. Click the Network Adapter 3 menu item.

8. Click the Private to my Mac radio button.

9. Click the Show All button to return to the virtual machine settings menu.

10. Close the settings window.

Just like for the VSRX, directly edit the CSR1000V.vmx (virtual machine configuration) file to add the custom virtual serial port. My CSR1000V virtual machine is located in the default VMware Fusion folder (directory), so I would edit the file with the following command from the terminal:

$ nano $HOME/Documents/Virtual\ Machines.localized/CSR1000V.vmwarevm/CSR1000V.vmx

Add the following statements to the end of the CSR1000V.vmx file to create a virtual serial port that will allow us to emulate a console port connection via telnet:

serial0.present = "TRUE"

serial0.yieldOnMsrRead = "TRUE"

serial0.fileType = "network"

serial0.fileName = "telnet://127.0.0.1:52152"

We are finished configuring the .vmx file, so let's save (control + o) the file, press the enter key to confirm, then exit (control + x) the nano text editor. 
Run the following command to verify the configuration from the terminal:

$ grep serial $HOME/Documents/Virtual\ Machines.localized/CSR1000V.vmwarevm/CSR1000V.vmx

serial0.present = "TRUE"

serial0.yieldOnMsrRead = "TRUE"

serial0.fileType = "network"

serial0.fileName = telnet://127.0.0.1:52152

2.4 Cisco Adaptive Security Appliance (ASA)
Refer to my previous post on how to create a Cisco ASA virtual machine in VMware Fusion. For our topology, the outside logical interface will be Network Adapter, and the inside logical interface will be Network Adapter 2 (attached to vmnet10). The outsidelogical interface will be using Bridged Networking because it's the interface that connects our virtual network to the physical world. For my setup, Ethernet 1 is the wired Ethernet network interface on my Mac that has access to the Internet.

clip_image007

Important: Quit (and reopen) the VMware Fusion application for the .vmx file changes to take effect. 
3. Basic Device Configuration
With the GNS3 and VMware sections complete, it's time to focus on each device configuration. I will start with the innermost network device and verify adjacent connections along the path to the ASAVM.

3.1 VSRX
The SRX is typically deployed as a network security device, but it will perform solely as a router in our lab. It runs Junos, so it has the potential to function with practically any network role we would need. 
Start VSRX in VMware Fusion, and establish a console port connection to the VSRX device via telnet. Run this command from a new terminal window (tab):

$ telnet 127.0.0.1 52151

Log in as root with no password.

Amnesiac (ttyd0)

login: root

Start the CLI.

root@% cli

Show version information. 

root> show version

Model: firefly-perimeter

JUNOS Software Release [12.1X46-D10.2]

Enter configuration mode. 

root> configure

Set the root authentication password with a cleartext password.

[edit]

root# set system root-authentication plain-text-password

New password: Pa$$worD1

Retype new password: Pa$$worD1

Set the hostname. 

[edit]

root# set system host-name vsrx

Configure the network interfaces.

[edit]

root# set int ge-0/0/0.0 family inet addr 172.28.4.254/24

[edit]

root# set int ge-0/0/1.0 family inet addr 192.168.5.1/24

Remove the ge-0/0/0 interface from the untrust security zone. ge-0/0/0 is a management interface by default, but it will be used as a traffic interface in our topology.

root# delete security zones security-zone untrust interfaces ge-0/0/0.0

Assign the interfaces to the trust security zone. 

root# edit security zones security-zone trust

[edit security zones security-zone trust]

root# set interfaces ge-0/0/0

[edit security zones security-zone trust]

root# set interfaces ge-0/0/1

Configure the trust zone to support inbound traffic for the ping system service. 

[edit security zones security-zone trust]

root# set host-inbound-traffic system-services ping

Check correctness of syntax for current set of changes.

[edit security zones security-zone trust]

root# commit check

configuration check succeeds

Commit current set of changes and quit configuration mode. 

[edit security zones security-zone trust]

root# commit and-quit

commit complete

Exiting configuration mode

Verify the IP configuration for the network interfaces.

root@vsrx> show interfaces ge* terse

Interface Admin Link Proto Local Remote

ge-0/0/0 up up

ge-0/0/0.0 up up inet 172.28.4.254/24

ge-0/0/1 up up

ge-0/0/1.0 up up inet 192.168.5.1/24

From the viewpoint of the host operating system, we need to "glue" a couple of network interfaces together to create a compoundinterface. If you remember from our initial GNS3 Host object configuration, we attached two TAP interfaces to the VSRX object; interface tap3 for ge-0/0/0 and tap4 for ge-0/0/1. GNS3 uses a TAP interface to pass network traffic to the host operating system.

What about VMware? Virtual network adapters are attached to a host-only vmnet (virtual switch); one (or more) network adapters for the VM and another for the host operating system. 
What we need is a construct to bind a single TAP interface with the VMware virtual network adapter allocated to the host operating system. That construct is a bridge interface. For our purposes, a bridge interface contains both a TAP interface and the VMware virtual network adapter (for the host OS) as members. Essentially, the members of the bridge interface are put into promiscuous mode, so they're able to "see" each other's network traffic.

Clear the IP configuration for the vmnet13 virtual network interface before adding it as a member to the bridge. Run the following commands from a separate terminal window (tab):

$ sudo ifconfig vmnet13 down

$ sudo ifconfig vmnet13 inet delete

Create a bridge interface for ge-0/0/0 with the following commands from the terminal:

$ sudo ifconfig bridge3 create

$ sudo ifconfig bridge3 addm tap3

$ sudo ifconfig bridge3 addm vmnet13

$ sudo ifconfig bridge3 up

Verify the configuration with the following command from the terminal: 

$ ifconfig bridge3

bridge3: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500

options=3<RXCSUM,TXCSUM>

ether 02:1f:5b:a3:f3:03

Configuration:

id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0

maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200

root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0

ipfilter disabled flags 0x2

member: tap3 flags=3<LEARNING,DISCOVER>

ifmaxaddr 0 port 14 priority 0 path cost 0

member: vmnet13 flags=3<LEARNING,DISCOVER>

ifmaxaddr 0 port 28 priority 0 path cost 0

Address cache:

0:c:29:b4:c9:e4 Vlan1 vmnet13 1196 flags=0<>

c2:0:2c:1c:0:1 Vlan1 tap3 1190 flags=0<>

media: <unknown type>

status: inactive

Clear the IP configuration for the vmnet14 virtual network interface before adding it as a member to the bridge. Run the following commands from the terminal:

$ sudo ifconfig vmnet14 down

$ sudo ifconfig vmnet14 inet delete

And create a bridge interface for ge-0/0/1 with the following commands from the terminal:

$ sudo ifconfig bridge4 create

$ sudo ifconfig bridge4 addm tap4

$ sudo ifconfig bridge4 addm vmnet14

$ sudo ifconfig bridge4 up

3.2 R1
Start R1 in GNS3. Identify the console port number for R1 in the GNS3 management console with the list R1 command.

clip_image008

Establish a console port connection to the R1 device via telnet. Run this command from a new terminal window (tab):

$ telnet 127.0.0.1 2101

Configure the Fast Ethernet interfaces and bring them up. 

R1# conf t

R1(config)# int f0/0

R1(config-if)# ip addr 172.16.3.254 255.255.255.0

R1(config-if)# duplex full

R1(config-if)# speed 100

R1(config-if)# no shut

R1(config-if)# int f0/1

R1(config-if)# ip addr 172.28.4.1 255.255.255.0

R1(config-if)# duplex full

R1(config-if)# speed 100

R1(config-if)# no shut

R1(config-if)# end

Save the running configuration to local NVRAM. 

R1# copy run start

Verify network connectivity to the ge-0/0/0 interface of VSRX. 

R1# ping 172.28.4.254

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 172.28.4.254, timeout is 2 seconds:

.!!!!

Success rate is 80 percent (4/5), round-trip min/avg/max = 8/22/52 ms

Display the ARP cache. 

R1# sh arp

Protocol Address Age (min) Hardware Addr Type Interface

Internet 172.16.3.254 - c200.b04b.0000 ARPA FastEthernet0/0

Internet 172.28.4.1 - c200.b04b.0001 ARPA FastEthernet0/1

Internet 172.28.4.254 0 000c.29b4.c9e4 ARPA FastEthernet0/1

3.3 CSR1000V
Start CSR1000V in VMware Fusion. Select CSR 1000V Serial Console at the GRUB menu.

clip_image009

Establish a console port connection to the CSR1000V device via telnet. Run this command from a new terminal window (tab):

$ telnet 127.0.0.1 52152

Enter “no” to bypass the setup command facility.

...

cisco CSR1000V (VXE) processor with 814729K/6147K bytes of memory.

Processor board ID 9LX4G1A6QS5

3 Gigabit Ethernet interfaces

32768K bytes of non-volatile configuration memory.

3145728K bytes of physical memory.

7774207K bytes of virtual hard disk at bootflash:.

--- System Configuration Dialog ---

Would you like to enter the initial configuration dialog? [yes/no]: no

Change the technology package license boot level, and reload for the configuration to take effect.

Router> en

Router# conf t

Router(config)# license boot level premium

Router(config)# end

Router# copy run start

Router# reload

Verify the license. 

Router> en

Router# sh license | in Type

License Type: Evaluation

Router# sh license | in Period

Period left: 8 weeks 3 days

Show the current maximum throughput level.

Router# show platform hardware throughput level

The current throughput level is 50000 kb/s

Set the hostname. 

Router# conf t

Router(config)# hostname csr1000v

Set lab options.

csr1000v(config)# no ip domain-lookup

csr1000v(config)# line con 0

csr1000v(config-line)# exec-timeout 0 0

csr1000v(config-line)# logging sync

csr1000v(config-line)# end

We can display the interface mapping with the following command:

csr1000v# show platform software vnic-if interface-mapping

-------------------------------------------------------------

Interface Name Driver Name Mac Addr

-------------------------------------------------------------

GigabitEthernet3 vmxnet3 000c.29cb.09b2

GigabitEthernet2 vmxnet3 000c.29cb.09a8

GigabitEthernet1 vmxnet3 000c.29cb.099e

-------------------------------------------------------------

From a separate terminal window (tab), run the following command to verify the CSR1000V virtual machine configuration vNIC order is correct for our topology:

$ grep 00:0c $HOME/Documents/Virtual\ Machines.localized/CSR1000V.vmwarevm/CSR1000V.vmx

ethernet0.generatedAddress = "00:0c:29:cb:09:9e"

ethernet1.generatedAddress = "00:0c:29:cb:09:a8"

ethernet2.generatedAddress = "00:0c:29:cb:09:b2"

Back in the CSR1000V terminal window (tab), configure the Gigabit Ethernet interfaces and bring them up.

csr1000v# conf t

csr1000v(config)# int g1

csr1000v(config-if)# ip addr 10.10.2.254 255.255.255.0

csr1000v(config-if)# no shut

csr1000v(config-if)# int g2

csr1000v(config-if)# ip addr 172.16.3.1 255.255.255.0

csr1000v(config-if)# no shut

csr1000v(config-if)# exit

Enable Cisco Discovery Protocol (CDP).

csr1000v(config)# cdp run

csr1000v(config)# int g2

csr1000v(config-if)# cdp enable

csr1000v(config-if)# end

Save the running configuration to local NVRAM.

csr1000v# copy run start

Clear the IP configuration for the vmnet12 virtual network interface before adding it as a member to the bridge. Run the following commands from a separate terminal window (tab):

$ sudo ifconfig vmnet12 down

$ sudo ifconfig vmnet12 inet delete

Create a bridge interface for Gi2 with the following commands from the terminal:

$ sudo ifconfig bridge2 create

$ sudo ifconfig bridge2 addm tap2

$ sudo ifconfig bridge2 addm vmnet12

$ sudo ifconfig bridge2 up

Clear the IP configuration for the vmnet11 virtual network interface before adding it as a member to the bridge. Run the following commands from the terminal:

$ sudo ifconfig vmnet11 down

$ sudo ifconfig vmnet11 inet delete

And create a bridge interface for Gi1 from the terminal.

$ sudo ifconfig bridge1 create

$ sudo ifconfig bridge1 addm tap1

$ sudo ifconfig bridge1 addm vmnet11

$ sudo ifconfig bridge1 up

Back in the CSR1000V terminal window (tab), run the following command to verify data link layer connectivity with R1:

csr1000v# sh cdp neigh detail

-------------------------

Device ID: R1

Entry address(es):

IP address: 172.16.3.254

Platform: Cisco 3725, Capabilities: Router Switch IGMP

Interface: GigabitEthernet2, Port ID (outgoing port): FastEthernet0/0

Holdtime : 121 sec

Version :

Cisco IOS Software, 3700 Software (C3725-ADVENTERPRISEK9-M), Version 12.4(15)T10, RELEASE SOFTWARE (fc3)

Technical Support: http://www.cisco.com/techsupport

Copyright (c) 1986-2009 by Cisco Systems, Inc.

Compiled Mon 14-Sep-09 15:53 by prod_rel_team

advertisement version: 2

VTP Management Domain: ''

Duplex: full

Total cdp entries displayed : 1

3.4 ASAVM
Start ASAVM in VMware Fusion, and establish a console port connection to the ASAVM device via telnet. Run this command from a new terminal window (tab):

$ telnet 127.0.0.1 52150

Set the hostname.

ciscoasa> en

Password:

ciscoasa# conf t

ciscoasa(config)# hostname asavm

Configure the Gigabit Ethernet interfaces and bring them up. 

asavm(config)# int g0

asavm(config-if)# nameif outside

INFO: Security level for "outside" set to 0 by default.

asavm(config-if)# ip addr 10.10.1.254 255.255.255.0

asavm(config-if)# no shut

asavm(config-if)# int g1

asavm(config-if)# nameif inside

INFO: Security level for "inside" set to 100 by default.

asavm(config-if)# ip addr 10.10.2.1 255.255.255.0

asavm(config-if)# no shut

asavm(config-if)# exit

Create a network object for the inside security zone, and enable dynamic Port Address Translation (PAT).

asavm(config)# object network OBJ-INSIDE

asavm(config-network-object)# subnet 0 0

asavm(config-network-object)# nat (inside,outside) dynamic interface

asavm(config-network-object)# exit

Create the default route. For my configuration, the next hop IP address is my physical router's private IP address NAT'd to the Internet. It's also the gateway IP address for the host computer.

asavm(config)# route outside 0 0 10.10.1.1

Permit ping and traceroute traffic.

asavm(config)# access-list outside_access_in extended permit icmp any any time-exceeded

asavm(config)# access-list outside_access_in extended permit icmp any any unreachable

asavm(config)# access-group outside_access_in in interface outside

asavm(config)# fixup protocol icmp

INFO: converting 'fixup protocol icmp ' to MPF commands

asavm(config)# icmp unreachable rate-limit 10 burst-size 5

asavm(config)# policy-map global_policy

asavm(config-pmap)# class class-default

asavm(config-pmap-c)# set connection decrement-ttl

asavm(config-pmap-c)# end

Save the running configuration to local NVRAM.

asavm# copy run start

Clear the IP configuration for the vmnet10 virtual network interface before adding it as a member to the bridge. Run the following commands from a separate terminal window (tab):

$ sudo ifconfig vmnet10 down

$ sudo ifconfig vmnet10 inet delete

Create a bridge interface for Gi1 with the following commands from the terminal:

$ sudo ifconfig bridge0 create

$ sudo ifconfig bridge0 addm tap0

$ sudo ifconfig bridge0 addm vmnet10

$ sudo ifconfig bridge0 up

Back in the ASAVM terminal window (tab), check network connectivity to the Gi1 interface of CSR1000V.

asavm# ping 10.10.2.254

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.10.2.254, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms

And check network connectivity to the next hop IP address for the default route.

asavm# ping 10.10.1.1

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.10.1.1, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms

Display the ARP cache.

asavm# sh arp

outside 10.10.1.1 000c.41d6.9928 1

inside 10.10.2.254 000c.29cb.099e 28

4. OSPF
After we've established (and verified) network connectivity among the adjacent devices, we need to configure OSPF for full reachability.

4.1 VSRX
From the VSRX terminal window (tab): 
Enter configuration mode.

root@vsrx> configure

Allow OSPF traffic for the trust zone.

[edit]

root@vsrx# edit security zones security-zone trust

[edit security zones security-zone trust]

root@vsrx# set host-inbound-traffic protocols ospf

Configure the loopback interface.

[edit security zones security-zone trust]

root@vsrx# top set interfaces lo0.0 family inet address 3.3.3.3/32

Set the Router ID. 

[edit security zones security-zone trust]

root@vsrx# top set routing-options router-id 3.3.3.3

Configure OSPF. 

[edit security zones security-zone trust]

root@vsrx# top edit protocols

[edit protocols]

root@vsrx# set ospf area 1 interface lo0.0 passive

[edit protocols]

root@vsrx# set ospf area 1 interface ge-0/0/0.0

[edit protocols]

root@vsrx# set ospf area 1 interface ge-0/0/1.0 passive

Check correctness of syntax for current set of changes.

[edit protocols]

root@vsrx# commit check

configuration check succeeds

Commit current set of changes and quit configuration mode. 

[edit protocols]

root@vsrx# commit and-quit

commit complete

Exiting configuration mode

Verify OSPF configuration.

root@vsrx> show ospf overview

Instance: master

Router ID: 3.3.3.3

Route table index: 0

LSA refresh time: 50 minutes

Area: 0.0.0.1

Stub type: Not Stub

Authentication Type: None

Area border routers: 0, AS boundary routers: 0

Neighbors

Up (in full state): 0

Topology: default (ID 0)

Prefix export count: 0

Full SPF runs: 3

SPF delay: 0.200000 sec, SPF holddown: 5 sec, SPF rapid runs: 3

Backup SPF: Not Needed

4.2 R1
R1 will be configured as an Area Border Router (ABR). From the R1 terminal window (tab): 
Configure the loopback interface.

R1# conf t

R1(config)# int lo0

R1(config-if)# ip addr 1.1.1.1 255.255.255.255

R1(config-if)# exit

Configure OSPF.

R1(config)# router ospf 1

R1(config-router)# passive-interface lo0

R1(config-router)# log-adjacency-changes

R1(config-router)# exit

R1(config)# int lo0

R1(config-if)# ip ospf 1 area 0

R1(config-if)# int f0/0

R1(config-if)# ip ospf 1 area 0

R1(config-if)# int f0/1

R1(config-if)# ip ospf 1 area 1

R1(config-if)# end

Save the running configuration to local NVRAM. 

R1# copy run start

Verify VSRX as an OSPF neighbor.

Taken From: http://binarynature.blogspot.pt/2014/02/implement-multivendor-ospf-lab-gns3-vmware-fusion.html