CN110011835A - Network simulation method and system - Google Patents
Network simulation method and system Download PDFInfo
- Publication number
- CN110011835A CN110011835A CN201910194311.9A CN201910194311A CN110011835A CN 110011835 A CN110011835 A CN 110011835A CN 201910194311 A CN201910194311 A CN 201910194311A CN 110011835 A CN110011835 A CN 110011835A
- Authority
- CN
- China
- Prior art keywords
- virtual
- interface
- linux
- virtual process
- module
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/14—Network analysis or design
- H04L41/145—Network analysis or design involving simulating, designing, planning or modelling of a network
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/46—Interconnection of networks
- H04L12/4641—Virtual LANs, VLANs, e.g. virtual private networks [VPN]
Abstract
The invention discloses a kind of network simulation method and systems, are related to network simulation field.The step of this method includes: emulation Booting sequence: after creation virtual process and its virtual interface, being configured according to pre-set configuration file to virtual process;Data packet communication process: after virtual process receives data packet, data packet is formed into Ethernet packet, if the communication pattern of the virtual interface of current virtual process is virtual communication mode, after being packaged to Ethernet packet, is sent to purpose virtual process;If the communication pattern of the virtual interface of current virtual process is actual communication mode, Ethernet packet is directly sent to purpose real equipment.When the present invention carries out network simulation, operating process can be simplified while the operation expense of the system of reduction, be used convenient for people.
Description
Technical field
The present invention relates to network simulation fields, and in particular to one kind is used for NVO3 (Network Virtualization
Over Layer 3, be based on three layers of IP overlay network struction virtual networking) network simulation method and system.
Background technique
Physical server in data center network can virtual multiple host, for a user, a virtual machine is equivalent to
One physical host.Conventional switch cannot be supported to virtualize well.Industry proposes NVO3 scheme thus, i.e., by 2 layers of frame
It is encapsulated in tunnel and is forwarded by 3 layer networks, thus 2 layer network ranges of extension.
NVO3 scheme includes plurality of optional tunneling technique, such as IP, UDP (User Datagram Protocol, number of users
According to datagram protocol) and VXLAN (Virtual Extensible LAN, virtual extended local area network) etc..Increase before 2 layers of ethernet frame
After tunnel encapsulation, tunnel forwarding is realized.
Currently, generally passing through virtual machine (such as VMware virtual machine, VirtualBox virtual machine when carrying out network simulation
With LINUX virtual machine etc.) it is emulated, but not only will increase operation expense (1 virtual machine starting of system using virtual machine
Need the memory of 200M), and operating process is more complicated, is not easy to people's use.
Summary of the invention
In view of the deficiencies in the prior art, present invention solves the technical problem that are as follows: carry out network simulation when, how
While the operation expense of reduction system, simplify operating process.
To achieve the above objectives, network simulation method provided by the invention, method includes the following steps:
Emulate Booting sequence: after creation virtual process and its virtual interface, according to pre-set configuration file to virtual
Process is configured;
Data packet communication process: after virtual process receives data packet, by data packet formed Ethernet packet, if current virtual into
The communication pattern of the virtual interface of journey be virtual communication mode, then after being packaged to Ethernet packet, be sent to purpose virtually into
Journey;If the communication pattern of the virtual interface of current virtual process is actual communication mode, Ethernet packet is directly sent to mesh
Real equipment.
Based on the above technical solution, the emulation Booting sequence the following steps are included:
Script configuration file is created for every virtual process, script configuration file includes virtual process parameter, virtual process
Parameter includes routing, ARP and the MAC Address of virtual process;
Create virtual process: initialization LINUX ICP/IP protocol stack creates virtual process and its virtual interface, virtually connects
The communication pattern of mouth is virtual communication mode and actual communication mode, and virtual interface is associated with a host network card, will be owned
Multicast group is formed with the associated host network card of virtual interface;For the connection ID and MAC Address of the configuration of each virtual interface, need to lead to
The connection ID of the virtual interface of letter is identical;
After the completion of all virtual process creations, virtual process is configured according to script configuration file;
When the running environment of this method is Windows environment, this method further includes following below scheme: LINUX TCP/IP is assisted
The LINUX process and thread for discussing stack, are adapted for Windows thread;The LINUX of LINUX ICP/IP protocol stack is locked, is adapted for
Windows mutual exclusion lock;It, will on the basis of keeping the call relation of LINUX Compilation function of LINUX ICP/IP protocol stack
LINUX Compilation function is converted to C language and is adapted to the C language after conversion with the C language compiler in Windows environment.
Based on the above technical solution, the emulation Booting sequence is further comprising the steps of: all scripts are configured
File forms autoexec, and the process configured according to script configuration file to virtual process includes: at basis batch
Reason file configures all virtual processes.
Based on the above technical solution, the data packet communication process the following steps are included:
Virtual process forms Ethernet packet for after the data received and the virtual interface information association of virtual process;
Determine the communication mode of current virtual interface:
If communication mode is virtual communication mode, packaging information is increased to Ethernet packet, packaging information includes virtual interface
Connection ID and MAC Address;Calling and the associated host network card of virtual interface, according to destination IP and destination port, after encapsulation
Ethernet packet be sent to the multicast group, virtual process in multicast group receives multicast packets;
If communication mode is actual communication mode, Ethernet packet is sent to purpose real equipment, real equipment receive with
Too net packet.
Based on the above technical solution, the process of the virtual process reception multicast packets in the multicast group includes:
After the host network card of the virtual interface of virtual process receives multicast packets, multicast packets are parsed, obtain multicast packets
Packaging information and payload information, packaging information include connection ID and MAC Address;
If the connection ID of current virtual interface is identical as the connection ID of multicast packets and the MAC Address of current virtual interface with
The MAC Address of multicast packets is different, then calls current virtual interface that the payload information of multicast packets is sent to LINUX protocol stack and carry out
Processing;
The real equipment receive Ethernet packet process include: real equipment host network card receive Ethernet packet after,
If it exists with the associated virtual interface of current hosts network interface card, then call packet receiving function that Ethernet packet is sent to LINUX protocol stack
It is handled.
Network (WSN) emulation system provided by the invention, the system are used for:
Emulate Booting sequence: after creation virtual process and its virtual interface, according to pre-set configuration file to virtual
Process is configured;
Data packet communication process: after virtual process receives data packet, by data packet formed Ethernet packet, if current virtual into
The communication pattern of the virtual interface of journey be virtual communication mode, then after being packaged to Ethernet packet, be sent to purpose virtually into
Journey;If the communication pattern of the virtual interface of current virtual process is actual communication mode, Ethernet packet is directly sent to mesh
Real equipment.
Based on the above technical solution, the system include script configuration module, LINUX ICP/IP protocol stack module,
Console module, interface driver module;
On this basis, the emulation Booting sequence includes:
Script configuration module is that every virtual process creates script configuration file, and script configuration file includes virtual process ginseng
Number, virtual process parameter includes routing, ARP and the MAC Address of virtual process;
Create virtual process: LINUX ICP/IP protocol stack module initialization LINUX ICP/IP protocol stack, console mould
Block creates virtual process, the virtual interface of interface driver module creation virtual process, and the communication pattern of virtual interface is virtual logical
Letter mode and actual communication mode;Virtual interface is associated with by console module with a host network card, by all and virtual interface
Associated host network card forms multicast group;For the connection ID and MAC Address of the configuration of each virtual interface, need to communicate is virtually connect
The connection ID of mouth is identical;
After the completion of the creation of all virtual processes, script configuration file pair that console module is created according to script configuration module
Virtual process is configured.
When the running environment of the system is Windows environment, which further includes OS adaptation module, is used for: by LINUX
The LINUX process and thread of ICP/IP protocol stack, are adapted for Windows thread;By the LINUX of LINUX ICP/IP protocol stack
Lock, is adapted for Windows mutual exclusion lock;In the base of the call relation for the LINUX Compilation function for keeping LINUX ICP/IP protocol stack
On plinth, by LINUX Compilation function be converted to C language and by after conversion C language and Windows environment in C language compiler
Adaptation.
Based on the above technical solution, the script configuration module is also used to: all script configuration files are formed
Autoexec;The script configuration file that the console module is created according to script configuration module configures virtual process
Process include: that console module configures virtual process according to autoexec.
Based on the above technical solution, the data packet communication process includes:
Console module forms Ethernet packet for after the data packet received and the virtual interface information association of virtual process;
Interface driver module determines the communication mode of current virtual interface:
If communication mode is virtual communication mode, packaging information is increased to Ethernet packet, packaging information includes the company
Meet ID and MAC Address;Interface driver module on the associated host network card of virtual interface call Winsock interface, according to mesh
IP and destination port, the Ethernet packet after encapsulation is sent to multicast group, virtual process in multicast group receives multicast packets;
If communication mode is actual communication mode, interface driver module is called and the associated host network card of virtual interface, will
Ethernet packet is sent to purpose real equipment, and real equipment receives Ethernet packet.
Based on the above technical solution, the process of the virtual process reception multicast packets in the multicast group includes:
After the host network card of the virtual interface of virtual process receives multicast packets, interface driver module solves multicast packets
Analysis, obtains the packaging information and payload information of multicast packets, packaging information includes connection ID and MAC Address;
Interface driver module determines that the connection ID of current virtual interface is identical as the connection ID of multicast packets and current virtual connects
The MAC Address of mouth is different from the MAC Address of multicast packets, calls virtual interface that the payload information of multicast packets is sent to LINUX
ICP/IP protocol stack module is handled.
Compared with the prior art, the advantages of the present invention are as follows:
(1) referring to emulation mode of the invention it is found that the present invention can be using virtual process instead of in the prior art
LINUX virtual machine carries out network simulation, and compared with LINUX virtual machine, the not only expense of virtual process of the invention is very small by (1
The starting of virtual process only needs the memory of 2M), and create virtual process and data packet communication is carried out by virtual process
Process it is very simple, convenient for people use.
(2) present invention creates virtual process by script configuration file, and executes corresponding configuration order, is not necessarily to manually one by one
Configuration;And can be improved flexibility, it avoids recompilating program to change a certain parameter, is mainly used for complex topology;With
This simultaneously, the present invention can also by all script configuration files formed autoexec, according to autoexec to it is all virtually into
Cheng Jinhang configuration, can simplify workflow, improve working efficiency.
(3) referring to analogue system of the invention it is found that analogue system of the invention can be used as test instrumentation to equipment progress
Test, directly runs in Windows environment, and without installation and compiling, configuration order is consistent with equipment, slaps convenient for tester
It holds.
Detailed description of the invention
Fig. 1 is the emulation Booting sequence figure in the embodiment of the present invention one;
Fig. 2 is the data packet communication flow chart in the embodiment of the present invention three;
Fig. 3 is the flow chart of the virtual process reception multicast packets in the multicast group in the embodiment of the present invention four:
Fig. 4 is the block schematic illustration that VXLAN emulation is realized in the embodiment of the present invention six;
Fig. 5 is the composition block diagram of the network (WSN) emulation system in the embodiment of the present invention.
Specific embodiment
Invention is further described in detail with reference to the accompanying drawings and embodiments.
Network simulation method in the embodiment of the present invention, comprising the following steps:
Emulate Booting sequence: after creation virtual process and its virtual interface, according to pre-set configuration file to virtual
Process is configured.
Data packet communication process: after virtual process receives data packet, by data packet formed Ethernet packet, if current virtual into
The communication pattern of the virtual interface of journey be virtual communication mode, then after being packaged to Ethernet packet, be sent to purpose virtually into
Journey;If the communication pattern of the virtual interface of current virtual process is actual communication mode, Ethernet packet is directly sent to mesh
Real equipment.
It is imitated it follows that the present invention can replace LINUX virtual machine in the prior art to carry out network using virtual process
Very, compared with LINUX virtual machine, the not only expense of virtual process of the invention is very small, and (1 virtual process starting only needs 2M
Memory), and create virtual process and by virtual process carry out data packet communication process it is very simple, be convenient for people
Use.
Illustrate method of the invention below by six embodiments.
Embodiment one:
It is shown in Figure 1, emulation Booting sequence the following steps are included:
S101: creating script configuration file (i.e. pre-set configuration file) for every virtual process, script configuration text
Part includes virtual process parameter, and virtual process parameter includes the routing of virtual process, ARP (Address Resolution
Protocol, address resolution protocol) and the information such as MAC Address, go to S102.
The purpose of S101 are as follows: virtual process is directly created according to script configuration file subsequent, and executes corresponding configuration life
It enables, without configuring one by one manually;And can be improved flexibility, it avoids recompilating program to change a certain parameter, mainly
For complex topology.
S102: creation virtual process: initialization LINUX ICP/IP protocol stack creates virtual process and its virtual interface,
The communication pattern of virtual interface is virtual communication mode (default uses) and actual communication mode, by virtual interface and a host
Network interface card association forms multicast group (IP 239.1.1.1, the destination of the group with the associated host network card of virtual interface for all
6001) mouth is;Connection ID (connection ID is unique on a host network card) and MAC Address are configured for each virtual interface, is needed
The connection ID of the virtual interface of communication is identical, realizes the connection topology of virtual process with this and supports multicast interface.S102 is executed
Can change as needed afterwards with the host network card of virtual interface, connection ID and communication mode, go to S103.
The running environment of the present embodiment is Windows environment, this method for the first time in use, further include it is following can be
The process carried out in the process of LINUX ICP/IP protocol stack or before is initialized in S102:
1, by the LINUX process and thread of LINUX ICP/IP protocol stack, it is adapted for Windows thread;
2, the LINUX of LINUX ICP/IP protocol stack is locked into (including mutual exclusion lock, Read-Write Locks and spin lock etc.), adaptation
For Windows mutual exclusion lock;
3, using an individual Windows thread, LINUX operation system is simulated and handled by way of Infinite Cyclic
The traps of system, the traps of LINUX operating system include the traps of network send and receive packets and the traps of inner core timer
Deng;
4, the LINUX Compilation function of LINUX ICP/IP protocol stack is carried out after analyzing one by one, is converted to C language;If
LINUX Compilation function can not convert (such as LINUX Compilation function relevant with multi -CPU can not be converted), then will be unable to turn
The LINUX Compilation function changed is defined as do-nothing function, in addition, the C language after conversion, the LINUX Compilation function before still keeping conversion
Call relation (i.e. call relation remains unchanged);
5, in view of in Windows exploitation environment C language compiler and LINUX it is different, i.e., C language compiler is not
Support certain specific C language grammers;Therefore after LINUX Compilation function being converted to C language, it is also necessary to compile C language and C language
Translate device adaptation (can complete to be adapted to by way of modifying C language code).
S103: after the completion of all virtual process creations, virtual process is configured according to script configuration file, was configured
The difference of execution configuration process after journey and real equipment starting are as follows: thread will be become from process according to the agreement of configuration operation,
Remaining process is consistent with real equipment operation, goes to S104.
Examples of configurations is carried out to virtual process according to script configuration file in S103 are as follows:
start"R1"linux-router.exe test1.txt;Wherein linux-router.exe is virtual process, control
Platform window name processed is R1, and script configuration file is test1.txt.
All virtual units use identical linux-router.exe program, and different shape equipment passes through configuration file area
Point, without recompilating program.
Each virtual unit has a specialized script configuration file (such as test1.txt).Configuration file is divided into two portions
Point, first part is equipment form and parameter definition, including interface number, interface connection relationship, device performance parameters, first
Device start is executed after point and starts virtual unit, and first part's parameter cannot be modified after starting.device start
Order after instruction is that all devices share order, for configuring various agreements, can be changed as needed after starting.
S104: after virtual process receives complete input order, order line processing, implementation procedure and real equipment one are executed
It causes, this step is Infinite Cyclic process, that is, S104 is executed after receiving order, unless virtual process or virtual process is turned off manually
Exception exits.
Embodiment two:
On the basis of example 1, S101 is further comprising the steps of: all script configuration files are formed batch processing text
Part;Autoexec (.bat type) specially is created under a windows environment, wherein instructing comprising several start, each
Start instructs a corresponding virtual network device.The process that virtual process is configured according to script configuration file in S103
Are as follows: all virtual processes are configured according to autoexec, its purpose is that: the configuration of all virtual processes is completed in batches,
And then simplify workflow, improve working efficiency.
Embodiment three:
On the basis of example 1, shown in Figure 2, data packet communication process the following steps are included:
S201: virtual process by the data packet received (type of data packet is corresponding with upper-layer protocol, for example, IP data packet,
IPv6 data packet, ISIS data packet etc.) be associated with the virtual interface information (virtual interface number) of virtual process after, formed Ethernet
Packet, goes to S202.
S202: determining the communication mode of current virtual interface, if communication mode is virtual communication mode, goes to S203, if
Communication mode is actual communication mode, goes to S204.
S203: packaging information is increased to Ethernet packet, packaging information includes the connection ID of the virtual interface configured in S102
And MAC Address;Call S102 in the associated host network card of virtual interface, according to destination IP (239.1.1.1) and destination port
(6001), the Ethernet packet after encapsulation is sent to the multicast group in S102, the virtual process in multicast group receives multicast packets.
S204: Ethernet packet is sent to purpose real equipment (not adding any head), and real equipment receives Ethernet
Packet.
Example IV:
Shown in Figure 3 on the basis of embodiment three, the virtual process in the multicast group in S203 receives multicast packets
Process includes:
S203a: the host network card of the virtual interface of virtual process receive multicast packets after (in master when virtual process starts
The Socket that can receive this multicast packets is created on machine network interface card), multicast packets are parsed, obtain multicast packets packaging information and
Payload information, packaging information include connection ID and MAC Address, go to S203b.
S203b: judge the connection ID of current virtual interface, if it is identical as the connection ID of multicast packets, if so, going to
Otherwise S203c proves that current virtual interface does not need packet receiving, abandons multicast packets, terminates.
S203c: judge the MAC Address of current virtual interface, if it is identical as the MAC Address of multicast packets, if so, proving
Multicast packets are oneself transmission, for anti-loops (repeating send and receive packets), abandon multicast packets, terminate;Otherwise prove that multicast packets are not
Oneself sends, and calls current virtual interface that the payload information of multicast packets is sent to LINUX protocol stack and handles, terminates.
Embodiment five:
On the basis of embodiment three, real equipment receives the master that the process of Ethernet packet includes: real equipment in S204
It after machine network interface card receives Ethernet packet, judges whether there is and the associated virtual interface of current hosts network interface card: if so, calling packet receiving
Ethernet packet (not removing any encapsulation) is sent to LINUX protocol stack and handled by function, is terminated;If it is not, then abandon with
Too net packet, terminates.
Embodiment six:
It is shown in Figure 4, CE1 (Customer Edge, user network boundary device) and (end in the tunnel VXLAN VTEP1
Point) it is virtual unit on single machine, use virtual communication;VTEP1, VTEP2 and CE2 are real equipment and host, are used
Actual communication.Network simulation method through the invention realizes the process of VXLAN emulation at this time are as follows:
CE1 sends ethernet frame to VTEP1, and purpose is the MAC Address of CE2, and source address is packet-by-packet incremented by within the scope of one,
Continue to be incremented by from minimum value after reaching the upper limit.It can be by configuring specified source MAC initial value and range, to support extensive MAC
Study.After VTEP1 receives the ethernet frame of CE1, increases VXLAN encapsulation (forming VXLAN frame) and be sent to VTEP2.VTEP2 is received
After the VXLAN frame that VTEP1 is sent, forms ethernet frame and be forwarded to CE2, while learning source MAC.
Network (WSN) emulation system in the embodiment of the present invention, is used for:
Emulate Booting sequence: after creation virtual process and its virtual interface, according to pre-set configuration file to virtual
Process is configured.
Data packet communication process: after virtual process receives data packet, by data packet formed Ethernet packet, if current virtual into
The communication pattern of the virtual interface of journey be virtual communication mode, then after being packaged to Ethernet packet, be sent to purpose virtually into
Journey;If the communication pattern of the virtual interface of current virtual process is actual communication mode, Ethernet packet is directly sent to mesh
Real equipment.
Shown in Figure 5, the network (WSN) emulation system in the embodiment of the present invention includes:
Console module: all start a console interface when every virtual process operation, be responsible for matching for this virtual process
It sets and shows, effect is equivalent to the serial port terminal of true switch device, closes console interface and closes virtual unit.Out
In simplified purpose, the present embodiment does not provide remote console mechanism (telnet/ssh etc.).
CLI (Command-Line Interface, command line interface) module: operator is by CLI in console circle
Face input order, the operation such as is configured to virtual process and is shown with this;CLI is realized and equipment is completely the same, seamless can be moved
It plants.
MIB (Management Information Base, management information bank) module: partial order row passes through MIB interface
Execute order, the management interface that the final invocation protocol of MIB interface provides.MIB interface is realized and equipment is completely the same, seamless can be moved
It plants.
Control protocol module: the various control protocols run on virtual process, such as Routing Protocol, LDP agreement etc., using more
Thread realizes that protocol code and equipment are completely the same, can stress-free temperature.
System calling module: control protocol module is logical by system calling module and ICP/IP protocol stack and other agreements
Letter.In analogue system in the present embodiment, control protocol module and the communication of LINUX ICP/IP protocol stack module, rather than and
Windows protocol stack communication, to guarantee that system call interfaces are constant, the analogue system of the present embodiment realizes system tune again
With passing through specified call using special system of header file and realize.This mechanism is transparent to protocol code, without changing agreement generation
Code.
LINUX ICP/IP protocol stack module: to keep the consistency with equipment, being convenient for VXLAN functional development and debugging,
The analogue system of the present embodiment does not use the ICP/IP protocol stack of Windows directly, but by the LINUX TCP/IP in equipment
Protocol stack code is transplanted in Windows translation and compiling environment;The LINUX ICP/IP protocol stack of transplanting is the LINUX in equipment
The subset of ICP/IP protocol stack, part required for being run comprising existing equipment agreement (including basic TCP/IP, IPv6, raw,
Socket, udp, socket, tcp, socket, packet socket, unix, socket, Network File System and PROC file
System), current unwanted part is eliminated, can be increased on demand in the later period.
OS adaptation module: LINUX ICP/IP protocol stack and non-singleton, but the component part of LINUX O/S kernel,
LINUX ICP/IP protocol stack has used the relevant operation of a large amount of LINUX OS, and OS adaptation module is for assisting LINUX TCP/IP
Protocol stack operation, the adaptation including OS level basic function, such as clock, lock, process, traps, timer etc..
On this basis, the purpose of OS adaptation module is maximum holding LINUX ICP/IP protocol stack code, OS
Adaptation module is specifically used for (i.e. specifically adaptation process)
1, by the LINUX process and thread of LINUX ICP/IP protocol stack, it is adapted for Windows thread;
2, the LINUX of LINUX ICP/IP protocol stack is locked into (including mutual exclusion lock, Read-Write Locks and spin lock etc.), adaptation
For Windows mutual exclusion lock;
3, using an individual Windows thread, LINUX operation system is simulated and handled by way of Infinite Cyclic
The traps of system, the traps of LINUX operating system include the traps of network send and receive packets and the traps of inner core timer
Deng;
4, the LINUX Compilation function of LINUX ICP/IP protocol stack is carried out after analyzing one by one, is converted to C language;If
LINUX Compilation function can not convert (such as LINUX Compilation function relevant with multi -CPU can not be converted), then will be unable to turn
The LINUX Compilation function changed is defined as do-nothing function, in addition, the C language after conversion, the LINUX Compilation function before still keeping conversion
Call relation (i.e. call relation remains unchanged);
5, in view of in Windows exploitation environment C language compiler and LINUX it is different, i.e., C language compiler is not
Support certain specific C language grammers;Therefore after LINUX Compilation function being converted to C language, it is also necessary to compile C language and C language
Translate device adaptation (can complete to be adapted to by way of modifying C language code).
Interface driver module: it is used for the binding that interface driver realizes virtual interface and real interface, to realize emulation
Message communicating between system virtualization process.
Winsock interface (Windows Socket): it is communicated between the virtual process of the analogue system creation of the present embodiment
Using the Windows Socket interface of standard, interface driver layer encapsulates it, and interface driver layer above section is to this
Unaware, without changing.
(Windows packet capture, windows platform is next free, and public network is visited for Winpcap interface
Ask system): between the virtual process and host and third party's virtual unit and real equipment of the analogue system creation of the present embodiment
Communication use Winpcap interface, can directly receive and dispatch ethernet frame, interface driver layer encapsulates it, interface driver
Layer above section is to this unaware, without changing.The installation of Winpcap interface requirement Windows host cuts packet software, recommends to make
It, can installation winpcap driving automatically with wireshark.
Host network card: the above communication process that the analogue system of the present embodiment is realized requires to realize by host network card:
If communicating pair is located at same host, it can be used Microsoft Loopback Adapter to reduce unnecessary flow;If communicating pair is located at different masters
Machine, or communicated with real equipment, then it must use physical network card.The analogue system of the present embodiment is not implemented based on wireless network card
Wired ethernet network interface card is only supported in communication.
Script configuration module: the analogue system of the present embodiment supports through script startup, the one of the creation of script configuration module
The corresponding virtual process of a script file, will be by specified parameter when using script startup comprising device parameter and configuration information
Virtual unit is created, and executes corresponding configuration order, without configuring one by one manually.One autoexec may specify one group of starting
Script, to define the topology of multiple virtual unit compositions, an emulation topology can quickly be created by executing batch program.
On this basis, the emulation Booting sequence of the analogue system in the embodiment of the present invention includes:
Script configuration module is that every virtual process creates script configuration file, and script configuration file includes virtual process ginseng
Number, virtual process parameter include the routing of virtual process, ARP (Address Resolution Protocol, address resolution association
View) and the information such as MAC Address;All script configuration files are formed into autoexec.
Create virtual process: LINUX ICP/IP protocol stack module initialization LINUX ICP/IP protocol stack (uses for the first time
When this system, need to carry out OS mentioned above by OS adaptation module to be adapted to process), console module creates virtual process,
The virtual interface of interface driver module creation virtual process, the communication pattern of virtual interface are virtual communication mode (default uses)
With actual communication mode.Virtual interface is associated with by console module with a host network card, will be all associated with virtual interface
Host network card forms multicast group, and (6001) IP 239.1.1.1, the destination port of the group are;For the company of each virtual interface configuration
It meets ID (connection ID is unique on a host network card) and MAC Address, the connection ID for the virtual interface for needing to communicate is identical.
After the completion of all virtual process creations, the autoexec that console module is created according to script configuration module is to void
Quasi- process is configured.
Console module receives after the input order of CLI module, executes order line processing, implementation procedure and true
Equipment is consistent, this step is Infinite Cyclic process, except the non-manual work for stopping console module or exception are exited.
The data packet communication process of analogue system in the embodiment of the present invention includes:
Console module forms Ethernet packet for after the data packet received and the virtual interface information association of virtual process;
Interface driver module determines the communication mode of current virtual interface:
If 1, communication mode is virtual communication mode, packaging information is increased to Ethernet packet, packaging information includes described
Connection ID and MAC Address;Interface driver module on the associated host network card of virtual interface call Winsock interface, according to
Ethernet packet after encapsulation is sent to multicast group, the void in multicast group by destination IP (239.1.1.1) and destination port (6001)
Quasi- process receives multicast packets.
The process that virtual process in multicast group receives multicast packets includes:
After the host network card of the virtual interface of virtual process receives multicast packets, interface driver module solves multicast packets
Analysis, obtains the packaging information and payload information of multicast packets, packaging information includes connection ID and MAC Address;Interface driver module is sentenced
The connection ID of disconnected current virtual interface, if identical as the connection ID of multicast packets:
If so, judging the MAC Address of current virtual interface, if it is identical as the MAC Address of multicast packets, if so, proving
Multicast packets are oneself transmission, for anti-loops, discarding multicast packets;Otherwise it proves that multicast packets are not that oneself sends, calls current empty
The payload information of multicast packets is sent to LINUX ICP/IP protocol stack module and handled by quasi- interface.
If 2, communication mode is actual communication mode, interface driver module is raised with the associated host network card of virtual interface
The SendAPI provided with Winpcap interface, is sent to purpose real equipment (not adding any head) for Ethernet packet, really
Equipment receives Ethernet packet.
Referring to the analogue system of the present embodiment it is found that analogue system of the invention can be used as test instrumentation surveys to equipment
Examination, directly runs in Windows environment, and without installation and compiling, configuration order is consistent with equipment, slaps convenient for tester
It holds.
It should be understood that system provided in an embodiment of the present invention is when carrying out intermodule communication, only with above-mentioned each function
The division progress of module can according to need and for example, in practical application by above-mentioned function distribution by different function moulds
Block is completed, i.e., the internal structure of system is divided into different functional modules, to complete all or part of function described above
Energy.
Further, the present invention is not limited to the above-described embodiments, for those skilled in the art,
Without departing from the principles of the invention, several improvements and modifications can also be made, these improvements and modifications are also considered as the present invention
Protection scope within.The content being not described in detail in this specification belongs to existing skill well known to professional and technical personnel in the field
Art.
Claims (10)
1. a kind of network simulation method, which is characterized in that method includes the following steps:
Emulate Booting sequence: after creation virtual process and its virtual interface, according to pre-set configuration file to virtual process
It is configured;
Data packet communication process: after virtual process receives data packet, forming Ethernet packet for data packet, if current virtual process
The communication pattern of virtual interface is virtual communication mode, then after being packaged to Ethernet packet, is sent to purpose virtual process;If
The communication pattern of the virtual interface of current virtual process is actual communication mode, then it is true Ethernet packet to be directly sent to purpose
Equipment.
2. network simulation method as described in claim 1, which is characterized in that the emulation Booting sequence the following steps are included:
Script configuration file is created for every virtual process, script configuration file includes virtual process parameter, virtual process parameter
Routing, ARP and MAC Address including virtual process;
Create virtual process: initialization LINUX ICP/IP protocol stack creates virtual process and its virtual interface, virtual interface
Communication pattern be virtual communication mode and actual communication mode, virtual interface is associated with a host network card, by it is all with it is empty
The host network card of quasi- interface conjunctionn forms multicast group;For the connection ID and MAC Address of the configuration of each virtual interface, need to communicate
The connection ID of virtual interface is identical;
After the completion of all virtual process creations, virtual process is configured according to script configuration file;
When the running environment of this method is Windows environment, this method further includes following below scheme: by LINUX ICP/IP protocol stack
LINUX process and thread, be adapted for Windows thread;The LINUX of LINUX ICP/IP protocol stack is locked, is adapted for
Windows mutual exclusion lock;It, will on the basis of keeping the call relation of LINUX Compilation function of LINUX ICP/IP protocol stack
LINUX Compilation function is converted to C language and is adapted to the C language after conversion with the C language compiler in Windows environment.
3. network simulation method as claimed in claim 2, which is characterized in that the emulation Booting sequence further includes following step
It is rapid: all script configuration files are formed into autoexec, it is described that virtual process is configured according to script configuration file
Process includes: to be configured according to autoexec to all virtual processes.
4. network simulation method as claimed in claim 2, which is characterized in that the data packet communication process includes following step
It is rapid:
Virtual process forms Ethernet packet for after the data received and the virtual interface information association of virtual process;
Determine the communication mode of current virtual interface:
If communication mode is virtual communication mode, packaging information is increased to Ethernet packet, packaging information includes the company of virtual interface
Meet ID and MAC Address;Call with the associated host network card of virtual interface, according to destination IP and destination port, by after encapsulation with
Too net packet is sent to the multicast group, and the virtual process in multicast group receives multicast packets;
If communication mode is actual communication mode, Ethernet packet is sent to purpose real equipment, real equipment receives Ethernet
Packet.
5. network simulation method as claimed in claim 4, which is characterized in that the virtual process in the multicast group receives multicast
The process of packet includes:
After the host network card of the virtual interface of virtual process receives multicast packets, multicast packets are parsed, obtain the envelope of multicast packets
It fills information and payload information, packaging information includes connection ID and MAC Address;
If the connection ID of current virtual interface is identical as the connection ID of multicast packets and the MAC Address and multicast of current virtual interface
The MAC Address of packet is different, then calls current virtual interface that the payload information of multicast packets is sent at LINUX protocol stack
Reason;
The process of the real equipment reception Ethernet packet includes: after the host network card of real equipment receives Ethernet packet, if depositing
With the associated virtual interface of current hosts network interface card, then call packet receiving function by Ethernet packet be sent to LINUX protocol stack carry out
Processing.
6. a kind of network (WSN) emulation system, which is characterized in that the system is used for:
Emulate Booting sequence: after creation virtual process and its virtual interface, according to pre-set configuration file to virtual process
It is configured;
Data packet communication process: after virtual process receives data packet, forming Ethernet packet for data packet, if current virtual process
The communication pattern of virtual interface is virtual communication mode, then after being packaged to Ethernet packet, is sent to purpose virtual process;If
The communication pattern of the virtual interface of current virtual process is actual communication mode, then it is true Ethernet packet to be directly sent to purpose
Equipment.
7. network (WSN) emulation system as claimed in claim 6, it is characterised in that: the system includes script configuration module, LINUX
ICP/IP protocol stack module, console module, interface driver module;
On this basis, the emulation Booting sequence includes:
Script configuration module is that every virtual process creates script configuration file, and script configuration file includes virtual process parameter,
Virtual process parameter includes routing, ARP and the MAC Address of virtual process;
Create virtual process: LINUX ICP/IP protocol stack module initialization LINUX ICP/IP protocol stack, console module wound
Virtual process, the virtual interface of interface driver module creation virtual process are built, the communication pattern of virtual interface is virtual communication mould
Formula and actual communication mode;Virtual interface is associated with by console module with a host network card, is associated with all with virtual interface
Host network card formed multicast group;The connection ID and MAC Address configured for each virtual interface, the virtual interface for needing to communicate
Connection ID is identical;
After the completion of all virtual process creations, the script configuration file that console module is created according to script configuration module is to virtual
Process is configured;
When the running environment of the system is Windows environment, which further includes OS adaptation module, is used for: by LINUX
The LINUX process and thread of ICP/IP protocol stack, are adapted for Windows thread;By the LINUX of LINUX ICP/IP protocol stack
Lock, is adapted for Windows mutual exclusion lock;In the base of the call relation for the LINUX Compilation function for keeping LINUX ICP/IP protocol stack
On plinth, by LINUX Compilation function be converted to C language and by after conversion C language and Windows environment in C language compiler
Adaptation.
8. network (WSN) emulation system as claimed in claim 6, it is characterised in that: the script configuration module is also used to: will be owned
Script configuration file forms autoexec;The script configuration file pair that the console module is created according to script configuration module
The process that virtual process is configured includes: that console module configures virtual process according to autoexec.
9. network (WSN) emulation system as claimed in claim 6, which is characterized in that the data packet communication process includes:
Console module forms Ethernet packet for after the data packet received and the virtual interface information association of virtual process;Interface
Drive module determines the communication mode of current virtual interface:
If communication mode is virtual communication mode, packaging information is increased to Ethernet packet, packaging information includes the connection ID
And MAC Address;Interface driver module on the associated host network card of virtual interface call Winsock interface, according to destination IP
And destination port, the Ethernet packet after encapsulation is sent to multicast group, the virtual process in multicast group receives multicast packets;
If communication mode is actual communication mode, interface driver module is called and the associated host network card of virtual interface, by ether
Net packet is sent to purpose real equipment, and real equipment receives Ethernet packet.
10. network (WSN) emulation system as claimed in claim 9, which is characterized in that the virtual process reception group in the multicast group
The process for broadcasting packet includes:
After the host network card of the virtual interface of virtual process receives multicast packets, interface driver module parses multicast packets, obtains
To the packaging information and payload information of multicast packets, packaging information includes connection ID and MAC Address;
Interface driver module determine current virtual interface connection ID is identical as the connection ID of multicast packets and current virtual interface
MAC Address is different from the MAC Address of multicast packets, calls virtual interface that the payload information of multicast packets is sent to LINUX TCP/IP
Protocol stack module is handled.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910194311.9A CN110011835B (en) | 2019-03-14 | 2019-03-14 | Network simulation method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910194311.9A CN110011835B (en) | 2019-03-14 | 2019-03-14 | Network simulation method and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110011835A true CN110011835A (en) | 2019-07-12 |
CN110011835B CN110011835B (en) | 2021-10-01 |
Family
ID=67167083
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910194311.9A Active CN110011835B (en) | 2019-03-14 | 2019-03-14 | Network simulation method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110011835B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112039691A (en) * | 2020-08-06 | 2020-12-04 | 中国科学院信息工程研究所 | Automatic configuration method and device for virtual router in network simulation platform |
CN112511431A (en) * | 2020-11-12 | 2021-03-16 | 中国科学院计算技术研究所 | Routing flow fusion method for virtual network simulation |
CN113315647A (en) * | 2020-09-14 | 2021-08-27 | 阿里巴巴集团控股有限公司 | Network simulation method and device |
CN115037590A (en) * | 2022-03-25 | 2022-09-09 | 烽火通信科技股份有限公司 | Network virtualization system structure and virtualization method |
CN115714725A (en) * | 2022-10-17 | 2023-02-24 | 江西科骏实业有限公司 | Network instruction virtual simulation implementation method and system for teaching application |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020107678A1 (en) * | 2001-02-07 | 2002-08-08 | Chuan-Lin Wu | Virtual computer verification platform |
CN101383822A (en) * | 2008-07-10 | 2009-03-11 | 北京邮电大学 | Router virtual machine for aviation telecommunication network |
CN103338210A (en) * | 2013-07-18 | 2013-10-02 | 上海寰创通信科技股份有限公司 | AP (Access Point) emulation analog system based on CAPWAP (Control and Provisioning of Wireless Access Points) protocol |
CN104734915A (en) * | 2015-03-05 | 2015-06-24 | 重庆邮电大学 | Composite multiprocess and multithread multi-network concurrence dynamic simulation method |
CN108762768A (en) * | 2018-05-17 | 2018-11-06 | 烽火通信科技股份有限公司 | Network Intelligent Service dispositions method and system |
CN109151314A (en) * | 2018-09-10 | 2019-01-04 | 珠海格力电器股份有限公司 | A kind of camera shooting virtualization processing method, device, storage medium and the terminal of terminal |
-
2019
- 2019-03-14 CN CN201910194311.9A patent/CN110011835B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020107678A1 (en) * | 2001-02-07 | 2002-08-08 | Chuan-Lin Wu | Virtual computer verification platform |
CN101383822A (en) * | 2008-07-10 | 2009-03-11 | 北京邮电大学 | Router virtual machine for aviation telecommunication network |
CN103338210A (en) * | 2013-07-18 | 2013-10-02 | 上海寰创通信科技股份有限公司 | AP (Access Point) emulation analog system based on CAPWAP (Control and Provisioning of Wireless Access Points) protocol |
CN104734915A (en) * | 2015-03-05 | 2015-06-24 | 重庆邮电大学 | Composite multiprocess and multithread multi-network concurrence dynamic simulation method |
CN108762768A (en) * | 2018-05-17 | 2018-11-06 | 烽火通信科技股份有限公司 | Network Intelligent Service dispositions method and system |
CN109151314A (en) * | 2018-09-10 | 2019-01-04 | 珠海格力电器股份有限公司 | A kind of camera shooting virtualization processing method, device, storage medium and the terminal of terminal |
Non-Patent Citations (2)
Title |
---|
阳昕等: "基于平台抽象层的进程虚拟机设计与实现", 《计算机工程》 * |
陈锋: "虚拟交换设备的设计和管理实现", 《科技传播》 * |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112039691A (en) * | 2020-08-06 | 2020-12-04 | 中国科学院信息工程研究所 | Automatic configuration method and device for virtual router in network simulation platform |
CN113315647A (en) * | 2020-09-14 | 2021-08-27 | 阿里巴巴集团控股有限公司 | Network simulation method and device |
CN112511431A (en) * | 2020-11-12 | 2021-03-16 | 中国科学院计算技术研究所 | Routing flow fusion method for virtual network simulation |
CN112511431B (en) * | 2020-11-12 | 2022-03-22 | 中国科学院计算技术研究所 | Routing flow fusion method for virtual network simulation |
CN115037590A (en) * | 2022-03-25 | 2022-09-09 | 烽火通信科技股份有限公司 | Network virtualization system structure and virtualization method |
CN115037590B (en) * | 2022-03-25 | 2023-08-11 | 烽火通信科技股份有限公司 | Network virtualization architecture and virtualization method |
CN115714725A (en) * | 2022-10-17 | 2023-02-24 | 江西科骏实业有限公司 | Network instruction virtual simulation implementation method and system for teaching application |
CN115714725B (en) * | 2022-10-17 | 2023-09-12 | 江西科骏实业有限公司 | Teaching application-oriented network instruction virtual simulation implementation method and system |
Also Published As
Publication number | Publication date |
---|---|
CN110011835B (en) | 2021-10-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110011835A (en) | Network simulation method and system | |
Ahrenholz | Comparison of CORE network emulation platforms | |
Wang et al. | EstiNet openflow network simulator and emulator | |
CN115918139A (en) | Active assurance of network slicing | |
CN105407140B (en) | A kind of computing resource virtual method of networking test system | |
Li et al. | Delay-tolerant network protocol testing and evaluation | |
CN107222324B (en) | Service configuration method and device of network service | |
Rao | SDN and its use-cases-NV and NFV | |
CN110365552A (en) | Test method, device, storage medium and processor | |
CN114422010B (en) | Protocol testing method of satellite communication simulation platform based on network virtualization | |
Carneiro et al. | Fast prototyping of network protocols through ns-3 simulation model reuse | |
CN107171854A (en) | A kind of method that independent wide area network server is simulated in automatic test | |
CN110290105A (en) | A kind of verification platform and method of heterogeneous protocol conversion | |
CN109039709A (en) | A kind of mobile wireless network emulation and experiment porch based on virtualization | |
CN102750143A (en) | Digital signal processing (DSP) developing method based on matrix laboratory (MATLAB) component object model (COM) component calling | |
Miyachi et al. | Automatic configuration and execution of internet experiments on an actual node-based testbed | |
CN106878095A (en) | A kind of network collocating method and system based on scenario distributed emulation | |
CN103634290B (en) | Network (WSN) emulation system | |
CN105323109B (en) | Interconnection network simulator and method for simulating interconnection network | |
Fontes et al. | Improving ns-3 emulation performance for fast prototyping of routing and SDN protocols: Moving data plane operations to outside of ns-3 | |
Schappacher et al. | A flexible, modular, open-source implementation of 6LoWPAN | |
Sonba et al. | Performance Comparison Of the state of the art Openflow Controllers | |
CN112994954B (en) | Network test system, test network construction method and device | |
CN114124714A (en) | Multi-level network deployment method, device, equipment and storage medium | |
Serban et al. | Virtual ad hoc network testbeds for network-aware applications |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |