A kind of method and apparatus of realizing that the device network interface exempts to change
Technical field
The present invention relates to network and network equipment field, relate in particular to a kind of method and apparatus of realizing that the device network interface exempts to change.
Background technology
Broadband router is emerging in recent years a kind of networking products, and it is accompanied by the universal of broadband and arises at the historic moment.Functions such as router, fire compartment wall, bandwidth control and system management that broadband router is integrated, possess characteristics such as rapid data forwarding, flexible net management, the traffic statistics of enriching and journaling, and configuration is simple, and majority also has the configuration wizard function, is convenient to user management and uses.At present Chinese broadband market, most broadband routers have special optimal design, and for example featured function such as many ISP (Internet Service Provider, ISP) circuit automatic routing can satisfy different network traffics environment.Most broadband routers adopt highly integrated design, integrated 10/100/1000Mbps broadband ethernet interface, can drive multiple pc interconnected be connected Internet, be widely used in occasions such as family, hotel, school, office, Internet bar, residential quarter access, government, enterprise.
In order to make the second line of a couplet PC can access network, general broadband router is at LAN(Local Area Network, local area network (LAN)) all be to enable DHCP(dynamically to obtain IP on the mouth) server capability, make Intranet PC obtain IP automatically, thereby connect into network, carry out data by router and transmit.Satisfied general relative fixed user's demand, but in flows of personnel such as similar hotels than in the scene faster, user IT knowledge number difference when inserting hotel's network, needs keeper's support more, has increased the maintenance workload of management.
At present, make the PC in the same broadcast domain of router interface, exempt from the network configuration change and also belong to technical problem just to be solved.
Summary of the invention
The present invention proposes a kind of method and apparatus of realizing that the device network interface exempts to change, realized that no matter newly the PC network configuration of couple in router is automatic obtaining mode, or manual specified interface network parameter, can both accomplish to revise its current network interface configuration, namely can carry out data by router transmits, significantly reduced keeper's maintenance work, described technical scheme is as follows:
A kind of method that realizes that the device network interface exempts to change comprises:
Any interface of router is opened second line of a couplet device network interface exempt from configuration change function;
Whether judgement is manual designated mode with the configuration mode that described router interface is in the second line of a couplet device network interface within the same broadcast domain;
If, start ARP (Address Resolution Protocol, address resolution protocol) agency, carry out the credible checking of ARP;
Judge whether the credible checking by ARP;
If, in the corresponding list item that is recorded in router that the physical address of described second line of a couplet equipment is corresponding with the IP address of described second line of a couplet equipment;
Second line of a couplet equipment sends datagram to router;
Five-tuple according to the described second line of a couplet equipment that sends datagram is set up data stream list, and the record router receives the information of the incoming interface of described data message in described data stream list;
Described data message is transmitted;
When the response bag of described data message arrives router, find outgoing interface according to described data stream list;
According to the record of the IP address of the physical address of second line of a couplet equipment in the list item of described router and described second line of a couplet equipment, find the reference address physical address corresponding of described data message, send data.
Further, described method also comprises regularly the aging corresponding clauses and subclauses of static ip address-physical address that are recorded in the corresponding list item of described router.
Further, if the configuration mode of second line of a couplet device network interface is not manual designated mode, then router is according to DHCP(Dynamic Host Configuration Protocol, and DynamicHost arranges agreement) agreement gives described second line of a couplet devices allocation network parameter, and carry out data and transmit.
Further, second line of a couplet equipment comprises DNS (Domain Name System, domain name system) data message to the data message that router sends.
Further, described DNS data message transmitted comprised:
Second line of a couplet equipment sends DNS request bag to router;
Judge whether the purpose IP address in the DNS request bag is included in the dns server address tabulation of this machine of router configuration;
If then described DNS data message is directly transmitted;
If not, then described DNS data message being carried out the DNS agency transmits.
Further, regularly the aging corresponding clauses and subclauses of static ip address-physical address that are recorded in the corresponding list item of described router further comprise:
After creating the corresponding clauses and subclauses of static ip address-physical address, for described clauses and subclauses arrange flag bit Flag, the Flag initial value is set to 1;
Enable timer;
After described timer triggers, travel through the corresponding clauses and subclauses of static ip address-physical address of all band flag marks;
Whether the value of judging flag is 1;
If the value of flag is 1, then described Flag puts 0;
If the value of flag is 0, then delete the corresponding clauses and subclauses of described static ip address-physical address;
Judge whether it is the last item static ip address-the corresponding clauses and subclauses of physical address;
If, the replacement timer.
A kind of device of realizing that the device network interface exempts to change comprises:
The function opening module is used for that any interface of router is opened second line of a couplet device network interface and exempts from configuration change function;
First judge module, whether be used for judgement is manual designated mode with the configuration mode that described router interface is in the second line of a couplet device network interface within the same broadcast domain;
The credible authentication module of ARP is used for starting ARP proxy when the configuration mode of second line of a couplet device network interface is manual designated mode, carries out the credible checking of ARP;
Second judge module is used for judging whether the credible checking by ARP;
The clauses and subclauses creation module is used for after passing through the credible checking of ARP, in the corresponding list item that is recorded in router that the physical address of described second line of a couplet equipment is corresponding with the IP address of described second line of a couplet equipment;
Request sending module is used for sending datagram;
The data stream list creation module is used for setting up data stream list according to the five-tuple of the described second line of a couplet equipment that sends datagram, and the record router receives the information of the incoming interface of described data message in described data stream list;
Data forwarding module is used for described data message is transmitted;
Search module, be used for when the response bag of described data message arrives router, finding outgoing interface information according to described data stream list;
Data transmission blocks is used for finding the reference address physical address corresponding of described data message, the transmission data according to the physical address of the list item second line of a couplet equipment of described router and the record of the IP address of described second line of a couplet equipment.
Further, described device also comprises regularly aging module, is used for regularly the aging corresponding clauses and subclauses of static ip address-physical address that are recorded in the corresponding list item of described router.
Further, second line of a couplet equipment comprises the DNS data message to the data message that router sends.
Further, described data forwarding module specifically comprises when transmitting the DNS data message:
Second line of a couplet equipment sends DNS request bag to router;
Judge whether the purpose IP address in the DNS request bag is included in the dns server address tabulation of this machine of router configuration;
If then described DNS data message is directly transmitted;
If not, then described DNS data message being carried out the DNS agency transmits.
Further, the aging module of described timing specifically is used for:
After creating the corresponding clauses and subclauses of static ip address-physical address, for described clauses and subclauses arrange flag bit Flag, the Flag initial value is set to 1;
Enable timer;
After described timer triggers, travel through the corresponding clauses and subclauses of static ip address-physical address of all band flag marks;
Whether the value of judging flag is 1;
If the value of flag is 1, then described Flag puts 0;
If the value of flag is 0, then delete the corresponding clauses and subclauses of described static ip address-physical address;
Judge whether it is the last item static ip address-the corresponding clauses and subclauses of physical address;
If, the replacement timer.
The present invention forms a total solution by on router the method for Dynamic Host Configuration Protocol server, network agent and state table being combined.No matter newly the PC network configuration of couple in router is automatic obtaining mode, or manual specified interface network parameter, can both accomplish to revise its current network interface configuration, namely can carry out data by router and transmit, significantly reduce keeper's maintenance work.
Description of drawings
Fig. 1 is the method flow diagram that realization device network interface that the embodiment of the invention provides exempts to change;
Fig. 2 is the flow chart that the DNS data message is transmitted that the embodiment of the invention provides;
Fig. 3 is the aging method flow diagram that is recorded in the corresponding clauses and subclauses of static ip address-physical address in the corresponding list item of router of timing that the embodiment of the invention provides;
Fig. 4 is the system function module block diagram that realization device network interface that the embodiment of the invention provides exempts to change.
Embodiment
The present invention is described in further detail below in conjunction with drawings and Examples.Be understandable that specific embodiment described herein only is used for explaining the present invention, but not limitation of the invention.
Fig. 1 is the method flow diagram that realization device network interface that the embodiment of the invention provides exempts to change, and this method comprises:
Step 101: any interface of router is opened second line of a couplet device network interface exempt from configuration change function;
Any some interface at router, open second line of a couplet device network interface and exempt from configuration change function, after opening this function, be in new access network second line of a couplet equipment within the same broadcast domain with described interface, need not revise its current network interface configuration, namely can carry out data by described router and transmit.
Step 102: whether judgement is manual designated mode with the configuration mode that described router interface is in the second line of a couplet device network interface within the same broadcast domain;
The configuration mode of second line of a couplet device network interface has two kinds of automatic mode and manual modes, when the configuration mode of network interface is set to automatic mode, second line of a couplet equipment obtains the IP address automatically, and when network interface changed, the IP address of second line of a couplet equipment also can change thereupon; When the configuration mode of network interface was set to manual mode, the IP address of second line of a couplet equipment was manually set by the user in advance, can not change with the change of network interface.
Step 103: if, start ARP (Address Resolution Protocol, address resolution protocol) agency, carry out the credible checking of ARP;
If the configuration mode of second line of a couplet device network interface is not manual designated mode, but during automatic mode, then router is according to DHCP(Dynamic Host Configuration Protocol, DynamicHost arranges agreement) agreement gives second line of a couplet devices allocation network parameter, second line of a couplet equipment carries out normal data according to agreement and transmits after getting access to network parameter.
Wherein, DynamicHost arranges agreement (Dynamic Host Configuration Protocol, DHCP) be the procotol of a local area network (LAN), use udp protocol (User Datagram Protocol, User Datagram Protocol) work, mainly contain two purposes: give internal network or Internet service provider's automatic IP address allocation, give user or internal network keeper as the means of all computers being made central management.
If the configuration mode of second line of a couplet device network interface is manual designated mode, then open ARP proxy, specifically comprise: second line of a couplet equipment carries out the ARP request to the gateway IP of appointment; According to the ARP request that interface is received, the ARP corresponding with the physical address structure of described interface responds bag; Start the credible proof procedure of ARP.
Step 104: judge whether the credible checking by ARP;
Wherein, ARP (Address Resolution Protocol, address resolution protocol) obtains an ICP/IP protocol of physical address.After the ARP request of certain IP addresses of nodes was broadcast on the network, this node can receive and confirm replying of its physical address that such packet just can be sent out.
Proxy ARP is a mutation of ARP agreement.Will communicate by letter with the computer realization in other networks for the computer that does not dispose default gateway, gateway receives that the ARP request of source computer can use the physical address of oneself and the IP address of object-computer that source computer is replied.Proxy ARP exactly with a main frame as another host A RP is replied.It can make under the situation that does not influence routing table adds a new router, makes the subnet more transparence that becomes concerning this main frame.The use of proxy ARP generally is to use on the network that does not have allocating default gateway and routing policy.
Step 105: if, in the corresponding list item that is recorded in router that the physical address of described second line of a couplet equipment is corresponding with the IP address of described second line of a couplet equipment;
If ARP checking result is believable, then in router, add IP-physical address record clauses and subclauses, flag bit Flag is set, the Flag initial value is set to 1.Wherein, IP is the physical address of second line of a couplet equipment, is exactly the IP address that manually sets, and physical address is the physical address of described second line of a couplet equipment.
If ARP checking result is insincere, then do not do any processing.
Step 106: second line of a couplet equipment sends datagram to router;
Wherein, second line of a couplet equipment comprises the DNS data message to the data message that router sends.
Fig. 2 is the flow chart that the DNS data message is transmitted that the embodiment of the invention provides, and as shown in Figure 2, the DNS data message transmitted specifically comprises step 1061~step 1065:
Step 1061: second line of a couplet equipment sends DNS request bag to router;
Step 1062: judge whether the purpose IP address in the DNS request bag is included in the dns server address tabulation of this machine of router configuration, if, execution in step 1063, if not, execution in step 1064;
Step 1063: described DNS data message is directly transmitted;
Step 1064: described DNS data message is carried out the DNS agency transmit.
Wherein, DNS (Domain Name System, domain name system), it is a kernel service of internet, its conduct can be with a distributed data base of domain name and IP address mutual mapping, can make the people visit the Internet more easily, not remember the IP string that can directly be read by machine and do not spend.
Step 107: the five-tuple according to the described second line of a couplet equipment that sends datagram is set up data stream list, and the record router receives the information of the incoming interface of described data message in described data stream list;
Router is received the forwarding data message of second line of a couplet equipment, according to the forwarding strategy that disposes on the router, whether the judgment data bag meets forwarding strategy, the packet that meets forwarding strategy exempts to dispose from second line of a couplet device network interface on the interface of changing function to other interface forwarding, set up data stream list according to five-tuple, and in this stream table, record the incoming interface information of described packet.
Step 108: described data message is transmitted;
Step 109: when the response bag of described data message arrives router, find outgoing interface according to described data stream list;
Step 110: according to the record of the IP address of the physical address of second line of a couplet equipment in the list item of described router and described second line of a couplet equipment, find the reference address physical address corresponding of described data message, send data.
Wherein, described method also comprises regularly the aging corresponding clauses and subclauses of static ip address-physical address that are recorded in the corresponding list item of router.Fig. 3 is the aging method flow diagram that is recorded in the corresponding clauses and subclauses of static ip address-physical address in the corresponding list item of router of timing that the embodiment of the invention provides, as shown in Figure 3, regularly the aging corresponding clauses and subclauses of static ip address-physical address that are recorded in the corresponding list item of router further comprise:
Step 1101: after creating the corresponding clauses and subclauses of static ip address-physical address, for described clauses and subclauses arrange flag bit Flag, the Flag initial value is set to 1;
Step 1102: enable timer;
Step 1103: after timer triggers, travel through the corresponding clauses and subclauses of static ip address-physical address of all band flag marks;
Step 1104: whether the value of judging flag is 1, if then execution in step 1105, if not, then execution in step 1106;
Step 1105: described Flag puts 0;
Step 1106: delete the corresponding clauses and subclauses of described static ip address-physical address;
Step 1107: judge whether it is the last item static ip address-the corresponding clauses and subclauses of physical address;
Step 1108: if, the replacement timer.
Fig. 4 is the system function module block diagram that realization device network interface that the embodiment of the invention provides exempts to change, as shown in Figure 4, the device that described realization device network interface exempts to change, it is characterized in that, comprise: function opening module 410 is used for that any interface of router is opened second line of a couplet device network interface and exempts from configuration change function; First judge module 401, whether be used for judgement is manual designated mode with the configuration mode that described router interface is in the second line of a couplet device network interface within the same broadcast domain; ARP is credible authentication module 402 is used for starting ARP proxy when the configuration mode of second line of a couplet device network interface is manual designated mode, carries out the credible checking of ARP; Second judge module 403 is used for judging whether the credible checking by ARP; Clauses and subclauses creation module 404 is used for after passing through the credible checking of ARP, in the corresponding list item that is recorded in router that the physical address of second line of a couplet equipment is corresponding with the IP address of second line of a couplet equipment; Request sending module 405 is used for sending datagram; Data stream list creation module 406 is used for setting up data stream list according to the five-tuple of the second line of a couplet equipment that sends datagram, the information of the incoming interface of record router receiving data packets in data stream list; Data forwarding module 407 is used for the data message is transmitted; Search module 408, be used for when the response bag of data message arrives router, finding outgoing interface information according to data stream list; Data transmission blocks 409 is used for finding the reference address physical address corresponding of data message, the transmission data according to the physical address of the list item second line of a couplet equipment of router and the record of the IP address of second line of a couplet equipment.
Wherein, second line of a couplet equipment comprises the DNS data message to the data message that router sends, and data forwarding module 407 specifically comprises when transmitting the DNS data message: second line of a couplet equipment sends DNS request bag to router; Judge whether the purpose IP address in the DNS request bag is included in the dns server address tabulation of this machine of router configuration; If then described DNS data message is directly transmitted; If not, then described DNS data message being carried out the DNS agency transmits.
Described device also comprises regularly aging module, is used for regularly the aging corresponding clauses and subclauses of static ip address-physical address that are recorded in the corresponding list item of router.
Wherein, regularly aging module specifically is used for:
After creating the corresponding clauses and subclauses of static ip address-physical address, for described clauses and subclauses arrange flag bit Flag, the Flag initial value is set to 1; Enable timer; After described timer triggers, travel through the corresponding clauses and subclauses of static ip address-physical address of all band flag marks; Whether the value of judging flag is 1; If the value of flag is 1, then described Flag puts 0; If the value of flag is 0, then delete the corresponding clauses and subclauses of described static ip address-physical address; Judge whether it is the last item static ip address-the corresponding clauses and subclauses of physical address; If, the replacement timer.
The present invention forms a total solution by on router the method for Dynamic Host Configuration Protocol server, network agent and state table being combined.No matter newly the PC network configuration of couple in router is automatic obtaining mode, or manual specified interface network parameter, can both accomplish to revise its current network interface configuration, namely can carry out data by router and transmit, significantly reduce keeper's maintenance work.
It below only is the explanation of doing at the preferred embodiments of the present invention and know-why thereof; and be not the restriction that technology contents of the present invention is carried out; anyly be familiar with those skilled in the art in technical scope disclosed in this invention; the variation of being expected easily or replacement all should be encompassed in protection scope of the present invention.