documentation:examples:how_to_build_a_bsdrp_router_lab
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | documentation:examples:how_to_build_a_bsdrp_router_lab [2017/11/25 04:30] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== How to build a BSDRP router lab ====== | ||
+ | {{description> | ||
+ | ===== BSDRP Virtual lab scripts | ||
+ | |||
+ | BSDRP provide some scripts for setting-up labs with Qemu/KVM, [[https:// | ||
+ | |||
+ | ==== bhyve ==== | ||
+ | |||
+ | If you want to use bhyve, here is the [[https:// | ||
+ | |||
+ | < | ||
+ | chmod +x BSDRP-lab-bhyve.sh</ | ||
+ | |||
+ | Usage of this script is: | ||
+ | < | ||
+ | Usage: ./ | ||
+ | | ||
+ | | ||
+ | | ||
+ | -i filename | ||
+ | -l X | ||
+ | -m X RAM size (default 256M) | ||
+ | -n X | ||
+ | | ||
+ | -w dirname | ||
+ | This script needs to be executed with superuser privileges | ||
+ | </ | ||
+ | |||
+ | ==== Qemu/KVM ==== | ||
+ | |||
+ | <note important> | ||
+ | |||
+ | Patched release of Qemu can be found: | ||
+ | * FreeBSD: Included (GNS3 option) | ||
+ | * Windows: | ||
+ | |||
+ | |||
+ | === Under FreeBSD or Linux === | ||
+ | If you want to use Qemu or KVM, here is the [[https:// | ||
+ | |||
+ | < | ||
+ | chmod +x BSDRP-lab-qemu.sh</ | ||
+ | |||
+ | //Linux users have to replace fetch by wget.// | ||
+ | |||
+ | This script was tested with qemu 0.11.1 on FreeBSD) and with KVM on a Debian GNU/Linux. | ||
+ | |||
+ | Usage of this script is: | ||
+ | < | ||
+ | Usage: ./ | ||
+ | -i filename | ||
+ | -n X Lab mode: start X routers (between 2 and 9) full meshed | ||
+ | -l Y Number of LAN between 0 and 9 (in lab mode only) | ||
+ | -s Enable a shared LAN with Qemu host | ||
+ | -h Display this help | ||
+ | |||
+ | Note: In lab mode, the qemu process are started in snapshot mode, | ||
+ | this mean that all modifications to disks are lose after quitting the lab | ||
+ | Script need to be started with root if you want a shared LAN with the Qemu host | ||
+ | </ | ||
+ | |||
+ | === Under Windows === | ||
+ | |||
+ | There is a VBScript for windows on [[http:// | ||
+ | |||
+ | ==== Virtualbox ==== | ||
+ | |||
+ | <note important> | ||
+ | === Under Windows === | ||
+ | |||
+ | If you are under MS Windows, here is a [[https:// | ||
+ | |||
+ | For starting this PS script you need to: | ||
+ | - Permit Unrestricted PowerShell script execution (into a powershell started with administrative right, enter: Set-ExecutionPolicy unrestricted) | ||
+ | - Unblock the BSDRP-lab script, by righ-clicking on it and selecting properties then click on unblock | ||
+ | |||
+ | <note tip>We recommend to use a BSDRP serial-console image under MS Windows: Avoid potential keyboard layout problems and serial port redirection is well supported under MS Windows.</ | ||
+ | |||
+ | Pre-requise: | ||
+ | * [[http:// | ||
+ | * A RDP client for lab based on BSDRP vga release (included in Windows: mstsc) | ||
+ | * A serial terminal software able to open pipe like [[http:// | ||
+ | |||
+ | Steps: | ||
+ | - Download a BSDRP image and decompress the xz archive (using [[http:// | ||
+ | - Right-click on the BSDRP-lab-vbox.ps1 and select " | ||
+ | |||
+ | After use, if you want to use a new BSDRP image for the lab, delete all Virtualbox BSDRP_lab_* VM. | ||
+ | The script will generate a BSDRP-Putty-sessions.reg file on your desktop: Import this file to your registration database for auto-configuring Putty& | ||
+ | |||
+ | === Under FreeBSD or Linux === | ||
+ | |||
+ | If you want to use Virtualbox, here is the [[https:// | ||
+ | |||
+ | < | ||
+ | chmod +x BSDRP-lab-vbox.sh</ | ||
+ | |||
+ | //Linux users have to replace fetch by wget.// | ||
+ | |||
+ | Pre-requise: | ||
+ | * FreeBSD | ||
+ | * Linux | ||
+ | * Virtualbox (non OSE) 4.2 | ||
+ | * socat installed for using the BSDRP serial release | ||
+ | * A VNC/RDP client for connecting the BSDRP vga release | ||
+ | |||
+ | < | ||
+ | Usage: / | ||
+ | -a ARCH Force architecture: | ||
+ | This disable automatic arch/ | ||
+ | You should use -o with -a | ||
+ | -c | ||
+ | -d | ||
+ | -i filename BSDRP image file name (to be used the first time only) | ||
+ | -h | ||
+ | -l Y | ||
+ | -m RAM (in MB) for each VM (default: 192) | ||
+ | -n X | ||
+ | -o CONS Force console: | ||
+ | -s Stop all VM | ||
+ | -v | ||
+ | </ | ||
+ | ==== Example of use ==== | ||
+ | |||
+ | Using qemu: | ||
+ | < | ||
+ | ./ | ||
+ | </ | ||
+ | |||
+ | or with VirtualBox script: | ||
+ | |||
+ | < | ||
+ | ./ | ||
+ | |||
+ | BSD Router Project (http:// | ||
+ | Image file given... rebuilding BSDRP router template and deleting all routers | ||
+ | x86-64 image | ||
+ | serial image | ||
+ | Creating lab with 4 router(s): | ||
+ | - 2 LAN between all routers | ||
+ | - Full mesh Ethernet links between each routers | ||
+ | |||
+ | Router1 have the following NIC: | ||
+ | em0 connected to Router2. | ||
+ | em1 connected to Router3. | ||
+ | em2 connected to Router4. | ||
+ | em3 connected to LAN number 1. | ||
+ | em4 connected to LAN number 2. | ||
+ | Router2 have the following NIC: | ||
+ | em0 connected to Router1. | ||
+ | em1 connected to Router3. | ||
+ | em2 connected to Router4. | ||
+ | em3 connected to LAN number 1. | ||
+ | em4 connected to LAN number 2. | ||
+ | Router3 have the following NIC: | ||
+ | em0 connected to Router1. | ||
+ | em1 connected to Router2. | ||
+ | em2 connected to Router4. | ||
+ | em3 connected to LAN number 1. | ||
+ | em4 connected to LAN number 2. | ||
+ | Router4 have the following NIC: | ||
+ | em0 connected to Router1. | ||
+ | em1 connected to Router2. | ||
+ | em2 connected to Router3. | ||
+ | em3 connected to LAN number 1. | ||
+ | em4 connected to LAN number 2. | ||
+ | Connect to router 1: socat unix-connect:/ | ||
+ | Connect to router 2: socat unix-connect:/ | ||
+ | Connect to router 3: socat unix-connect:/ | ||
+ | Connect to router 4: socat unix-connect:/ | ||
+ | </ | ||
+ | |||
+ | This will start 4 routers full-meshed (ethernet cross-over cable) and each routers connected to 2 LAN: | ||
+ | |||
+ | {{: | ||
+ | ===== GNS3 ===== | ||
+ | |||
+ | If you would testing BSDRP integration with Cisco/ | ||
+ | |||
+ | ==== VirtualBox ==== | ||
+ | |||
+ | Latest release of GNS3 support the use of virtualbox guest: The guest speed with virtualbox is a lot's better than with Qemu. | ||
+ | |||
+ | === Preparing BSDRP image disk for VirtualBox === | ||
+ | |||
+ | Download a full i386/amd65 BSDRP serial image and un-xz it (using 7-zip)… you should obtain a .img file (not a .xz file!). | ||
+ | |||
+ | Using a serial image will permit to prevent keyboard mapping problem: We will connect to the console with a virtual serial port and Putty. | ||
+ | |||
+ | We need to convert the RAW BSDRP .img file to a .vdi VirtualBox hard drive image using the command-line only [[http:// | ||
+ | |||
+ | Under MS Windows this is done by opening a cmd.exe window and entering: | ||
+ | < | ||
+ | C: | ||
+ | C:\Program Files\Oracle\VirtualBox> | ||
+ | Converting from raw image file=D: | ||
+ | Creating dynamic image with size 256000000 bytes (245MB)... | ||
+ | |||
+ | C:\Program Files\Oracle\VirtualBox> | ||
+ | </ | ||
+ | |||
+ | === Create a BSDRP VM under VirtualBox === | ||
+ | |||
+ | Now start VirtualBox and create a new VM: | ||
+ | * Name: What you want | ||
+ | * OS: BSD | ||
+ | * Version: " | ||
+ | * RAM: 128Mo minimum | ||
+ | * Hard Drive: Use existing, and select your freshly converted .vdi BSDRP image file | ||
+ | |||
+ | Then, only if you are using the " | ||
+ | * Serial Port: Port 1 | ||
+ | * Enable | ||
+ | * Mode: Host pipe | ||
+ | * Check the case: Create pipe | ||
+ | * port path: \\.\pipe\YOUR_VM_NAME | ||
+ | |||
+ | You can test your settings by starting your VM and launch PuTTY with theses parameters: | ||
+ | * Connection type: serial | ||
+ | * serial port: \\.\pipe\YOUR_VM_NAME | ||
+ | * Speed: 115200 | ||
+ | You should see the bootloader and dmesg, now shutdown your VM. | ||
+ | |||
+ | === Declaring a VirtualBox Guest === | ||
+ | |||
+ | Under GNS3, go to " | ||
+ | |||
+ | And simply select the BSDRP Vbox VM. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ==== Qemu ==== | ||
+ | |||
+ | Use Qemu only if you can use the KVM acceleration feature (GNS3 under GNU/Linux only), if not: Use the virtualbox guest. | ||
+ | |||
+ | === Preparing BSDRP i386 VGA image for GNS3's Qemu === | ||
+ | |||
+ | Download a full i386 BSDRP VGA and un-xz it (using 7-zip)… you should obtain a .img file (not a .xz file!). | ||
+ | |||
+ | Don't use a 64bit image: | ||
+ | |||
+ | === Declaring a Qemu Guest === | ||
+ | |||
+ | Under GNS3, go to " | ||
+ | |||
+ | And simply give the path to the BSDRP vga image. | ||
+ | |||
+ | {{: | ||
+ | === Troubleshooting === | ||
+ | |||
+ | If when you try starting your BSDRP qemu host you have this message: | ||
+ | |||
+ | "CPU doesn' | ||
+ | |||
+ | This mean your are trying to start a 64bits OS on your 32bits emulated guest. | ||
+ | |||
documentation/examples/how_to_build_a_bsdrp_router_lab.txt · Last modified: 2017/11/25 04:30 by 127.0.0.1