Candela Technologies Logo
 
http://www.candelatech.com
sales@candelatech.com
+1 360 380 1618 [PST, GMT -8]
Network Testing and Emulation Solutions

Various Techniques Cookbooks

The Various Techniques Cookbooks provide miscellaneous examples of how to perform various network configuration tasks. Each is a set of step-by-step instructions intended to help build your familiarity with network configuration in Linux and Windows.

Please contact us at support@candelatech.com if you have any questions.

All Network Configuration Cookbook Examples

  1. Configure Auxiliary Management
  2. Find Windows IP Addresses
  3. Find Windows MAC Addresses
  4. Custom DOS Window Settings
  5. Quickly Inspect Your DOS PATH Variable
  6. Connecting with PuTTY
  7. Install Ardunino Mega Driver on Windows
  8. Connect to LANforge Using Remote Desktop
  9. Connect to LANforge Using VNC Viewer
  10. Display WireShark Using Cygwin
  11. Finding Report Data
  12. Writing Disk Images on Windows
  13. LANforge Troubleshooting

Configure Auxiliary Management Interfaces

Goal: Allow LANforge to create its own wireless management network.

In cases where is is not convenient to use an existing management network, LANforge WiFi systems can be configured to provide their own WiFi management network. This may be especially useful when testing in environments where LANforge needs to be moved around or where you have no good access to existing management LANs. This example assumes that you already know how to create and configure VAP and Stations in LANforge.
 
  1. Configure LANforge for Auxiliary Management.

    1. Connect LANforge systems through the normal management LAN for initial configuration. The resources should be visible in the management tab screenshot

    2. In this case, we are using wiphy0 for the Aux-Mgt interfaces. On the manager system, configure wiphy0 to be on the desired channel, create a virtual AP on wiphy0, and configure it appropriately. The Aux-Mgt checkbox should be selected, a static IP should be assigned, and an appropriate SSID configured. The AP Aux-Mgt port will automatically serve DHCP and will try to NAT and route packets to the wired Management interface. screenshot

    3. On the other resources, configure the wlanX interface to connect to the AP on the manager system, and select the Aux-Mgt checkbox. screenshot

    4. The Port-Mgr tab should look something like this when the Aux-Management interfaces are configured. screenshot

    5. To test that it works properly, you can now remove the wired Manament port connection and wait about 1 minute for the old connection to time out and re-connect to the Auxiliary Management port. Or, just reboot systems with the wired ports unplugged and they should be discovered on the Aux-Mgt ports promptly.

Windows IP Addresses

Goal: Find and change network ip addresses on Microsoft Windows.

Here are some techniques for finding and setting IP addresses on Microsoft Windows using the Control Panel and the command line.
 
  1. Find the IP Address of the Windows PC. There are two methods you can use:

    1. Using the Control Panel:

      1. Click Start, Run, control, [enter] screenshot

      2. Search and select Network Status and Devices screenshot

      3. We click on our device, Ethernet 3: screenshot

      4. Find and/or set the IP address: from Status, click Properites screenshot

      5. double click TCP/IPv4 screenshot

      6. you will see and can change the IP address.: screenshot

    2. Various DOS commands to find the IP addresses on the system:

      1. ipconfig and ipconfig /all

      2. netsh interface ipv4 show address

    3. Resetting your DHCP address via command line:

      1. ipconfig /release

      2. ipconfig /renew

Windows MAC Addresses

Goal: Find MAC Addresses in Microsoft Windows.

