21 - 12 - 2024

Configuring netbsd (sparc) appliance for IOU

There are alot of articles covering subject of IOU running on Linux and Unix. I would like to go deeper and specific how we can create some useful confiugration on NETBSD/SPARC to have this maybe easier in some cases.

The goals I've set are:

  • Ony one IOU instance per NETBSD appliance
  • Use GNS3 clouds (UDP TAP) to provide connectivity between each NETBSD instance and other part of networks. This was really forced, in first instance I tried to create some kind of bridge, but NETBSD didn't recognize second LE (ethernet card) correctly
  • Make it as more automaticated as it is possible
  • Keeps each service separated

I won't describe the requirements, instead of that the ready-to-go image with my scripts will be available.

The requirements:

  • Valid license key for IOU saved in file "~/.iourc"
  • An IOU SPARC image, should be copied into folder "/srv/NFS/CISCO/IOU/Unix/bin/"
  • Configured an bridge interface with DHCP server listening on that server - static IPs can be used instead
  • Qemu v1.6.2 with qemu-system-sparc

Step 1. Copy the SPARC IOU image

The first steps from requirements will be omitted as these should be provided by you.

  1. Create an ISO file with the image you want - I would suggest to copy one file per iso because I had some issues with reading after mounting it. You can use free tools like "Free ISO Creator" or "Free WinISO".
  2. Download the image from bottom of this page.
  3. Run qemu-sparc with following command
  4. your_host# qemu-system-sparc -hda <path_to_IOU-SPARC-TEMPLATE.img> -cdrom <path_to_QEMU-IMAGE-ISO> -net none -nographic -M SS-20
  5. Copy the IOU image, using this commands:
    iou-net# dmesg | grep cdrom
    cd0 at scsibus0 target 2 lun 0: <QEMU, QEMU CD-ROM, 1.6.> cdrom removable
    iou-net# mount /dev/cd0a /mnt
    iou-net# cp /mnt/<SPARC-IMAGE> /srv/NFS/CISCO/IOU/Unix/bin/

Configure the startup script

  1. Open the script:
    iou-net# vi /srv/NFS/CISCO/IOU/Unix/scripts/run_IOU.sh
  2. Edit and set variables:
    #IMAGE RUN ON THIS INSTANCE
    IOU_IMAGE="bin/unixlXXX"
    
    # REMOTE UDP SERVER - DYNAMIPS SERVER
    UDP_SERVER_IP="172.21.192.2"
    UDP_PREFIX_LOCAL="200"
    UDP_PREFIX_REMOTE="300"
    

    IOU_IMAGE <-- This is the name of SPARC-IMAGE, please keep the "bin/" part

    UDP_SERVER_IP <-- It's the Gateway address of Bridge interface which will be used between GNS Cloud and the interfaces

    UDP_PREFIX_LOCAL <-- Prefix of UDP Port, in example Eth1/1 in IOU appliance with prefix 200 will be 20011. UDP prefix doesn't need to be unique between devices with different IP address.

    UDP_PREFIX_REMOTE <-- Prefix of remote end (GNS Cloud) UDP Port. This is to prevent using the same numeration for multiple IOU machines running. In Example put 300 for first appliance the second IOU appliance should have 301. The remote port will be 30011 and 30011 for Eth1/1. Change of UDP REMOTE PREFIX is required when using the same IP Address for UDP SERVER(provided in GNS Cloud configuration).

  3. Write the configuration files
  4. Remove file with generated MAC address. This file is used to prevent using the same MAC for multiple hosts within the same L2 network:
    iou-net# rm -f /etc/le0.mac
  5. Power off the machine
    iou-net# halt -p

GNS configuration

Depending on the version and GNS configuration it may be different. Below please reffer to general configuration details:

General
Memory: 400 MB
QEMU binary: qemu-system-sparc

Hard disks
Disk image (hda): <path_to_IOU-SPARC-TEMPLATE.img>

Network
Adapters: 0
Type: lance

Additional options
Options: -nographic -M SS-20 -net bridge,br=<BRIDGE_INTERFACE_NAME> -net nic,model=lance

The only parts that should be adjusted to your configuration is to specify:

  • <BRIDGE_INTERFACE_NAME> - This is the gateway interface between the SPARC IOU appliance and GNS cloud. This interface must have IP address assigned and provided in startup script described before.
     
  • <path_to_IOU-SPARC-TEMPLATE.img> - The full path to the image.

As you can we don't use network interface configured directly in GNS. It's configured in "Additional options", this allows to assign the interface as part of Linux Bridge.

GNS Cloud configuration

