Thursday 9 February 2012

Cisco L2 / L3 IOU on FreeBSD 9 64Bit

Software Install


Install FreeBSD 9 64-bit as per normal and give it a hostname like myiou. A five letter host name will work better. Then goto http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/linuxemu-lbc-install.html  and follow the first few steps of the linux compatibility install guide. These are replicated below:


kldload linux
kldstat
Add linux_enable="YES" /etc/rc.conf


cd /usr/ports/emulators/linux_base-f10
make install

The IOU L2 & L3 binaries are 32 bit as a result I'm installing the 32 bit linux libraries that it requires (notice the i368 keyword in the rpms)

Install rpm2cpio
cd  /usr/ports/archivers/rpm2cpio
make install

Install libcrypto.so.4 from openssl-0.9.7a-20.2.i386.rpm as follows
1) rpm2cpio openssl-0.9.7a-20.2.i386.rpm | cpio -idm
2) cp lib/libcrypto.so.0.9.7a /compat/linux/lib/
3) ln -s /compat/linux/lib/libcrypto.so.0.9.7a /compat/linux/lib/libcrypto.so.4

Install libcom_err.so.3 from krb5-libs-1.2.7-10.i386.rpm as follows
1) rpm2cpio krb5-libs-1.2.7-10.i386.rpm | cpio -idm
2) cp usr/kerberos/lib/libcom_err.so.3.0 /compat/linux/lib/

3) ln -s /compat/linux/lib/libcom_err.so.3.0 /compat/linux/lib/libcom_err.so.3

Now notice that the hostid for the "freebsd" machine is different to the linux compat:

FreeBSD
/etc/rc.d/hostid start
Setting hostuuid: 564dfe52-4453-f568-f0f0-a7ff9a1778ba.
Setting hostid: 0x94ad1311.


Linux Compat (NOTE: the number returned is in hex and seems to be the same across a number of builds)
/compat/linux/usr/bin/hostid
64343635


Use the linux compat hostid to generate license. Find the gen.c source code (Keygen for IOU) and compile as shown below:

gcc -g gen.c -o gen -lssl

Create the iourc in the following format:

[license]
myiou = 87************30;

Create a sample NETMAP file which contains:

101:0

L3 IOU (Router)

Now run L3 IOU as follows:


./wrapper-linux -m /path/to/iou/i86bi_linux-adventerprisek9-ms -p 2222 -- 101

Note the path has to be exact, for some reason it does not like a ./

Connected to the router as:
telnet localhost 2222
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.


         --- System Configuration Dialog ---

Would you like to enter the initial configuration dialog? [yes/no]:
% Please answer 'yes' or 'no'.
Would you like to enter the initial configuration dialog? [yes/no]:
% Please answer 'yes' or 'no'.



The default interfaces this starts up with are:

Router#show ip int b
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                unassigned      YES unset  administratively down down
Ethernet0/1                unassigned      YES unset  administratively down down
Ethernet0/2                unassigned      YES unset  administratively down down
Ethernet0/3                unassigned      YES unset  administratively down down
Ethernet1/0                unassigned      YES unset  administratively down down
Ethernet1/1                unassigned      YES unset  administratively down down
Ethernet1/2                unassigned      YES unset  administratively down down
Ethernet1/3                unassigned      YES unset  administratively down down
Serial2/0                  unassigned      YES unset  up                    down
Serial2/1                  unassigned      YES unset  administratively down down
Serial2/2                  unassigned      YES unset  administratively down down
Serial2/3                  unassigned      YES unset  administratively down down
Serial3/0                  unassigned      YES unset  administratively down down
Serial3/1                  unassigned      YES unset  administratively down down
Serial3/2                  unassigned      YES unset  administratively down down
Serial3/3                  unassigned      YES unset  administratively down down


The IOS version message is:

Router#show ver
Cisco IOS Software, Linux Software (I86BI_LINUX-ADVENTERPRISEK9-M), Experimental Version 12.4(20090407:185408) [yuiu-redbuild-V124_24_5_6_PIC1 177]
Copyright (c) 1986-2009 by Cisco Systems, Inc.
Compiled Wed 08-Apr-09 02:09 by yuiu

ROM: Bootstrap program is Linux

Router uptime is 5 days, 16 hours, 52 minutes
System returned to ROM by reload at 0
System image file is "unix:/usr/i86bi_linux-adventerprisek9-ms"


This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
export@cisco.com.

Linux Unix (Intel-x86) processor with 40401K bytes of memory.
Processor board ID 2050149
8 Ethernet interfaces
8 Serial interfaces
16K bytes of NVRAM.

Configuration register is 0x0





L2 IOU (Switch)

You can run L2 IOU as follows (with same iourc and NETMAP):


 ./wrapper-linux -m /path/to/iou/l2iou/i86bi_linuxl2-upk9-ms -p 2222 -- 101

Connected to the switch as:

telnet localhost 2222
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

% Please answer 'yes' or 'no'.
Would you like to enter the initial configuration dialog? [yes/no]: n


Press RETURN to get started!




The default interfaces the switch starts up with are:

Router#show ip int b
Interface              IP-Address      OK? Method Status                Protocol
Ethernet0/0            unassigned      YES unset  administratively down down
Ethernet0/1            unassigned      YES unset  administratively down down
Ethernet0/2            unassigned      YES unset  administratively down down
Ethernet0/3            unassigned      YES unset  administratively down down
Ethernet1/0            unassigned      YES unset  administratively down down
Ethernet1/1            unassigned      YES unset  administratively down down
Ethernet1/2            unassigned      YES unset  administratively down down
Ethernet1/3            unassigned      YES unset  administratively down down
Serial2/0              unassigned      YES unset  administratively down down
Serial2/1              unassigned      YES unset  administratively down down
Serial2/2              unassigned      YES unset  administratively down down
Serial2/3              unassigned      YES unset  administratively down down
Serial3/0              unassigned      YES unset  administratively down down
Serial3/1              unassigned      YES unset  administratively down down
Serial3/2              unassigned      YES unset  administratively down down
Serial3/3              unassigned      YES unset  administratively down down
Vlan1                  unassigned      YES unset  administratively down down