Here are some techniques for finding MAC addresses on Microsoft Windows using the Control Panel and the command line.
 
  1. Find the MAC Address of the Windows PC. There are two methods you can use:

    1. Method 1: use the Control Panel

      1. Click Start, Run, control, [enter] screenshot

      2. Search and select Network Status and Devices screenshot

      3. We click on our device, Ethernet 3: screenshot

      4. Click Details... screenshot

      5. Details will show the MAC address (physical address): screenshot

      6. (Suggested) Set the IP address if you have not already.

        For more information see Finding Windows IP Address

    2. Method 2: use the DOS command-line. You want to correlate the IP address and MAC address of the Windows ethernet port:

      1. Click Start, Run, and type cmd, and press [Enter] screenshot

      2. Show interfaces by name with the command: netsh interface ipv4 show addresses screenshot

      3. (Optional) if you do not see results, you might need to start the network autodiscovery service: net start dot3svc screenshot

      4. (Optional) Depending on the edition of Windows, the command netsh lan show interfaces will display mac addresses. screenshot

      5. Show mac addresses with: getmac /v /fo csv
        (The CSV formatted command of the command ensures that we will see the entire name of the interface which can be trimmed short in the default output format.)
        screenshot

      6. These commands will make it easier to copy using notepad:

        netsh interface ipv4 addresses > ifnotes.txt
        getmac /v /fo csv >>ifnotes.txt
        notepad ifnotes.txt
        screenshot

      7. Now you can easily copy the values: screenshot

Customizing DOS Window Settings

Goal: Make your DOS windows large and do cut and paste easier.

Here we review DOS window settings that will help you to work faster.
 
  1. Customizing DOS Window Settings starts by right clicking the Start Menu

  2. Type in cmd and hit Enter screenshot

  3. To get to your DOS window faster, you can pin it to your task bar. Right click the task bar CMD window icon and select Pin this program to taskbar screenshot

  4. On the DOS window title bar, Right click and select the Defaults menu item screenshot

  5. Select the Quick Edit Mode setting. This allows you to highlight text in the window easily. screenshot

  6. In the Font tab, select a slimmer TrueType font, like Consolas or Lucida Console, and set the font size to 10 screenshot

  7. In the Layout tab, change the Window Size to 132 columns and 56 rows screenshot

  8. Click OK to save. The next DOS window you open will appear with your customized settings.

Quickly Inspect Your DOS Path

Goal: Find if a program or is in your %PATH%

Use this technique to inspect your DOS environment variables for specific strings using findstr.
 
  1. Follow this example to see if perl is installed and your %PATH% environment variables is updated. First, open up a DOS window: Windows+RcmdEnter

  2. Type in the DOS Window: echo %PATH% | findstr /i perlEnter

  3. If perl is installed correctly, you should have it in your path. screenshot

  4. You can also use this technique to find any environment variable. E.G., find if you have a temporary directory set:

    set | findstr /i temp
    screenshot

Connecting with PuTTY

Goal: Using PuTTY on Windows to connect to LANforge Linux servers.

Lots of tasks, like scripting, can be done over SSH from your Windows desktop. Here are a few steps to help you customize your PuTTY terminal to work faster.
 
  1. Configuring a PuTTY Session

    1. When you double click on the PuTTY icon and it launches, you can start customizing your session preferences. We'll name this session jedtest screenshot

    2. Let's default the window to something large, like 120 columns and 56 rows. screenshot

    3. The Fixed font can be replaced with the Consolas font. screenshot

    4. Let's turn on TCP Keep-alive and set IPv4 as the default networking protocol. screenshot

    5. We login to LANforge resources with user lanforge screenshot

    6. Generating a SSH keypair is not difficult. Let's enter the path to our public key file. screenshot

    7. We have done our PuTTY config. Now back to the top Session screen, and click Save screenshot

  2. Configure Pagent with your public key

    1. Create your own public ssh key.

      For more information see WinScp Net

    2. Start Pagent. Configure it to load on startup.

    3. In the System Tray you will see the Pagent icon. screenshot

    4. Right-click the Pagent icon and click Add Key to select your key screenshot

    5. You will need to provide your pass-phrase to load your key screenshot

    6. We see a loaded key screenshot

    7. Here is our key, we will view the .pub file to copy out the public key. screenshot

    8. In a putty window you will log into your LANforge server and edit /home/lanforge/.ssh/authorized_keys

    9. Copy the text and place the "Comment" section at the end when you paste it into your ssh screenshot

    10. Here is the public key string, with newlines and spaces removed. The Comment text goes at the end. screenshot

    11. Check the permissions of the authorized_keys file. You might need to use the command

      chmod 600 authorized_keys
      to correct the permissions. screenshot

    12. The next time we load the jedtest PuTTY session we should not be prompted for our password.

