Detailed description of the invention
Below in conjunction with drawings and Examples, the present invention is described in further detail.It is understood that specific embodiment described herein is used only for explaining the present invention, but not limitation of the invention.It also should be noted that, for the ease of describing, accompanying drawing illustrate only part related to the present invention but not full content.
Figure 1 illustrates the first embodiment of the present invention.
Fig. 1 is that the method that data according to a first embodiment of the present invention forward realizes flow process 100, and this realizes flow process 100, and details are as follows:
Step 101, broadband router receive DHCP request or the ARP request of second line of a couplet equipment.
Described DHCP request or ARP request are be positioned at, with the corresponding interface of described broadband router, the broadcast request that the second line of a couplet equipment of same broadcast domain sends.
Step 102, broadband router are according to the DHCP request received or ARP request, it is judged that the configuration mode of second line of a couplet device network interface.If it is determined that the network configurations of second line of a couplet equipment is for dynamically obtaining IP, perform step 103, if it is determined that the network configurations of second line of a couplet equipment is manual configuration, perform step 104.
Specifically, the determination methods of second line of a couplet device network interface allocation method is: when described broadband router receives DHCP request message, it is judged that send the network interface configuration mode in the second line of a couplet equipment of described DHCP request message for automatically obtaining IP;When described broadband router receives ARP request message, what situations below occur judges that the network interface configuration mode sending the second line of a couplet equipment of described ARP request message is as manually specifying first:
1, the source IP address in described ARP request message is not belonging in described broadband router the legitimate ip address that has been assigned with;
Such as: the source IP address of the ARP request message that certain port of broadband router receives is: 172.168.0.162, the IP address range of this port configuration is: 192.168.0.2-192.168.0.255.
2, the source IP address in described ARP request message belongs to the legal IP being assigned with in described broadband router, but source MAC is not inconsistent with the MAC Address corresponding for described legal IP of record in router.
Such as: the source IP address of the ARP request message that certain port of broadband router receives is: 192.168.0.162, MAC are;F4:6D:04:60:20:A9, this IP address of this port assignment, but MAC Address corresponding to this IP address is: C0:30:23:A3:54:B3.
Step 103, use DHCP standard agreement respond second line of a couplet equipment.
Distribute IP address for described second line of a couplet equipment, and specify gateway and dns server.
Step 104, carry out normal data forwarding.
Second line of a couplet equipment uses the IP address that broadband router dynamically distributes, and carries out normal data forwarding.
Step 105, carry out ARP proxy.
Broadband router sends the first arp response message to the second line of a couplet equipment sending ARP request message, replaces response ARP request, and the MAC Address of response is the MAC Address of described broadband router itself.
Step 106, establishment Static ARP list item.That is: MAC-IP correspondence list item.Wherein:
MAC is the MAC of the second line of a couplet equipment sending ARP request message;
IP is the IP address being not used by broadband router.
Preferably, IP is set in router in the uncommon field of configuration not by the IP address of router interface and the use of Static ARP list item.
Such as: adding a new interface IP on the f0/0 port of router, adding method is:
interf0/0
ipadd192.168.0.1255.255.255.0
ipadd10.1.1.0255.255.255.0secondary
A plurality of Static ARP list item constitutes static ARP table, and on router, the signal table of static ARP table is as shown in table 1.
Table 1
MAC |
IP |
F4:6D:04:60:20:A9 |
10.1.1.51 |
C0:30:23:A3:54:B3 |
10.1.1.125 |
D4:58:17:03:A7:30 |
10.1.1.23 |
Wherein: MAC is the physical address of the second line of a couplet equipment sending ARP request, and IP is the IP address of uncommon field in router.
Step 107, establishment static host route entry, it may be assumed that IP-NextHop correspondence entry.
Wherein, the IP in IP-NextHop correspondence entry is the source IP in described ARP request message;NextHop in IP-NextHop correspondence entry is not used by IP with on described described broadband router corresponding for second line of a couplet equipment MAC in described Static ARP list item.
Such as: in the ARP request that the second line of a couplet equipment of manual designated mode sends:
IP:192.168.0.158 source, source MAC:F4:6D:04:60:20:A9
IP corresponding in MAC-IP list item is: 10.1.1.51
The static route entry that this ARP request is corresponding is:
IPNextHop
192.168.0.15810.1.1.51
A plurality of static route entry constitutes static routing table, and on router, the signal table of static routing table is as shown in table 2.
Table 2
IP |
Next Hop |
192.168.0.158 |
10.1.1.51 |
172.168.1.233 |
10.1.1.125 |
192.168.1.47 |
10.1.1.23 |
Step 108, forward second line of a couplet equipment packet.
Forward the packet of second line of a couplet equipment, including the packet that the packet forwarding second line of a couplet equipment to send and forwarding second line of a couplet equipment receive.
Wherein, the process chart forwarding second line of a couplet equipment sending data bag shown in being illustrated in figure 2 according to a first embodiment of the present invention;The process chart forwarding second line of a couplet equipment receiving data bag shown in being illustrated in figure 3 according to a first embodiment of the present invention.
As shown in Figure 2 and Figure 3, step 108 includes step 108A and step 108B: step 108A includes step 108A1-108A3;Step 108B includes step 108B1-108B4.
When broadband router forwards the packet of second line of a couplet equipment transmission, perform step 108A:
Step 108A1, extract second line of a couplet equipment sending data bag five-tuple data.Namely send in packet: source IP, source port, purpose IP, destination interface and transport layer protocol.
Step 108A2, according to five-tuple data, create data flow state list item.
A plurality of data flow state list item constitutes data flow state table, and on broadband router, the signal table of data flow state table is as shown in table 3.
Table 3
Source IP |
Source port |
Purpose IP |
Destination interface |
Transport layer protocol |
192.168.0.158 |
245 |
121.14.88.76 |
80 |
TCP |
172.168.1.233 |
1001 |
61.135.208.184 |
20 |
TCP |
192.168.1.47 |
2431 |
113.106.194.221 |
88 |
UDP |
Step 108A3, the transmission packet of second line of a couplet equipment is forwarded according to routing table.
Described routing table is static routing table and the dynamic routing table of storage on broadband router.
When broadband router forwards the packet of second line of a couplet equipment reception, perform step 108B:
Step 108B1, searches data flow state table and obtains source port.
According to the source IP receiving packet, source port and purpose IP, search data flow state table, match the data flow state list item of correspondence.
In the present embodiment, the source IP:121.14.88.76 of the packet received, source port: 80, purpose IP:192.168.0.158.According to table 3, the data flow state list item of coupling is Section 1, and obtaining source port is 245.
Step 108B2, lookup static host route entry obtain NextHop.
According to the purpose IP receiving packet, search static host routing table, match the static host route entry of correspondence.
In the present embodiment, the purpose IP:192.168.0.158 of the packet received, according to table 2, the static host route entry of coupling is Section 1, obtains NextHop:10.1.1.51.
Step 108B3, lookup Static ARP list item, obtain second line of a couplet equipment MAC.
According to the acquisition NextHop obtained in step 108B2, search static ARP table, match the Static ARP list item of correspondence.
In the present embodiment, NextHop:10.1.1.51, according to table 1, the Static ARP list item of coupling is Section 1, obtains MAC:10.1.1.51, and acquisition MAC is F4:6D:04:60:20:A9.
Step 108B4, the packet that described second line of a couplet equipment is received send to physical address be described in MAC in the MAC-IP correspondence entry that meets, port numbers be described in the second line of a couplet equipment of source port in the five-tuple data that meet.
In the present embodiment, the packet that second line of a couplet equipment receives is forwarded to No. 254 ports of the second line of a couplet equipment that MAC is F4:6D:04:60:20:A9 by router.
One of the present embodiment preferred embodiment in, between step 102 and step 105, increase by one and judge that whether ARP request message is by the step (not shown) of trust authentication.
Determination methods is:
1, the source IP and source MAC of the ARP request message received are extracted;
2, the source IP and source MAC according to this ARP request message, constructs and sends arp response message;
3, enable intervalometer, set a scheduled time, for instance: 1s.
If received within 1s and identical for the source MAC response message in described arp response message, described ARP request authentication of message result is credible;Otherwise, insincere.
When the ARP request message result of checking is insincere, abandon this ARP request message;When the ARP request message result of checking is credible, perform step 105, carry out ARP proxy.
Figure 4 illustrates the second embodiment of the present invention.
Fig. 4 is handling process Figure 200 of DNS request message according to a second embodiment of the present invention, and this realizes flow process 200, and details are as follows:
Step 201, broadband router receive the DNS request message of second line of a couplet equipment.
Step 202, judge DNS request message purpose IP whether be contained in broadband router the machine configuration dns server list: when DNS request message purpose IP be contained in broadband router the machine configuration dns server address list, perform step 203;When in DNS request message, purpose IP address is not belonging to the dns server address list of broadband router the machine configuration, perform step 204.
Step 203, directly forwarding DNS request message.
Step 204, DNS request message is carried out DNS proxy, described DNS request message is forwarded to the dns server of broadband router the machine configuration.
Figure 5 illustrates the third embodiment of the present invention.
Fig. 5 is the process chart 300 that static route entry according to a third embodiment of the present invention is aging, and this realizes flow process 300, and details are as follows:
In the present embodiment, creating after a static host route entry, be initially set to 1 for what this route entry arranged flag bit Flag, Flag, then in the present embodiment, table 2 is revised as table 4, as shown in the table.
Table 4
IP |
Next Hop |
Flag 5 --> |
192.168.0.158 |
10.1.1.51 |
1 |
172.168.1.233 |
10.1.1.125 |
1 |
192.168.1.47 |
10.1.1.23 |
1 |
Step 301, intervalometer trigger.
Such as, it is 30 minutes by the set of time in intervalometer, triggered an intervalometer every 30 minutes.
Step 302, the traversal all static route entry with Flag labelling.
Article 1 static route entry from static routing table starts to read, it is judged that the Flag value in static route entry.
Step 303, judge that Flag value is 1 or 0.When the Flag value judging static route entry is 1, perform step 304;When the Flag value judging static host route entry is 0, perform step 305.
Step 304, the Flag value of this static host route entry is set to 0.
Step 305, delete this static host route entry and delete simultaneously correspondence ARP.
Such as, a certain item of static host route entry is:
IP |
Next Hop |
Flag |
192.168.0.158 |
10.1.1.51 |
0 |
After performing step 305, static routing table is deleted this, simultaneously in static ARP table, delete the IP Static ARP list item identical with NextHop item in static routing list item.
MAC |
IP |
F4:6D:04:60:20:A9 |
10.1.1.51 |
Step 306, judgement are when whether bar static host route entry is the last item in static host routing table: if the last item, perform step 307;If not the last item, re-execute step 302.
Step 307, replacement intervalometer.
Such as: in the present embodiment, the time in intervalometer is re-set as 30 minutes.
Figure 6 illustrates the fourth embodiment of the present invention.
Fig. 6 is the structural representation 400 of the device that data according to a fourth embodiment of the present invention forward.
The device 400 that data shown in the present embodiment forward, including configuration mode judge module 401, manual specific mode processing module 402 and DHCP mode processing module 403.
Wherein: configuration mode judge module 401 is according to the ARP received or DHCP request message, it is judged that the configuration mode of broadband router second line of a couplet device network interface.When judge second line of a couplet equipment network interface configuration mode as automatically obtaining IP mode, starting DHCP mode processing module 403, DHCP mode processing module 403 according to the DHCP protocol of standard is second line of a couplet equipment distributed network parameters, completes data and forwards;When the network interface configuration mode judging second line of a couplet equipment is manual specific mode, start manual specific mode processing module 402, manual specific mode processing module 402, the second corresponding relation being not used by between IP described on the IP address setting up setting under the first corresponding relation being not used by between IP on described second line of a couplet equipment MAC and broadband router and described second line of a couplet equipment manual mode and described broadband router, the data carrying out described second line of a couplet equipment according to described first, second corresponding relation forward.
One of the present embodiment preferred embodiment in, broadband router realizes the device 400 that second line of a couplet device data forwards, also includes DNS proxy module (not shown).
DNS proxy module, for completing DNS proxy function to DNS request message: when in the DNS request message received, purpose IP address is contained in the dns server address list of described broadband router the machine configuration, described DNS request message is directly forwarded;When in the described DNS request message received, purpose IP address is not belonging to the dns server address list of described broadband router the machine configuration, described DNS request message is carried out DNS proxy, DNS request message is forwarded to the dns server of described broadband router the machine configuration.
One of the present embodiment preferred embodiment in, manual specific mode processing module 402 farther includes: corresponding relation building module and data forwarding module (not shown).
Corresponding relation building module, the second corresponding relation being not used by between IP described on the IP address setting up setting under the first corresponding relation being not used by between IP on described second line of a couplet equipment MAC and broadband router and described second line of a couplet equipment manual mode and described broadband router.
Data forwarding module, according to first, second corresponding relation that corresponding relation building module is set up, the data for carrying out described second line of a couplet equipment forward.
Note, above are only presently preferred embodiments of the present invention and institute's application technology principle.It will be appreciated by those skilled in the art that and the invention is not restricted to specific embodiment described here, various obvious change can be carried out for a person skilled in the art, readjust and substitute without departing from protection scope of the present invention.Therefore, although the present invention being described in further detail by above example, but the present invention is not limited only to above example, when without departing from present inventive concept, other Equivalent embodiments more can also be included, and the scope of the present invention is determined by appended right.