\chapter*{Introduction}
\phantomsection
\addcontentsline{toc}{chapter}{Introduction}

Experimenting is an essential part of the development of any network protocol. 
Validation of theoretical results and their extension to practical solution, which might not be easy to model or implement, can be a main use of experiments. 
Primary outcome of a sequence of tests should be an assessment of the protocol in terms of reliability, robustness and proper functionality, described by its definition. 
However, in many cases, such as wide-area network, it might be impossible to build, maintain and configure real world tests or testbeds\footnote{Platform for conducting rigorous, transparent, and replicable testing of scientific theories}, due to their nature, which can be extremely complex.  
Core components of the experimental environment are following: the application using the protocol for evaluation and the network on which the protocol is run.


As a valid option, one can use a simulator, which employs functional models for all parts of the network, as well as, the application itself. Simulation, compared to a real network, runs only as a software. Due to this fact, the program has to model the behaviour of a network by calculating the interaction between the different network entities. It uses purely mathematical representation of traffic, channels and protocols. Nonetheless, main restraints of the software simulation are in the complexity of the implementation, nature of the simulation, which can be either continuous or discrete, level of abstraction, validation process of the software itself. All of these factors create a simulator with predefined level of performance, realism and simplicity. 

On the other hand, emulators are trying to bridge the gap between simulation and real system experiments by providing controlled environment on which real code can run. 
Opposed to simulators, they can both exist in the form of hardware and software solutions. 
Network emulators are usually physically placed between two LAN segments, where they can replicate a client/server WAN connection, without the need for a physical devices to be present, or even live traffic. Typically, emulators are configured to manipulate bandwidth constraints, apply impairments, being packet loss, delay, jitter and many others. With wide-area network-like configuration application performance and end-user experience can then be observed, tested and validated under conditions, which are emulating the real world as closely as possible \cite{emulation}.

This thesis analyzes Linux kernel network stack, with most of its relations and interactions between individual layers. Its primary concerns are data link layer, network layer and transport layer, which are handled by the kernel. Network device, that represent data link layer, is being discussed as well, with its methods of dealing with egress or ingress packets and its interactions with network layer. Going upwards in network stack hierarchy, thesis debates \emph{netfilter} modules as a whole, along with its specific sub-modules. Main focus is directed to traffic control, explaining its role in networking, as well as, concepts which are used in the WEnux implementation. All sections discussing Linux kernel also contain in-depth explanations through code examples from kernel itself or graphs explaining their relations and functionality.

Later chapter \ref{virt} explains emulator's relation to other types of network virtualization and motivation for choosing the emulation, instead of simulation. 
Importance of this chapter is critical, as it allows one, to understand the limitations that emulation has and its difference between simulation and real scenario.

Chapter \ref{chap:wenux} is meant for the WEnux emulator itself, with its research of existing solution, such as WANem, which served as an inspiration, used technologies previously explained in the chapter \ref{chap:network}. Final application is discussed, with its graphical user interface, its functionality, implementation and lastly UML model of the Python utility.

Last chapter is dedicated to tests and evaluation of WEnux emulator, with regards to its accuracy of emulation and resource usage. Basic testing methodology is established and according to it, the results are presented. 
                