Installing the Ardunino Mega Driver on Windows 7

Goal: Installing the the Ardunino Mega device driver on Windows 7.

The automatic driver install process for Windows 7 might automatically install a Microsoft Windows version of the Arduino Mega driver. This is not the driver LANforge expects. These instructions will guide you how through uninstalling an old driver and installing the new driver.
 
  1. You want to install the windows version of the LANforge Server beforehand.

    For more information see Installing LANforge Server on Windows

  2. This process requires you to operate the Control Panel as Administrator. Some patch-levels of Windows 7 have secured this. A useful work around for this will be discussed shortly.

  3. Getting to the Device Manager

    1. Start by clicking the Start Menu and typing control ENTER screenshot

    2. Select Hardware and Sound screenshot

    3. Select Device Manager screenshot

    4. In the Device Manager window, right-click on the computer and select Scan for hardware changes screenshot

    5. There will be an Other devicesUnkown Device entry. Right-click on it. If the options menu only gives you Scan for hardware changes or Properties, you might need to restart your control panel as Administrator, that is discussed next. screenshot

    6. If you have recently removed a driver, you might need to reboot your Windows system for it to complete the driver installation process.

  4. Using the Run as Administrator option to start the Control Panel in administrator mode.

    1. This works best with a CMD window pinned to the task bar. You can do that using Start MenucmdENTER; and then right-clickPin to Task Bar option on the task bar icon for the cmd.exe window.

    2. Then right-clickRun as Administrator on the cmd taskbar icon screenshot

    3. Repeat your navigation steps to get to the Device Manager

  5. If you find a previously installed driver, uninstall it. Especially if this is labeled Windows Arduino Mega

    1. Right-clickUninstall screenshot

    2. Select Delete the driver software for this device, and click OK screenshot

    3. Right-click on the computer, and select Scan for Hardware Changes

    4. You might need to un-plug and plug-in your Attenuator.

    5. If the right-click options menu does not allow you to change drivers, reboot your system.

  6. Install the LANforge Arduino Driver

    Depending on your version of Windows, you might not find the driver file using the Browse my computer choice, you might find it using the Automatically Search choice.

    1. In Device Manager, you want right-click on the Unknown Device and select Update Driver Software... screenshot

    2. Option 1: Select Search automatically for updated driver software:

      screenshot

      1. Click on Let me pick from a list of device drivers on my computer screenshot

      2. You see a list of drives. Click the Have Disk button: screenshot

      3. Enter C:\Program Files (x86)\LANforge-Server. Click OK. screenshot

    3. Option 2: Select Browse my computer for driver software:

      screenshot

      1. Browse to C:\Program Files (x86)\LANforge-Server and click Next screenshot

      2. This is not a signed driver. Please confirm the installation. screenshot

      3. You will see the Update Driver Software confirmation. Click Close. screenshot

    4. You should not need to reboot your system in order to run the Attenuator.

Connect to LANforge using Remote Desktop

Goal: Operate your LANforge's Linux desktop by accessing it with Windows Remote Desktop utility.

