Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Automatic Network Configuration in Virtualized Environment Using GNS3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Automatic network configuration in virtualized

environment using GNS3


Rodrigo Emiliano∗ , Mário Antunes∗†
∗ School of Technology and Management, Polytechnic Institute of Leiria, Portugal
2130975@my.ipleiria.pt, mario.antunes@ipleiria.pt
† Center for Research in Advanced Computing Systems, University of Porto, Portugal

mantunes@dcc.fc.up.pt

Abstract—Computer networking is a central topic in computer malfunction; iii) students are not able to have these equipments
science courses curricula offered by higher education institutions. at home to practice, which may lead to a learning productivity
Network virtualization and simulation tools, like GNS3, allows loss [1].
students and practitioners to test real world networking configu-
ration scenarios and to configure complex network scenarios by The use of simulators and hypervisors for network equip-
configuring virtualized equipments, such as routers and switches, ments have emerged in the last years [3]. Networking virtual-
through each one’s virtual console. izers, like GNS3, are mostly user-friendly and allow users to
The configuration of advanced network topics in GNS3 re- configure a network device in a virtual machine running the
quires that students have to apply basic and very repetitive IP same operating system as the real network device. Network
configuration tasks in all network equipments. As the network
topology grows, so does the amount of network equipments to simulators (e.g Cisco Packet Tracer) are also graphical but
be configured, which may lead to logical configuration errors. more limited since they usually provide a subset of operating
In this paper we propose an extension for GNS3 network system commands and configuration tasks.
virtualizer, to automatically generate a valid configuration of all Basic networking topology configuration has to follow strict
the network equipments in a GNS3 scenario. Our implementation operations. First we need to define a logical IP configuration
is able to automatically produce an initial IP and routing
configuration of all the Cisco virtual equipments by using the and apply it to all connected interfaces cards of all the equip-
GNS3 specification files. We tested this extension against a set ments. Then we have to configure a routing protocol, such as
of networked scenarios which proved the robustness, readiness RIP or OSPF. Route announcements and node neighborhood
and speedup of the overall configuration tasks. In a learning establishment have to be done manually and must be consistent
environment, this feature may save time for all networking with the logical IP configuration previously made. Finally,
practitioners, both beginners or advanced, who aim to configure
and test network topologies, since it automatically produces there is also a set of general operations that have to be done,
a valid and operational configuration for all the equipments like hostname and remote access levels definition, enabling
designed in a GNS3 environment. logging and access lists definition. Depending on the amount
Keywords-Automatic configuration, GNS3, virtualization, Cisco of interface cards and equipments, these essential and basic
IOS, virtual lab classroom. configuration tasks can be very tedious, repetitive and prone
to human mistakes.
I. I NTRODUCTION For a beginner practitioner these repeated tasks are impor-
Computer networking is actually part of all the relevant tant to explore the command line and to gain experience on
computer science courses curricula that are running in higher configuring a network device. However, for more experienced
education institutions worldwide [1]. In its last revision, ones, who are able to hands-on in more advanced topics, these
ACM curriculum guidelines report for undergraduate degree initial configuration tasks are not challenging and, depending
programs in computer science [2] included Networking and on the amount of equipments involved, may be very time
Communication (NC) as a knowledge area in computer science consuming.
curricula, replacing Net-Centric Computing curricula topic In this paper we propose an extension for GNS3 to auto-
that was introduced in the revision of 2001. This measure matically generate the configuration of all the Cisco network
is explainable by the growing number of computing activities equipments that are part of a virtual topology. We take
and applications that are ubiquitous and strongly depend on advantage of the topology setup configuration files produced
the correct operation of the underlying network [2]. by GNS3 to automatically generate the nodes (e.g. routers
Learning and teaching networking topics in a classroom re- and switches) configuration files, without the need to access
quires an effective access to network equipments (e.g. routers their corresponding consoles. Our implementation is also able
and switches) so the students can have an hands-on experi- to include customized settings, like the routing protocol to be
ence with the configuration and troubleshooting of complex used and which baseline configuration should be applied. This
and heterogeneous scenarios. Such approaches have however extension for GNS3 allows beginner practitioners to produce
some weaknesses: i) setting up a computer networking lab valid configuration files that can be further analysed, repli-
may be expensive; ii) equipments become obsolete and may cated and even applied to real network equipments. For more
Table I
experienced students or practitioners this extension allows to A PPLICATIONS TESTED FOR NETWORK AUTOMATIC CONFIGURATION .
speedup the overall network configuration task in large and
complex network topologies, since they may overtake some Netomata
Solarwinds GEN-IT AutoNetKit
Config Gen.
initial and repetitive IP configuration steps. License GPL GPL Windows GPL
The rest of the paper is organized as follows. We start in Multi-vendor Yes No Yes Yes
Section II by describing and comparing the most relevant auto- Support No Yes No Yes
matic configuration solutions for networks. We then proceed in Effectiveness Yes Yes No Yes
GUI No Yes Yes Yes
Section III by detailing our proposed approach. In Section IV
we explain the major issues regarding the development. In
Section V we present and analyse the results obtained with Gen-IT is available only for Windows, is proprietary and
the use of our application in classroom lab scenarios. Finally, uses spreadsheets and templates for mass configuration. Au-
in Section VI we present the most relevant conclusions and toNetKit uses a graphical user interface for network design
delineate some directions for future work. and virtualization. It has network flow simulation and analysis
II. R ELATED W ORK functions through a web interface, which allows the visu-
alization of the designed network’s nodes and their interac-
Self-study, certification, proficiency and long-life learning tions [11]. Netomata Config Generator uses a command-line
in networking skills can be achieved by using physical equip- approach for network configuration. It is based on python
ments, but it is fundamentally done by using specific and specification files to determine the nodes and their interaction.
dedicated simulators and hypervisors [3]. We have installed, tested and evaluated these applications,
There is an evident difference between virtualization of since they are in some way, in line with our proposal to auto-
network devices [4] and simulation [5]. While simulators can matically generate a network configuration. Table I compares
be a helping hand in the initial learning stages, they become the applications in some essential features.
limited when the network topologies get more complex, both While existing applications for automatic configuration have
in size and in the protocols involved, since only a subset of interesting features, there are still many challenges and im-
features are usually available. Some examples of simulators are provements to be made. Some applications did not have
Cisco Packet Tracer or Huawei eNSP simulator [6] [7] [8]. A any documentation or user and development support. Some
different approach is provided by virtualized applications that of them did not create the bulk configuration to be loaded
are able to manage a set of virtual machines running the same into the devices, while others only allow to configure one
operating system kernel version of the real network device. equipment at a time. An important issue is related with multi-
GNS3 [9] [10] is one of the most commonly used application vendor support, since almost all the applications are only
to virtualize Cisco networks. GNS3 hypervisor, dynamips, available to Cisco operating system (IOS) or did not have any
manages a topology of internetworked Cisco devices and clarification on how can be implemented on a multi-vendor
allows the access to a virtual console port and consequently network topology.
to the Cisco IOS command line. Virtualized network topology After analysing the existing approaches for automatic con-
settings can be changed according to memory and CPU figuration and also identifying the benefits of using GNS3
configuration in the host system. Virtualized devices in GNS3 network virtualizer, we present in next section the proposed
can also interact with real routers and networks connected to approach for our work, which consists on an application that
the host system, providing full integration between virtualized can be integrated on GNS3, to automatically generate initial
and real world scenarios and thus extending the whole network configuration files.
topology [10]. Configuration files are plain text and identical
in both real and virtual routers managed by GNS3. So, GNS3 III. P ROPOSED A PPROACH
allows network practitioners to learn networking technologies In this section we propose an extension to GNS3 network
and to test real world networking configurations without the virtualizer that can automatically generate the initial configu-
need of having physical equipments. ration files of all the routers involved in a network scenario.
Besides network virtualizers and simulators, there is a wide GNS3 graphical interface allows the user to easily design
range of applications that help to automatically produce the the topology, which produces a text specification file with
configuration of network equipments. Some examples are Ne- relevant information for each object. Our application reads this
tomata Config Generator (http://www.netomata.com), configuration file and generates the Cisco IOS configuration
Gen-IT (http://gen-it.net), AutoNetKit file related to each device. The application will produce a valid
(http://autonetkit.org) and Solarwinds Network and working configuration files set, based on some general
Config Generator (http://www.solarwinds.com). settings, like the way IP addresses are chosen and which
These applications use different approaches to automate the routing protocol will be used.
generation of configuration files. Solarwinds Network Config Figure 1 illustrates the proposed architecture. After drawing
Generator only permits one router at a time configuration. the topology with GNS3, the resulting JSON project file
It allows custom templates that can be based on Solarwinds’ (.gns3) has the network topology specification, which in-
Thwack online community templates. cludes all the nodes specification and the relations between
interface __INTERFACE__
ip address __ADDRESS__ __MASK__
description __DESCRIPTION__
no shutdown

Figure 2. An example of a template.

masks to be replaced by values generated by the script or


provided by the user. Figure 2 illustrates a template used to
configure a interface card.
The masks __INTERFACE__, __ADDRESS__,
__MASK__ and __DESCRIPTION__ will be replaced
by the script with the values corresponding to an interface
object belonging to the router being configured, namely the
ip address, subnet mask and description.
In the next section we describe the major ideas regarding
the development of our application.

IV. D EVELOPMENT
Our application was developed on Perl, a high level all-
purpose programming language that excels on the reading and
processing of data. We took advantage on intrinsic Perl Object
Oriented Programing (OOP) features, since there is a lot of
processing and storage of data. Figure 3 illustrates how the
application is organized and which developed modules are
Figure 1. Proposed architecture.
being used, along with some relevant features.

them. Our application, a set of scripts developed in Perl,


receives two input files as parameters: the .gns3 file and
a specification file with settings related with the way configu-
ration has to be created. After parsing the GNS3 file, the script
will automatically generate the initial configuration files of all
the network devices, in such a way that the logical topology
and IP configuration are valid and operational. Those config-
uration files will be generated using predefined templates, in
which we define the commands required for each function, like
setting IP in an interface card or configuring a specific routing
protocol. After the file generation stage has been completed
and since GNS3 stores the configuration files for each node
in a network project, the newly generated configuration files
produced by our script will replace the initial (and empty)
ones. Finally, since we start the Cisco IOS virtual machines
through GNS3, the newly created configuration files will
Figure 3. Main components of the application.
be loaded for each corresponding device, represented by a
separated virtual machine.
The way our script uses the correct Cisco IOS commands The application is modular and organized in the following
for each configuration line is through the use of templates. main modules: script, router and interface. The script is
For example, to give an IP configuration on an interface card, the starting point for processing, where all the functions are
one must have to use the Cisco IOS command ip address invoked, like parsing, data storage and config generation. The
a.b.c.d x.y.z.w, being “a.b.c.d” and “x.y.z.w” Router Perl module (Router.pm) defines the settings for
the IP address and subnet mask respectively. a router object and stores all the information regarding to
There is a template for each specific function. For example, it, such as the hostname, existing interfaces and forwarding
there is a template dedicated to each routing protocol config- protocol in use. It also combines these settings to further create
uration, another one for interface card configuration, and so the resulting configuration file for each router. The Interface
forth. Each command in a template may have one or more Perl module (Interface.pm) stores all the information
regarding the existing connections between the routers in the with the addresses 192.168.0.1 and 192.168.1.1 respectively.
network topology and which interface cards are involved. Depending on the network topology, new IP addresses are
In the development phase we took the following major being allocated sequentially in these IP networks, for all the
assumptions: i) only routers and switches Cisco IOS are devices in the same broadcast domain. Information about
supported by GNS3 and thus allowed in working network router connections and IP networks are stored in a Interface
topologies; ii) for the sake of simplicity, switches configu- object for each router interface. Each interface object has a
rations are not considered, that is automatic configuration will variable that specifies the router with which this Interface is
only apply to routers devices; iii) for serial links, clock connected to, that has to be in the same IP network.
rate command is always configured in both sides of the link. After storing all the data regarding the links in the JSON
file, the next step is to store the information about the devices.
A. JSON parser and data storage
Depending on the device type, different settings may be
This function collects the necessary information about the collected. For routers, the only device type available at the
network topology and parses the JSON specification file, moment, the objects store the hostname, the router type and
produced by GNS3. To do this, it uses a specific JSON library the interfaces that belong to it, which were created earlier.
(JSON Perl module, available in CPAN) to decode the file
and to load its contents to a local data structure. By using B. Automatic configuration generator
Data::Dumper function it is possible to print the data After storing all the information related to links
structure. Figure 4 illustrates how data is saved in .gns3 and devices, using Interface.pm and Router.pm
specification file, in the JSON format. Perl modules, we proceed to create automatically
the configuration files. This is done by calling the a
specific method (createAllConfigurations())
defined in Router.pm Perl Module. Method
createConfiguration() will be executed for
each instantiated router object, in order to produce the
corresponding configuration file. Each router object will then
verify which existent interfaces belong to it and create the
necessary commands to configure them. After configuring the
interfaces, the router object will then include the commands
necessary to configure the routing protocol defined in the
specification file. At the moment only RIPv2 and OSPF
are supported. All these configurations are in the templates
previously described in Section III. The configurations
corresponding to each router are added to a plain text file,
which is ready to be applied into a real or virtualized router.
In the next section we describe the testing phase, used to
assess the functionalities in a learning environment.
V. T ESTS AND RESULTS ANALYSIS
Several tests were made in order to verify the correct func-
tioning of the application. These tests consisted on designing
a simple topology in GNS3 and using our application to
generate the devices configuration files. As GNS3 is a very
Figure 4. GNS3 JSON file format. versatile tool, there are many options available to create a
virtual network, as well as many different types of routers
By iterating the JSON specification file, all the data regard- and switches and also the possibility to integrate those in a
ing devices and links in the network topology is collected real scenario. We have used the version 1.2.3 of GNS3, which
and stored. This information is crucial to know how the is the latest stable released version.
nodes are interconnected, with which neighbour router and by Our application has to read a specification file, which
which network interface cards. Next, we assign automatically contains a variables set with paths to JSON file and to router
a different IP network to each one of the interface cards baseline configurations, as well as the routing protocol to be
configured on each router. At the moment we are using the IP used. As more features are included in our application, more
range 192.168.0.0/16, which has approximately 216 different variables would be added to the this specification file. An
IP networks. We assign a /24 network address that is incre- example of a specification file can be seen in figure 5.
mented depending on the number of links in the topology. For In the working scenarios we have verified the correctness
instance, two network interface cards in a router will be con- of the configuration files produced, as well as the performance
figured in the IP networks 192.168.0.0/24 and 192.168.1.0/24, achieved in the overall configuration procedure. In all the
ip cef
ProjectDir = C:\Users\Script\scenario.gns3 no ip domain lookup
PortForwarding = OSPF no ip icmp rate-limit unreachable
ip tcp synwait 5
BaseConfigFile = no cdp log mismatch duplex
!
C:\Users\Basefiles\baseConfig.txt line con 0
exec-timeout 0 0
logging synchronous
Figure 5. Example of the run specification file. privilege level 15
no login
line aux 0
exec-timeout 0 0
logging synchronous
privilege level 15
scenarios we have analysed the following functions: i) correct no login
!
JSON file parsing and data storage; ii) correct configuration interface FastEthernet0/0
ip address 192.168.1.2 255.255.255.0
files produced automatically, with coherent IP configuration, no shutdown
!
by using the templates previously defined. In all the scenarios interface Serial0/0
ip address 192.168.2.1 255.255.255.0
we applied the resulting configuration files both in physical no shutdown
clock rate 2000000
network devices and virtual ones managed by GNS3. In both !
router rip
cases, each device was able to communicate with all the other version 2
network 192.168.1.0
devices in the network. Also the routing protocol was correctly network 192.168.2.0
!
configured and all the routers were able to learn the routes to end