GNS Cloud is only practical solution to provide connectivity between ONE ETHERNET PORT ON IOU SPARC APPLIANCE AND OTHER GNS DEVICES. In example to connect to IOU appliances with one GNS QEMU host (CSR1000v etc.) is required:

  • Two GNS cloudes configured - One cloud represents one interfaces of only one IOU appliance
  • Change of the startup script - only one value needs to be changed (UDP_PREFIX_REMOTE). It's required because the GNS Cloud cannot listen on the same UDP port.

When you configure the IOU SPARC image correctly by copying and change the binary path in the startup script  - IT WILL BE AUTOMATICALLY LOADED ON BOOT. To exit the IOU CLI press CTRL + A + D, it will return to the system/Unix command line. All processes are running in "screen" sessions. To learn more about screen, visit https://www.gnu.org/software/screen/manual/screen.html

...
Starting MAC address modification

Generating new MAC address...
Setting up new MAC, 52:54:00:ca:8a:d9

Running DHCP client @ le0
Internet Systems Consortium DHCP Client V3.0.3
Copyright 2004-2005 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/products/DHCP

Listening on BPF/le0/52:54:00:ca:8a:d9
Sending on   BPF/le0/52:54:00:ca:8a:d9
Sending on   Socket/fallback
DHCPDISCOVER on le0 to 255.255.255.255 port 67 interval 8
DHCPOFFER from 172.21.192.13
DHCPOFFER from 172.21.192.12: already seen.
DHCPREQUEST on le0 to 255.255.255.255 port 67
DHCPNAK from 172.21.192.12
DHCPDISCOVER on le0 to 255.255.255.255 port 67 interval 5
DHCPOFFER from 172.21.192.12
DHCPREQUEST on le0 to 255.255.255.255 port 67
DHCPNAK from 172.21.192.13
DHCPACK from 172.21.192.12
bound to 172.21.245.165 -- renewal in 724403399 seconds.
.
Updating motd.
postfix/postfix-script: starting the Postfix mail system
Starting inetd.
Starting cron.
Wed Feb  4 16:04:14 AST 2015

NetBSD/sparc (iou-net) (console)

Last login: Sun Nov  2 05:21:17 2014 on console
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007, 2008, 2009, 2010, 2011, 2012
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 5.1 (IOUKERNEL) #0: Thu May 24 20:49:40 AST 2012

Welcome to NetBSD!

Terminal type is vt100.
We recommend creating a non-root account and using su(1) for root access.
Running IOU launching script
### LOCAL IP: 172.21.245.165 ###
STARTING UP IMAGE bin/unixl2-upk9-ms.sept16-ec
ln: /srv/NFS/CISCO/IOU/Unix/tmp/NETMAP: File exists
Exectuing: /srv/NFS/CISCO/IOU/Unix/scripts/wrapper -m /srv/NFS/CISCO/IOU/Unix/bin/unixl2XXXX -p 2021 -- -m 200 -e4 -s0 -c /srv/NFS/CISCO/IOU/Unix/NETMAP 10 & in screen session IOU_MAIN
STARTING UP UDP SESSIONS
Waiting on port 2021 ...
Process Id for child is 411, parent is 1
UDP SESSION FOR INTERFACE ETH00 STARTED
UDP SESSION FOR INTERFACE ETH01 STARTED
UDP SESSION FOR INTERFACE ETH02 STARTED
UDP SESSION FOR INTERFACE ETH03 STARTED
UDP SESSION FOR INTERFACE ETH10 STARTED
UNIX ERR:tcgetattr:Error 0
UDP SESSION FOR INTERFACE ETH11 STARTED
UDP SESSION FOR INTERFACE ETH12 STARTED
UDP SESSION FOR INTERFACE ETH13 STARTED
UDP SESSION FOR INTERFACE ETH20 STARTED
UDP SESSION FOR INTERFACE ETH21 STARTED
UDP SESSION FOR INTERFACE ETH22 STARTED
UDP SESSION FOR INTERFACE ETH23 STARTED
UDP SESSION FOR INTERFACE ETH30 STARTED
UDP SESSION FOR INTERFACE ETH31 STARTED
UDP SESSION FOR INTERFACE ETH32 STARTED
UDP SESSION FOR INTERFACE ETH33 STARTED
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Router#show cdp  nei
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone,
                  D - Remote, C - CVTA, M - Two-port Mac Relay

Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
SPARC_1          Gig 0/0            134             R S   Solaris U Eth 1/1
SPARC_2          Gig 1/0            140             R S   Solaris U Eth 1/1
Router#ping 192.168.0.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 8/17/32 ms
Router#ping 192.168.100.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.100.1, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 12/19/24 ms
Router#

 

Attachments:
Download this file (IOU-SPARC-TEMPLATE.img)IOU-SPARC-TEMPLATE.img[ ]167488 kB