LANforge computers on Intel hardware are typically installed with a full Linux desktop. You can use the LANforge GUI, do traffic sniffing, open terminal windows, and office software to look at report data over remote desktop. LANforge computers are pre-configured with RDP and VNC desktop services.
 
  1. From your Windows Start Menu, type "remote" and Remote Desktop Connection should be an option. screenshot

  2. If you are using the Start→Run menu, type mstscEnter screenshot

  3. If you want to create a desktop shortcut, explore the folder C:\windows\system32 and right-click mstsc.exe

  4. Configure your connection:

    1. Fedora version 24 and 25 have a bug in the vncserver triggered by xrdp. The effective way to use rdesktop on those systems is to select an Xorg session for connecting (not a Xvnc session).

    2. When connecting to Fedora 14-23 systems:

      1. User Name: lanforge screenshot

      2. You will not need to fill out the xrdp login screen.

    3. When connecting to Fedora 24-25 systems:

      1. Do not specify a user name, and select Always ask for credentials. screenshot

      2. Select Xorg as the session type screenshot

      3. Specify username lanforge and password lanforge screenshot

    4. Local Resources screenshot

      1. If your rdesktop session immediately closes, you might have hit the xrdp clipboard bug. If so:

      2. For Windows Remote Desktop (mstsc.exe): unselect Local Devices→Clipboard

      3. For Linux rdesktop, use the command: rdesktop -a16 -r cliboard:off -u lanforge [machine-name]

    5. Disable remote audio settings screenshot

    6. Disable local printers screenshot

    7. Set Server authentication to Connect and do not warn screenshot

    8. Connection quality can be 16-bit (millions of colors)

  5. Click Connect to connect to the default desktop, the default password is lanforge screenshot

  6. When you are DONE with your connection, you may close the Remote Desktop window. You will not be logged out. However, if you log in without setting the Username option, you will be logged into a new session alongside your old session. If you see this screen below, you are starting a new desktop session: screenshot

  7. To reconnect to your previous desktop session, make sure you use the Username lanforge in your connection settings.

  8. To logout of the desktop session, select System→Log Out from the top window of the Linux desktop. screenshot

Connect to LANforge using VNC Viewer

Goal: Operate your LANforge's Linux desktop by accessing it with the VNC Viewer utility.

LANforge computers on Intel hardware are typically installed with a full Linux desktop. You can use the LANforge GUI, do traffic sniffing, open terminal windows, and office software using a VNC Viewer program. LANforge computers are pre-configured with RDP and VNC desktop services.
 
  1. You can download a variety of viewers:

    1. Check for viewer packages on your LANforge web page: http://192.168.1.101/ screenshot

    2. or download RealVnc

    3. or download TightVnc

  2. From your Windows Start Menu, type "vnc" and VNC viewer should be an option. screenshot

  3. If you are using the start menu, it will be under either in All Programs > RealVNC or TightVNC screenshot

  4. Double click the vnc icon and it will ask you for the IP address. You want to set the Encryption option to off because we presume you are connected directly to the LANforge. screenshot

  5. VNC Viewer might warn you about connecting without encryption. This is a valid warning if you are connecting across public networks. screenshot

  6. The password is lanforge. screenshot

  7. You will see the LANforge Linux desktop. This is not the same desktop that is actually running on the console if you have a monitor and keyboard connected. screenshot

  8. When you are done with your connection, you may close the VNC viewer window. You will not be logged out. When you connect using VNC viewer again, it show the current state of that desktop. connect you to the last used VNC session.

  9. To restart the vnc desktop session, select you can issue either of these two commands. You start using ssh (PuTTY et. al.) to connect as lanforge to the LANforge machine, and:

    1. sudo systemctl restart "vncserver@:1.service"

    2. or

    3. sudo vncserver -kill :1

Display WireShark Using Cygwin

Goal: We will display the WireShark application on Windows using Cygwin when we press Sniff Packets which actually runs WireShark on the Linux LANforge machine.