reach the IP networks that were configured on the topology. In


Figure 7. Extract of the configuration file for Router R1.
the next subsections we describe two of those tests, on trying
to illustrate the appropriateness of using this application to
automatically generate network devices configuration files.
scenario emulates a network with an access layer, a distribution
A. Scenario 1 - lab setup with two routers layer and a backbone layer.
Figure 6 illustrates a basic testing scenario with two routers,
a switch and two hosts. This scenario represents a simple
topology which is used in the early Computer Networking
lessons, where beginner practitioners take their first steps on
configuring a small network. This setup was used in order
to test the automatic generation of configuration files using
the RIPv2 forwarding protocol, which was defined in the
specification file.

Figure 6. Simple two routers scenario.

Our application produced two configuration files for each


one of the routers in the network topology. Three IP networks Figure 8. A scenario with sixteen interconnected routers.
were identified in this topology and the routers configuration
files reflected this fact. This means that there was a correct
interpretation of the topology and interaction between the After automatically configuring this scenario, we have
nodes. RIPv2 was also configured, meaning each router would obtained sixteen configuration files, each named with the
announce to its neighbour all the networks it has configured. router identification and containing the correct configurations.
Figure 7 depicts an extract of the configuration file generated Figure 9 depicts the configuration file produced for router R1.
for router R1. In this lab setup we were able to evaluate the robustness of
As can be observed, the interfaces have a valid IP con- the template for OSPF routing protocol and the correctness
figuration and the RIP configuration is correctly configured, of route announcements. After the automatic configuration
by identifying the version 2 and by advertising the networks. procedure we were able to ping between Host1 and Host8.
After loading the resulting configuration files onto the routers, The most time consuming operations are data processing
the network devices were able to communicate properly. That and automatic generation of configuration files, tasks in which
is, we were able to simply ping from Host1 to Host2. Perl excels. We have observed during the tests that Perl script’s
performance does not decay significantly when in the presence
B. Scenario 2 - lab setup with sixteen routers of too complex network topologies. The tests were deemed
The next scenario, depicted in Figure 8, has sixteen routers successful in proving the efficiency, utility and advantages of
interconnected by link-layer OSPF routing protocol. This using the script in various network scenarios.
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
files generated during the design of the network topology. It
!
hostname R1
also uses a run configuration file with specific settings used
!
ip cef
during the processing. Combining GNS3 with this extension
no ip domain lookup
no ip icmp rate-limit unreachable
gives an easier and faster way to automatically configure error-
ip tcp synwait 5
no cdp log mismatch duplex
prone network that are ready to be tested in a lab environment.
!
line con 0
We are now working on making available more specific
exec-timeout 0 0
logging synchronous
network configurations, such as VLANs, ACLs and OSPF with
privilege level 15
no login
multi-area and other routing protocols. Another development
line aux 0
exec-timeout 0 0
that is taking place consists on implementing an automatic
logging synchronous
privilege level 15
configuration generator for a multi-vendor network topology,
!
no login
that may include not only Cisco IOS equipments, but also
interface Serial0/0
ip address 192.168.4.2 255.255.255.0
Huawei and Alcatel-Lucent. Both implementations rely on
no shutdown
clock rate 2000000
the development of templates for each one of the previously
!
interface FastEthernet0/0
described features.
ip address 192.168.9.2 255.255.255.0
no shutdown
We believe to have fulfilled successfully the initial goals and
!
interface Serial0/1
to have proven the robustness of our solution in networking
ip address 192.168.12.1 255.255.255.0
no shutdown
lab setups, giving a learning environment for beginners and
clock rate 2000000
!
more advanced students and practitioners the ability to better
interface FastEthernet0/1
ip address 192.168.13.1 255.255.255.0
learn networking topics in classroom and in self-study.
no shutdown
!
router ospf 1 VII. ACKNOWLEDGEMENTS
network 192.168.4.0 0.0.0.255 area 0
network 192.168.9.0 0.0.0.255 area 0 This work is financed by the FCT - Fundação para a
network 192.168.12.0 0.0.0.255 area 0
network 192.168.13.0 0.0.0.255 area 0 Ciência e a Tecnologia (Portuguese Foundation for Science
!
end and Technology) within project UID/EEA/50014/2013.
Figure 9. Extract of the configuration file for Router R1. R EFERENCES
[1] A. Nogueira and P. Salvador, “Teaching networking: A hands-on ap-
proach that relies on emulation-based projects,” in INFOCOMP 2014,
The Fourth International Conference on Advanced Communications and
VI. C ONCLUSIONS AND F UTURE W ORK Computation, 2014, pp. 149–155.
[2] I. ACM, “Computer science curricula 2013 - curriculum guidelines for
In this paper we have proposed an extension, in the form of undergraduate degree programs in computer science,” 2013.
a set of Perl scripts, to GNS3 which automatically generates [3] L. Sun, Y. Zhang, H. Yin et al., “Comparison between physical devices
the Cisco IOS initial configuration files of all the network and simulator software for cisco network technology teaching,” in Com-
puter Science & Education (ICCSE), 2013 8th International Conference
devices that are part of a topology. We have made tests on. IEEE, 2013, pp. 1357–1360.
with complex network topologies and observed the following [4] A. Wang, M. Iyer, R. Dutta, G. N. Rouskas, and I. Baldine, “Network
two main advantages on using this application in comput- virtualization: Technologies, perspectives, and frontiers,” Lightwave
Technology, Journal of, vol. 31, no. 4, pp. 523–537, 2013.
ers networking classes. First, to setup small network lab [5] S. Siraj, A. Gupta, and R. Badgujar, “Network simulation tools survey,”
scenarios are frequently in early learning environments, in International Journal of Advanced Research in Computer and Commu-
which beginner users can take advantage of this solution nication Engineering, vol. 1, no. 4, pp. 199–206, 2012.
[6] A. Jesin, Packet Tracer Network Simulator. Packt Publishing Ltd, 2014.
for comparison with their own configurations. This helps the [7] W.-J. Hsin, “Learning computer networking through illustration,” in
beginner practitioners to learn the most common configuration Proceedings of the 46th ACM Technical Symposium on Computer
mistakes and troubleshoot their own configurations. Second, Science Education. ACM, 2015, pp. 515–515.
[8] C. S. Tan, “Network simulator test engine for huawei ensp and cisco
in more advanced topologies composed of dozens of routers, gns3,” Ph.D. dissertation, UTAR, 2014.
this solution can be approached differently. For example, in a [9] Y. Liu, “The application of gns3 in network equipment of the internet
scenario with 20 routers, where the main goal is to implement course teaching,” Computer Knowledge and Technology, vol. 8, p. 057,
2012.
Multi-Protocol Label Switching (MPLS), advanced users need [10] C. Welsh, GNS3 network simulation guide. Packt Publ., 2013.
a functioning network to configure such protocol. Whereas [11] S. Knight, A. Jaboldinov, O. Maennel, I. Phillips, and M. Roughan, “Au-
these users already have the basic configuration notions well tonetkit: simplifying large scale, open-source network experimentation,”
in Proceedings of the ACM SIGCOMM 2012 conference on Applications,
assimilated, they shouldn’t be wasting time applying the initial technologies, architectures, and protocols for computer communication.
configuration in the 20 routers, which is a repetitive and error- ACM, 2012, pp. 97–98.
prone activity. This solution could have these users skip this
step, providing all the necessary configurations as to configure
the scenario and prepare it for the MPLS configuration.
GNS3 would the benefit with the integration of a solution for
automatic configuration, regardless of the size of the scenario
being tested.
Our application takes advantage of the GNS3 specification

You might also like