Summary of the invention
To solve the problems of above-mentioned prior art, the performance optimization based on Router Simulation that the invention proposes a kind of
Method, comprising:
Virtual router is set between true host and fictitious host computer, to the data from network simulation operation platform into
Row processing, transfers to destination host, and the message that fictitious host computer is sent out is packaged into data frame and is sent to the network
Simulation run platform.
Preferably, the virtual router further comprises Network Interface Unit, data processing unit, route planning unit
With data transfer unit, the Network Interface Unit is for sending and receiving message;Data processing unit is used for data detection, misses
Poor control, ip packet filter, packet loss and Delay computing, wherein data detection include successively examine the verification of IP packet header with whether
It for error message and whether is multicast message;Control errors include that processing the message of mistake occurs, send message to source host
Report error reason, realizes query message and Discrepancy Report message;Ip packet filter includes realizing the mistake to IP packet for broadcast packet
Filter, packet loss and Delay computing are every by a router for calculating message, and generated delay and router are in transfer
Before calculated should postpone and link in packet loss;The route planning unit realizes that route planning is calculated using IP packet
Method to realize route planning, and safeguarded and updated to routing table, and the data transfer unit is according to destination IP
Virtual routing tables are searched in location, determine to send to which virtual router.
Preferably, the fictitious host computer transfers to fictitious host computer data and the received void of distance host for virtual router
Quasi- host accesses data;The fictitious host computer is divided into Network Interface Unit, communication unit, thread units and document handling unit,
Wherein fictitious host computer receives message that is that route platform captures and transferring by router, the line by Network Interface Unit
The service thread of Cheng Danyuan, starting service emulation script simultaneously establish communication, and service thread is if you need to access file, then by file process
The file system agent of unit executes access operation;When fictitious host computer accesses distance host, system passes through activation thread list
The active threads of member start network communication software by active threads, and injection captures program;Start network communication software, captures and pass
Data, the data that transmission data are handled through active threads as fictitious host computer are sent, then fictitious host computer feature is loaded by communication unit, it
After give virtual router processing, data are finally sent by platform.
Preferably, the network simulation operation platform after operation, first initializes itself;Platform is adjusted to
Ready state waits the operation of user;The service that virtual network device provides is realized by writing script, passes through script interpretation
The initial work of device completes the reading to script interpreter configuration file, obtains the catalogue where all kinds of script interpreters, supplies
It is called when perform script;Feature library file is analyzed, several operation systems and identification remote access master are emulated by load feature database
The operating system of machine;Preset network equipment feature templates are loaded, the feature templates can also be during constructing the network operation
Addition, for being used when configuration device attribute;Journal file is opened, data are written into file, which is used for network row
For monitoring and analysis;Initialize the interface of platform and external network, capture and transfer for message;For cache pool distribution one
The message of the temporary transmitting-receiving of fixed memory headroom, is used to virtual network and postpones;Initialization data amount counts queue, statistical unit time
The message flow of platform and virtual network device is inside flowed through, including receives flow and transmitted traffic;After the completion of initialization, user
Selection is loaded into the network having built up or creates a network, completes the configuration to device attribute, corresponding parameter is arranged, specify
Interface corresponding to the equipment is simultaneously initialized, and connects each equipment by the network topology that is pre-designed, just to the logic of network
True property is tested, including whether IP address format is correct, if there are identical IP, and whether network connection is correct, if configuration
Incorrect, then error message is fed back to user reconfigures it, and after simulation process, platform clears up rubbish, and closing is beaten
The interface and pipeline opened, the memory headroom that release platform is opened up, while saving network topological diagram.
The present invention compared with prior art, has the advantage that
The invention proposes a kind of performance optimization methods based on Router Simulation, do not change agreement overall architecture, autonomous structure
Establishing network and configuration parameter provide good environment for the analysis of network attack and defence.
Specific embodiment
Retouching in detail to one or more embodiment of the invention is hereafter provided together with the attached drawing of the diagram principle of the invention
It states.The present invention is described in conjunction with such embodiment, but the present invention is not limited to any embodiments.The scope of the present invention is only by right
Claim limits, and the present invention covers many substitutions, modification and equivalent.Illustrate in the following description many details with
Just it provides a thorough understanding of the present invention.These details are provided for exemplary purposes, and without in these details
Some or all details can also realize the present invention according to claims.
An aspect of of the present present invention provides a kind of performance optimization method based on Router Simulation.Fig. 1 is real according to the present invention
Apply the performance optimization method flow chart based on Router Simulation of example.
The present invention is based on network simulation operation platforms, simulate various operating systems and service loophole.With a physics master
On the basis of machine realizes live network operation emulation, the small scale network that more physical hosts emulate is connected into fairly large
Network, and be each network equipments configuration equipment feature.For general user, platform as a kind of network struction tool,
The display unit observation that platform provides flows through the flow of platform and the network equipment.For developer, platform provides development interface,
Exploitation meets the functional block needed.
Entire platform is divided into four layers: control layer, mechanical floor, program layer and communication layers.The function of each layer is introduced respectively
It is as follows:
(1) control layer is responsible for the control in the initialization and operational process of platform and functional block to functional block, and provides
User interface.Including three subelements: device control cell, network configuration element and user interface section.Device control cell
It is responsible for being configured the specific network equipment, including setting operation system, file system and the port of opening;Network configuration list
The generation of the responsible network topology of member and the configuration of input router;User interface section is used for the interface interacted with emulator.
(2) mechanical floor is used for the running various network equipments of analog network, including host, server, firewall, routing
Device, hub device.Wherein there are two types of types for host and server, and one is the network equipment of emulation, one kind is integrated into very
Physical equipment in real network.
(3) file system needed for program layer is responsible for the program run on the network equipment and services and run program and service
System, it is made of service routine, signal procedure and file interface.Service routine includes simulation scenario or Console program, is used to
The various network services run on virtual network device.Signal procedure refers to the application software with network communicating function, by matching
Set, using these application software as on the network equipment application program run so that the network equipment in an active manner with it is other
Host is communicated.File interface is used to the file system of fictitious host computer, provides file operation service to thread and reflects institute's mould
The feature of quasi- operating system, operation two parts of tissue and file including file.
(4) communication layers are responsible for the communication work of the network equipment, including protocol characteristic library, ICP/IP protocol stack, network interface
And display interface.Protocol characteristic library includes the protocol stack characteristic information of various operating systems, for the behaviour to virtual network device
Make system loads protocol stack feature, identifies the operating system of remote access host.ICP/IP protocol stack is for managing in platform
All connections guarantee being correctly completed for equipment communication.The agreement of platform processes has link layer protocol, ARP, IP, TCP, UDP association
View, application layer protocol then give application program realization.The subelement realizes the encapsulation to TCP/IP protocol suite, provides a user
Protocol data package interface at all levels.These interfaces can be used for encapsulating the message for needing to transmit, and also can use this
A little interfaces extract interested field in outgoing packet and are analyzed.Network interface is used to for platform being linked into live network, and
Network data is captured during platform operation.Platform captures data there are two types of mode, be respectively user mode and
Kernel mode can only operate in the transport layer of ICP/IP protocol under user mode, can not directly data intercept link-layer frame and net
Network layers message, and the frame of the available link layer of kernel mode realize that intermediate drivers grade captures, including message captures, message
Disk is arrived in injection, network monitoring and storage, and network interface carries out Network application and development for user and research provides unified letter
Number interface, using these interfaces, user can carry out secondary development to platform, load functional block.Display interface provides for upper layer
Some necessary explicit functions.Mechanical floor calls display interface, display interface calling system explicit function or customized display letter
Number.
Each layer protocol uses modularized design, and every kind of agreement has the protocol header definition of oneself, and provides to protocol header
Analysis and encapsulation operation.For analysis operate, when platform receives data frame, by comprising every layer data located accordingly
Reason, the operation unpacked by multiple frame decoding check each tab character in header, determine the upper layer association for receiving data
View, finally consigns to application program for the application layer data in frame.For encapsulation operation, when application layer data needs to pass through platform
It when transmission, needs for data to be packaged by protocol stack, encapsulation will increase frame head letter on the basis of receiving data every time
Breath, eventually forms the data frame that can be transmitted over ethernet.
After platform captures data frame by network interface, according to the type field of frame judgement be adress analysis message or
IP packet is then directly responded by platform if it is adress analysis message, abandons the adress analysis message that the machine is sent, otherwise
Virtual network device is transferred to be handled, the message for handling completion is sent by platform.
Input router is set in the entrance that message enters virtual network, in order to give message at input router
Reason defines the cache pool between platform and input router, and the message handled is sent into cache pool by platform, and message is in cache pool
In stored in a manner of dynamic link table, new packet is abandoned if cache pool has been expired.Virtual network device handles the process tool of message
Body includes:
Input router reads message from cache pool, pre-processes first to message, checks the length and verification of packet
Then code analyzes destination address and data from message, finally sends the data to destination host according to routing table.Host process
After the completion, before sending message to gateway routing, it is also necessary to be packaged, load scheduled feature, comply with configuration
Operating system features, last message is stored in cache pool through input router.
The network equipment that may be used in the network of building emulation has host, router, firewall, hub etc..This
The embodiment of invention is only illustrated the router and host of emulation.Virtual router is that network environment and fictitious host computer carry out
The bridge of communication, therefore virtual router not only has the function of data transfer, while providing and carrying out connecing for data interaction with platform
Mouthful.Router is divided into four units, respectively Network Interface Unit, data processing unit, route planning unit and data turn
Send unit.The function and design of each unit, which are realized, to be described below:
The function of Network Interface Unit is to send and receive message.Router is divided into from the angle of router access network
Two classes: input router and ordinary router.Input router is the road being connected directly in logic with network where true host
By device, ordinary router is directly or indirectly connected with input router.Input router enters virtual network operation as data
Entrance, need to handle the data from platform, and transfer to destination host;Ingress router is also required to empty simultaneously
The message that quasi- host is sent out is packaged into data frame and gives platform.
Data processing unit is responsible for data detection, control errors, ip packet filter, packet loss and Delay computing.Data detection packet
It includes the verification for successively examining IP packet header and whether is error message and whether is multicast message;Control errors include processing
There is the message of mistake, sends message report error reason to source host, realize two kinds of messages, be query message and mistake respectively
Poor report message;Ip packet filter realizes the filtering to IP packet, is directed to broadcast packet;Message is every to pass through a router, all can
Corresponding delay is generated, router is before transfer, it should calculate delay, while there are also certain packet loss, packet losses for link
This function can be completed with Delay computing.
Route planning unit realizes route planning algorithm using IP packet, to realize route planning.It can also be responsible for satisfying the need
By the maintenance and update of table.
Transfer unit searches virtual routing tables according to purpose IP address, determines to send to which virtual router.
Platform accesses there are many ways to network, and virtual network operation is accessed true net using following methods by the present embodiment
Network.Assuming that B is the true host where platform, Internet, V are accessed by router A1-VnFor the n emulated on true host
Platform host.If visitor is located within the scope of the local area network where fictitious host computer.When visitor attempts and fictitious host computer ViCommunication
When, wherein 1≤i≤n, has found fictitious host computer ViIt is located at the same network segment with it, then it can first look for the adress analysis of oneself
Caching.If having fictitious host computer V in cachingiMAC Address, then message directly transmits away;If there is no fictitious host computer Vi's
MAC Address sends adress analysis packet then to request fictitious host computer ViMAC Address, obtain fictitious host computer ViMAC Address after again
Send data.As fictitious host computer ViWhen receiving a message of remote access person transmission by internet, router A is connect
While receiving message and begin trying to be sent out this packet.Router is retrieved by routing table, and is determined this ViPacket
Be sent to where.If V is directed toward in routingi, then the router can then abandon current message;The message that router A will be received
It is transferred to other router;If in the local area network where router, there are Vi, ViIt then will receive the packet transmitted by router A.It will
VIData stream transmitting to true host B process one of using following two mode: true host B is by transmission fictitious host computer Vi
Routing entrance set.In this way, message can be then transferred on fictitious host computer by router and then be directly transmitted
To true host.In the situation of the router without special outfit, router will use the instruction of Address Resolution Protocol to inquire
The hardware address of fictitious host computer.But because the fictitious host computer that can not respond, the inquiry instruction for analyzing agreement will not obtain
To response.Above-mentioned inquiry instruction is responded with the hardware address of true host at this time.Allow router by ViMessage be sent to very
Real host.It is connected under increasingly complex special network environment, or by one section of idle address space by routed encapsulation
To true host.
The function that virtual router simulates router in terms of data processing, route planning and data transfer three is special
Property, the controlling mechanism and chain of router are embodied in terms of data detection, control errors, ip packet filter, packet loss and delay five
Road characteristic can satisfy the requirement of router emulation.
Emulation for host starts with from the network of operating system composition, fictitious host computer is divided into following four unit,
Group becomes Network Interface Unit, communication unit, thread units and document handling unit.
Fictitious host computer is used to handle the data in two sources: virtual router transfers to fictitious host computer data, and long-range main
The received fictitious host computer of machine accesses data.Handle the mode of both data are as follows: host receives routing by Network Interface Unit
The message transferred by router that platform captures.The service thread of thread units, service thread starting service emulation script is simultaneously
Communication is established, service thread then executes access operation by the file system agent of document handling unit if you need to access file;
When fictitious host computer accesses distance host, system starts network communication by active threads by the active threads of activation thread units
Software, injection capture program.Then, network communication software starts, and captures it and transmits data.Transmission data are handled through active threads
For the data of fictitious host computer, then fictitious host computer feature loaded by communication unit, virtual router processing is given later, finally by putting down
Platform sends data.The function of fictitious host computer each unit and design realization make introductions all round as follows:
Network Interface Unit: host is by IP address come unique identification in a computer network.Transmission between computer
Data are sent and received by virtual router, and fictitious host computer, which must connect virtual router, could access network.It is empty
Quasi- host is identified using IP address, carries out network communication using the MAC Address of input router.Fictitious host computer is by receiving road
The data of itself are sent to by the Receive message that device transfers.
Communication unit: it realizes to the encapsulation for sending data and to reception data classification and decapsulation.Protocol characteristic library by
It is realized in the built-in feature library of existing scanning software.
Thread units: the service thread in host emulation is to access fictitious host computer for other hosts to provide service, is passed through
External script or Console program is realized, and only starting operation when accessed.Service thread and emulation script it
Between communicated using pipeline;Active threads in host emulation refer to the thread in operating system with network communicating function,
It actively can initiate the connection to distance host and establish communication.Activity condition and network of the active threads for simulation thread are logical
Believe situation.
Document handling unit: file system is used to provide file operation service to thread, it includes the tissue and text of file
The operation of part.The tissue of file is saved as a file using data in magnetic disk organized formats, and this document is divided into four parts: first
Part is reserved area, records basic input/output argument block;Second part is file allocation table, for recording file system space
Use distribution condition;Part III is file directory, for information such as the length of storage file, address, dates;Part IV
It is data field, is stored for file.
After network simulation operation platform operation of the invention, itself is initialized first.Initialization procedure is by platform
It is adjusted to ready state, waits the operation of user.The service that virtual network device provides is realized by writing script,
The reading to script interpreter configuration file is completed by the initial work of script interpreter, obtains all kinds of script interpreter institutes
Catalogue, for being called when perform script.Feature library file is analyzed, several operation systems and identification are emulated by load feature database
The operating system of remote access host.Preset network equipment feature templates are loaded, feature templates can also be in the building network operation
It adds in the process, for being used when configuration device attribute.Journal file is opened, data are written into file.Journal file is used for net
The monitoring and analysis of network behavior.Initialize the interface of platform and external network, capture and transfer for message.For cache pool point
Message with the temporary transmitting-receiving of certain memory headroom is used to virtual network and postpones.Initialization data amount counts queue, statistical unit
The message flow of platform and virtual network device is flowed through in time, including receives flow and transmitted traffic.
User selects to be loaded into the network having built up, or creates a network, needs to add the network equipment according to experiment,
And each equipment is connected by the network topology being pre-designed, form complete network analog.Adding network equipment process is actually
The configuration to device attribute is completed, corresponding parameter is set, specifies interface corresponding to the equipment and is initialized.User is complete
Matching for pairs of network postpones, and tests to the logical correctness of network, including whether IP address format is correct, if there are phases
Whether same IP is connected to the network correct.If improperly-configured, error message is fed back to use by platform in the form of dialog box
Family, so that user reconfigures network according to feedback information, until network configuration is correct.After ready, platform is
It starts to work according to predefined program, until experiment terminates.During this period, user can in real time observation grid state,
The network operation can be suspended to check operating condition, restore the operation of network again later, can also directly stop the network operation.
After simulation process, platform clears up rubbish, closes open interface and pipeline, the memory that release platform is opened up
Space, while saving network topological diagram.
In conclusion not changing agreement integrated stand the invention proposes a kind of performance optimization method based on Router Simulation
Structure, it is autonomous to construct network and configuration parameter, good environment is provided for the analysis of network attack and defence.
Obviously, it should be appreciated by those skilled in the art, above-mentioned each unit of the invention or each steps can be with general
Computing system realize that they can be concentrated in single computing system, or be distributed in multiple computing systems and formed
Network on, optionally, they can be realized with the program code that computing system can be performed, it is thus possible to they are stored
It is executed within the storage system by computing system.In this way, the present invention is not limited to any specific hardware and softwares to combine.
It should be understood that above-mentioned specific embodiment of the invention is used only for exemplary illustration or explains of the invention
Principle, but not to limit the present invention.Therefore, that is done without departing from the spirit and scope of the present invention is any
Modification, equivalent replacement, improvement etc., should all be included in the protection scope of the present invention.In addition, appended claims purport of the present invention
Covering the whole variations fallen into attached claim scope and boundary or this range and the equivalent form on boundary and is repairing
Change example.