The IOS version message is:

Router#show ver
Cisco IOS Software, Linux Software (LINUXL2-UPK9-M), Experimental Version 12.2(20100802:165548) [mtimm-mtrosel2iol 102]
Copyright (c) 1986-2010 by Cisco Systems, Inc.
Compiled Mon 02-Aug-10 10:05 by mtimm

ROM: Bootstrap program is Linux

 Router uptime is 1 minute
System returned to ROM by reload at 0
System image file is "unix:/usr/i86bi_linuxl2-upk9-ms"


This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
export@cisco.com.

Linux Unix (Intel-x86) processor with 204264K bytes of memory.
Processor board ID 2050249
8 Ethernet interfaces
8 Serial interfaces
16K bytes of NVRAM.

Configuration register is 0x0


Aliases

Here are some aliases is use to make life easy. These are formatted for a zsh shell buts its easy to convert them to equivalent tcsh/csh commands.

alias kw="killall wrapper-linux"

alias r1="telnet localhost 2101"
alias r2="telnet localhost 2102"
alias r3="telnet localhost 2103"
alias r4="telnet localhost 2104"
alias r5="telnet localhost 2105"
alias r6="telnet localhost 2106"

alias s1="telnet localhost 3101"
alias s2="telnet localhost 3102"
alias s3="telnet localhost 3103"

For these to work I have mapped my IOU instances as follows:


Device IOU ID TCP Port
R1 101 2101
R2 102 2102
R3 103 2103
R4 104 2104
R5 105 2105
R6 106 2106
R7 107 2107
S1 301 3101
S2 302 3102



NETMAP Topology Generation

Source: here

NETMAP does not use interface names but, rather, interface IDs. The IDs are not tied to a specific interface type (e.g. Serial or Ethernet). When launching an IOU instance, you can specify (via the command-line) which interfaces you want and how many. The ID used for Serial1/2 and Ethernet1/2 would be the same and, as such, it’s impossible to have both of those interfaces in an single instance.

To calculate the ID used by “interface x/y”, you would use the following formula:
id = x + (y * 16)
 
Examples:
  • interface 0/0 = 0
  • interface 0/3 = 48
  • interface 1/2 = 33
  • interface 12/1 = 28
For the default L3 and L2 IOU interfaces the interface IDs are:





Interface                      Slot Port NETMAP ID
Ethernet0/0                    0    0    0
Ethernet0/1                    0    1    16
Ethernet0/2                    0    2    32
Ethernet0/3                    0    3    48
Ethernet1/0                    1    0    1
Ethernet1/1                    1    1    17
Ethernet1/2                    1    2    33
Ethernet1/3                    1    3    49
Serial2/0                      2    0    2
Serial2/1                      2    1    18
Serial2/2                      2    2    34
Serial2/3                      2    3    50
Serial3/0                      3    0    3
Serial3/1                      3    1    19
Serial3/2                      3    2    35
Serial3/3                      3    3    51



Working Example


You can find a working example using this setup here.






Updates


28/3/12 - Traceback
During my use of L3 IOU I've noticed the following traceback appear regularly. At the moment this seems cosmetic. However it seems to increase with frequency as you continue to use the image. Restarting that instance of IOU fixes the issue.


*Mar 30 09:57:33.599: %SYS-2-CHUNKSIBLINGS: Attempted to destroy chunk with siblings, chunk 2DFF0FD8. -Process= "Exec", ipl= 0, pid= 88,  -Traceback= 0xA70B0A7z 0xA70B268z 0xA23A686z 0xA23A5C2z 0x9584198z 0x95FACECz 0x95FAC3Fz 0x95F9989z 0x95F5809z 0x8CD5B1Ez 0x8CD3659z 0x8CE665Cz



26/4/12 - L3 IOU 15.0
This is the only version of IOU 15.0 that I runs under FreeBSD with the above set-up procedure. v15.2 of IOU seems to either crash or go into a nano sleep loop.

Cisco IOS Software, Linux Software (I86BI_LINUX-JK9S-M), Version 15.0(1)XJR111.358, INTERIM SOFTWARE
Synced to V122_49_YST273_111_101108, Branch: mtrose
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2012 by Cisco Systems, Inc.
Compiled Sun 08-Jan-12 07:38 by integ

ROM: Bootstrap program is Linux
ROM: Cisco IOS Software, Linux Software (I86BI_LINUX-JK9S-M), Version 15.0(1)XJR111.358, INTERIM SOFTWARE


4 comments:

  1. Hi,

    I am really keen to know how stable the L2 image is running on Freebsd. I'm running Asasel's IOU image on a VM and although it's great, L2 is buggy when connected in physical loops in that spanning tree doesn't work and the interfaces produce excessive collisions.

    ReplyDelete
    Replies
    1. Hi Yasser, I not used the L2 image extensively so cannot comment on your issue. The L3 image is proving to be quite stable but I do get the occasional trackback message in the logs. However the CPU and memory usage is quite low.

      Delete
  2. Hi friend would u provide L2 IOU binary so i also lab switching i have router binary but not L2 one hope u share my email id is raipraveen83@gmail.com send me here

    ReplyDelete