We fasten the Cisco IOU emulator to physical interfaces
For novice network engineers, the ability to simulate a Cisco router and test it on the field of creativity is one of the driving factors for practical training.
Having stumbled upon an article about the existence of the IOS on UNIX package, I expected when the author will describe the construction of the network topology. But patience is not endless, and I looked at the site of the original publications - evilrouters.net .
How to start the emulator (i86bi_linux-adventerprisek9-ms) is described in the above sources.
We will consider the construction of topology.
To build the network topology, the NETMAP file is located in the directory with the emulator file to be launched (i86bi_linux-adventerprisek9-ms). Consider the general case of modeling three routers connected to a certain logical network:
thus, the structure of the NETMAP file will look like this: - where 10 (11, 12) is the router ID in the logical topology and has no relation to the host name. Now consider the most interesting thing, connecting one router to physical interfaces. To run the emulator (i86bi_linux-adventerprisek9-ms), we used a computer with two network adapters and installed Unbuntu OC, and to connect to physical adapters we used the perl script from the next article .
In the folder with the emulator, create a file:
and copy the contents of the article into it after the word Scritp;
change the permissions to run the
script; it requires the following packages;
if we install the pearl modules, then using CPAN
to run the script on Ubuntu, it was necessary to add a link
After all preparations, run the script with the following command:
- after the key i, the network adapter is indicated on which the router port will be hooked up, whose ID, in turn, must be specified in the NETMAP file;
- after the key p, the pseudo-ID of the router is indicated (in fact, this is the virtual ID of the network card).
To bind to several network adapters, you need to run the script several times, for example:
$ cat NETMAP
10: 1/0 @ hostname 20: 0/0 @ hostname
10: 1/1 @ hostname 21: 0/0 @ hostname
[...]
$ sudo ./iou2net.pl -i eth0 -p 20 &
[...]
$ sudo ./iou2net.pl -i eth1 -p 21 &
[...]
- a router with ID 10 with port 1/0 is connected to a pseudo-router with ID 20, which is actually a network through a script adapter eth0, the second port 1/1 is connected to the pseudo ID 21 - to the network card eth1.
- hostname - the name of the host on which the emulator is running.
For tests on the virtual router, static NAT was configured, and a torrent client with a download speed of 6 Mbps was launched on the machine behind the nat and at the same time, the downloading of a large amount of small files located behind the nat via the SMB protocol was initialized. The load on the processor of the virtual router was no more than 60%, and the physical processor was only 30% loaded.
Having stumbled upon an article about the existence of the IOS on UNIX package, I expected when the author will describe the construction of the network topology. But patience is not endless, and I looked at the site of the original publications - evilrouters.net .
How to start the emulator (i86bi_linux-adventerprisek9-ms) is described in the above sources.
We will consider the construction of topology.
To build the network topology, the NETMAP file is located in the directory with the emulator file to be launched (i86bi_linux-adventerprisek9-ms). Consider the general case of modeling three routers connected to a certain logical network:
thus, the structure of the NETMAP file will look like this: - where 10 (11, 12) is the router ID in the logical topology and has no relation to the host name. Now consider the most interesting thing, connecting one router to physical interfaces. To run the emulator (i86bi_linux-adventerprisek9-ms), we used a computer with two network adapters and installed Unbuntu OC, and to connect to physical adapters we used the perl script from the next article .
10:1/1 11:1/0
10:1/2 12:1/0
In the folder with the emulator, create a file:
touch iou2net.pl
and copy the contents of the article into it after the word Scritp;
change the permissions to run the
chmod +x ./iou2net.pl
script; it requires the following packages;
sudo apt-get install libnet-pcap-perl libpcap0.8
if we install the pearl modules, then using CPAN
perl -MCPAN -e 'install Net::Pcap'
to run the script on Ubuntu, it was necessary to add a link
sudo ln -s /usr/lib/libcrypto.so.0.9.8 /usr/lib/libcrypto.so.4
After all preparations, run the script with the following command:
sudo ./iou2net.pl -i eth0 -p 20 &
- after the key i, the network adapter is indicated on which the router port will be hooked up, whose ID, in turn, must be specified in the NETMAP file;
- after the key p, the pseudo-ID of the router is indicated (in fact, this is the virtual ID of the network card).
To bind to several network adapters, you need to run the script several times, for example:
$ cat NETMAP
10: 1/0 @ hostname 20: 0/0 @ hostname
10: 1/1 @ hostname 21: 0/0 @ hostname
[...]
$ sudo ./iou2net.pl -i eth0 -p 20 &
[...]
$ sudo ./iou2net.pl -i eth1 -p 21 &
[...]
- a router with ID 10 with port 1/0 is connected to a pseudo-router with ID 20, which is actually a network through a script adapter eth0, the second port 1/1 is connected to the pseudo ID 21 - to the network card eth1.
- hostname - the name of the host on which the emulator is running.
For tests on the virtual router, static NAT was configured, and a torrent client with a download speed of 6 Mbps was launched on the machine behind the nat and at the same time, the downloading of a large amount of small files located behind the nat via the SMB protocol was initialized. The load on the processor of the virtual router was no more than 60%, and the physical processor was only 30% loaded.