The native display protocol for Linux (and Unix) is the X Display Protocol. The Cygwin.org project provides Linux software that runs natively on Windows. You can run an X display server on Windows that accepts connection from LANforge. We will walk through setting up Cygwin and configuring an X display.
 
  1. Installing Cygwin and the X display components

  2. We will start at Cygwin.org and download the Cygwin installer. screenshot

  3. Download setup-x86.exe or setup-x86_64.exe as appropriate. Go to your Downloads folder and double start the program. screenshot

  4. Next screenshot

  5. Next screenshot

  6. Next screenshot

  7. Choose a mirror that might be close to you, click Next screenshot

  8. Now you see a the software selection screen, sorted by category. Some of these entries appear two or more times, because they belong to multiple categores. Try using the search box in upper middle above the software list to search for the packages listed below. screenshot

  9. The items you want to search for are

    • openssh
    • xorg-server
    • xinit
    • rxvt
    • xlaunch

    1. Search for openssh and click the Skip property once to change it to the most recent version to set it to install. screenshot

    2. xorg-server provides the X display system screenshot

    3. xinit helps the X system launch screenshot

    4. xlaunch is what you will drag to your task bar to launch your Cygwig X server screenshot

    5. rxvt and rxvt-unicode are more useful terminals than the minterm program that Cygwin provides by default. screenshot

  10. Click Next and let the installer finish the installation of the Cygwin packages. You will see a Cygwin Terminal icon appear on your desktop and new Cygwin icons in your Start menu. screenshot

  11. Next we will right-click on the Cygwin Terminal icon and select Open File Location screenshot

  12. In the Explorer window, scroll to find xlaunch.exe, and drag it to the Task Bar screenshot

  13. Click the xlaunch icon on the task bar, and click Next screenshot

  14. Next screenshot

  15. Check Disable Access Control and add the option: -listen tcp. Click Next screenshot

  16. Firewall, Click Allow Access screenshot

  17. Now your X display service is running. You can check that it's running by clicking into the System Tray and seeing if the icon is there. screenshot

  18. Launch the LANforge GUI from your desktop. Select a port from the Port Mgr tab. Notice how the Disp field has your laptop's LAN address. This is the display address the remote machine will display the Wireshark window to. screenshot

  19. You will see WireShark screenshot

  20. Resources and other Documentation:

    1. http://unix.stackexchange.com/questions/227889/cygwin-on-windows-cant-open-display

    2. https://www.cs.virginia.edu/~csadmin/wiki/index.php/Using_Cygwin_for_X11_Forwarding

    3. http://www.arsc.edu/arsc/knowledge-base/ssh-and-x11-forwarding-us/index.xml

Finding LANforge Report Data

Goal: Properly configured, the LANforge server or the LANforge GUI can collect connection performance information in CSV format.

By default, your LANforge server and your LANforge client do not save the data on connection and port performance. When you configure the save destination for this data, you can use it with any other tool that can read a CSV file.

Finding LANforge Report Data

Select your Save Location

You can tell the LANforge server to save data to a directory locally on the management machine, and you can configure your workstation running the the LANforge GUI to save data to a local desktop folder. First, find the Reporting Manager dialog by in the Reporting menu, and select Report Manager the client.

GUI Data Collection (Desktop Folder)

Collecting data on your local workstation is very convenient if you can leave the GUI running for the duration of your test scenario. The format of the data here should be similar to the format of the data saved to the server directory. The folders for collecting data are relative to the folder you start your GUI from. If you type in lf_data that probably means C:\Users\mumble\AppData\Local\LANforge-GUI\lf_data. You probably want to put in a fully qualified path thats more intuitive, like C:\Users\mumble\Documents\lf_data.

Generate Report

The Report Generator uses the local data files. In that dialog shows the Report Input Directory field is a local folder where the CSV files collect. The Save Reports to Directory field is where HTMl and PDF files should collect.

Server Data Collection (Server Directory)

If your test scenario runs longer than your GUI can be up, you can configure the LANforge server to collect the data. The directory is relative to the /home/lanforge directory, so if you enter lf_data, you would find the CSV files in /home/lanforge/lf_data.

You can take a look at the data files easily. Here is a server data collection directory:

And using a utility like notepad, vi, more or less you can look at the file contents:

Using Libre Office

Importing the file into a spreadsheet like LibreOffice Calc is simple:

You only need to separate on comma (,)

The timestamp column

Libre Office does not have a builtin formula to do this, but it has been discussed here. And the solution is a formula that looks like this:

=(A2/86400)+25569
and then you format the column as Date.

Scripting with Bash

There are a number of ways to collect an dort the data with shell utilities. The first utility to consider is cut, then awk. The first column of the endpoint file we are going to read is the timestamp, the 14th is the rx bytes.

Reading the Data and RX Bytes

Converting Unix Date
 $ head -n2 c201-A_1488414451.csv | cut -d, -f1
