📜 ⬆️ ⬇️

We screw the Cisco IOU emulator to the physical interfaces

For novice network engineers, the ability to model a Cisco router and test it on the creative field is one of the driving factors for practical learning.



Having come across an article about the existence of the IOS on UNIX package, I expected the author to describe the construction of the network topology. But patience is not infinite, and I looked at the site of the original publications - evilrouters.net .
')
How to run the emulator (i86bi_linux-adventerprisek9-ms) is described in the aforementioned sources.
We will consider the construction of the topology.

To build the network topology, the NETMAP file is used, which is located in the directory with the emulator file being launched (i86bi_linux-adventerprisek9-ms). Consider the general case of simulating three routers connected to a logical network:
image

Thus, the structure of the NETMAP file will be as follows:

10:1/1 11:1/0
10:1/2 12:1/0


- where 10 (11, 12) is the router ID in the logical topology and there is no relationship to the host name.

Now let's take a look at the most interesting, connecting a single router to physical interfaces.

To run the emulator (i86bi_linux-adventerprisek9-ms), a computer with two network adapters and Unbuntu OS installed was used, and a perl script from the following article was used to connect to the physical adapters.

In the folder with the emulator create the file:
touch iou2net.pl
and copy the contents of the article into it after the word Scritp
change launch rights
chmod +x ./iou2net.pl
The script requires the following packages.
sudo apt-get install libnet-pcap-perl libpcap0.8
if pearl modules are not installed then install using CPAN
perl -MCPAN -e 'install Net::Pcap'
to run the script on ubuntu it took to add a link
sudo ln -s /usr/lib/libcrypto.so.0.9.8 /usr/lib/libcrypto.so.4
After all the preparations, run the script with the following command:
sudo ./iou2net.pl -i eth0 -p 20 &
- after the i key, 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 multiple 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 via a script, is an eth0 network adapter, the second port 1/1 is connected to pseudo ID 21 - to an eth1 network card.
- hostname - the name of the host on which the emulator is running.

For tests on a virtual router, static NAT was configured, and a torrent client was launched on a machine behind Nat, with a download speed of 6 Mbps and at the same time the download of a large amount of small files located behind the nat protocol via SMB was initialized. The load on the virtual router processor was no more than 60%, and the physical processor was loaded only by 30%.

Source: https://habr.com/ru/post/115048/


All Articles