TimeStamp
1488414454125
 $ date -d @1488414454125
Mon Dec 23 19:28:45 PST 49135
Using bash
 $ head -n2 c201-A_1488414451.csv | (while IFS=, read -a L; do echo ${L[13]}; done)
rx_bytes
33847640064
Using cut
 $ head -n2 c201-A_1488414451.csv | cut -d, -f14
rx_bytes
33847640064
Using awk
 $ head -n2 c201-A_1488414451.csv | awk -F, '{print $14}'
rx_bytes
33847640064

head -n2 c201-A_1488414451.csv | awk -F, '{print $1 "\t" $14}'
TimeStamp       rx_bytes
1488414454125   33847640064

Scripting with Perl

It is a lot easier to do math with a perl script than a bash or an awk script. You can pipe things into perl or perl will read the last argument of the -ne switches as an input file.

 $ head -n2 c201-A_1488414451.csv \
      | perl -ne '@v=split(/,/,$_); print "$v[0]\t$v[13]\n";'
TimeStamp      rx_bytes
1488414454125  33847640064

perl -ne 'BEGIN{$tt=0;@tstamps=();@rxb=();} \
  {@v=split(/,/,$_); push(@tstamps, $v[0]); push(@rxb, $v[13]);} \
  END{$dt=$tstamps[$#tstamps] - $tstamps[1]; $db=$rxb[$#rxb] - $rxb[1]; \
    print "Time: $dt,  Total:$db\n";}' \
    c201-A_1488414451.csv
Time: 18959363,  Total:1213399040

Not everthing you do in perl is going to be a one-liner. Here's an example of the same script as a more properly formatted perl file:

#!/usr/bin/perl
my $tt=0;
my @tstamps=();
my @rxb=();
while(<>) {
  @v = split(/,/, $_);
  push(@tstamps, $v[0]);
  push(@rxb, $v[13]);
}
$dt = $tstamps[$#tstamps] - $tstamps[1];
$db = $rxb[$#rxb] - $rxb[1];
print "Time: $dt,  Total:$db\n";

Writing Disk Images on Windows

Goal: Copy an installed OS file-system image onto a drive that you will install into a LANforge system that lacks display hardware.

Many LANforge ICE WAN emulator machines are embedded systems that lack display hardware. Installing an OS using only the serial console can be very inconvenient. The easy solution is to perform the installation on similar hardware that does have display hardware, and then move the drive to the embedded device. Here, we learn how to use Etcher on Windows to write a compressed disk image to an mSata drive plugged into a USB3 adapter.
 
  1. Here we're using Etcher which handles compressed file system images without any trouble. There are other programs (like Win32 Disk Imagaer or dd for windows) but those are more complex to use.

  2. Items we'll want:

    1. 30GB or larger mSATA drive screenshot

    2. USB3 mSATA drive adapter screenshot

    3. The image writing program Etcher

  3. Download and install Etcher screenshot

  4. Identify your drive in Control Panel → Hardware and Sound → Hardware and Printers. screenshot

  5. Download your image file: screenshot

  6. Start Etcher screenshot

  7. Select the compressed image: screenshot

  8. Select the removable drive screenshot

  9. You might have to enable unsafe mode if the drive you plugged in has previously been used

    1. in Settings, enable Unsafe mode screenshot

    2. Select the removable drive screenshot

  10. Select the removable drive screenshot

  11. Write image.

    1. click Flash screenshot

    2. It might take 20 minutes to write a 20GB (uncompressed) image. screenshot

  12. Make coffee. screenshot

  13. When the image is finished writing, close etcher and use the Safely Eject Thing dialog in the system tray.

    1. right click screenshot

    2. select device screenshot

  14. Unplug your drive from the computer, remove the msata drive drive from the USB caddy and then install into your embedded device


Candela  Technologies, 2417 Main Street, Suite 201, Ferndale, WA 98248, USA
www.candelatech.com | sales@candelatech.com | +1.360.380.1618
Google+ | Facebook | LinkedIn | Blog