Summary of the invention
The purpose of this invention is to provide a kind of method of utilizing broadband router to realize online, to overcome the shortcoming that operations such as need carrying out the dialing information configuration when use broadband router inserts in the prior art to it is made troubles to the user, improve the intelligent of broadband router, simplify user's operation.
For this reason, the invention provides following technical scheme:
A kind of method of utilizing broadband router to realize online said method comprising the steps of:
A, set up point-to-point protocol PPP dialup client program on computers;
When B, startup PPP dialup client program, the broadband router that links to each other with described computer is monitored the message of going out through its local area network (LAN) LAN mouth commentaries on classics wide area network WAN mouth;
The protocol fields of C, the described message of bed-by-bed analysis is known the protocol type of described message, and catches user's dialing information by the message content in the protocol processes flow process of corresponding described protocol type;
D, after described computer powers on once more, described broadband router dials automatically according to the user's who catches dialing information, sets up being connected of described computer and network.
Described step B comprises:
B1, when described broadband router dial mode is a dynamic host configuration protocol DHCP mode and when not disposing the WAN port address, the LAN mouth of described broadband router is changeed the message that the WAN mouth goes out monitors;
If the described broadband router of B2 listens to the PPP message, then the dial mode of described broadband router is set to the PPP dial mode;
B3, when described broadband router dial mode is a PPP mode and when not disposing dial-up account name and password, the LAN mouth of described broadband router is changeed the message that the WAN mouth goes out monitors.
Described step C comprises:
C1, obtain the LAN mouth and change the Ether frame that the WAN mouth is gone out;
C2, when protocol field value is the encoded radio of Point-to-Point Protocol over Ethernet session stage in detecting the Ether frame that obtains, then follow-up message is carried out the ppp protocol Treatment Analysis, obtain dial-up account name and encrypted message;
C3, when protocol field value is the encoded radio of Internet Protocol IP in detecting the Ether frame that obtains, then further check the tunnel encapsulation form of the described Ether frame that obtains;
C4 obtains dial-up account name and encrypted message if the tunnel form of generic route encapsulation GRE encapsulation then carries out the analysis of PPTP protocol processes to follow-up message;
C5 obtains dial-up account name and encrypted message if the tunnel form of user datagram protocol UDP and Layer 2 Tunneling Protocol L2TP encapsulation then carries out the analysis of L2TP protocol processes to follow-up message.
Described step C4 comprises:
Detect the protocol type field in the GRE head of described subsequent packet;
When the value that detects described protocol type field is the encoded radio of Point-to-Point Protocol over Ethernet session stage, then follow-up message is carried out the ppp protocol Treatment Analysis, obtain dial-up account name and encrypted message.
Described step C5 comprises:
Detect the protocol type field in the L2TP head of described subsequent packet;
When the value that detects described protocol type field is the encoded radio of Point-to-Point Protocol over Ethernet session stage, then follow-up message is carried out the ppp protocol Treatment Analysis, obtain dial-up account name and encrypted message.
Described follow-up message is carried out the ppp protocol Treatment Analysis, the step of obtaining dial-up account name and encrypted message comprises:
Code field in the subsequent packet that monitoring broadband router LAN mouth commentaries on classics WAN mouth is gone out;
Obtain dial-up account name and encrypted message in the password authentication protocol pap authentication confirmation message according to the value of described code field.
Described step C2 further comprises:
When subsequent packet is the pap authentication request message, write down account number and encrypted message in the described pap authentication request message, write down source MAC, session identification and the PPP sign of described pap authentication request message simultaneously;
When subsequent packet is the pap authentication confirmation message, according to information corresponding in the marking matched described pap authentication confirmation message of source MAC, session identification and PPP of the pap authentication request message that writes down;
If all information are all consistent, then with the account number of record and encrypted message dialing information as the user.
Described step C2 further comprises:
When subsequent packet is the pap authentication failure message, according to information corresponding in the marking matched described pap authentication failure message of media access control MAC address, source, session identification and PPP of the pap authentication request message that writes down;
If all information are all consistent, then the information of deletion record is waited for user of redialing.
Described step C2 further comprises:
When subsequent packet is that ppp link control protocol LCP with session identification identical with the session identification of pap authentication request message of record stops request or Point-to-Point Protocol over Ethernet and activates when finding end of packet PPPoE PADT message, then the information of deletion record is waited for user of redialing.
Described PPP dialup client program is specially:
Point-to-Point Protocol over Ethernet dialup client program; Perhaps PPTP PPTP dialup client program; Perhaps L2TP dialup client program.
By above technical scheme provided by the invention as can be seen, the present invention is by setting up PPP (point-to-point protocol) dialup client program on computers, such as PPPoE dialup client program, PPTP (PPTP) dialup client program or L2TP (Level 2 Tunnel Protocol) dialup client program etc., and when starting this dialup client program, make the broadband router that links to each other with computer obtain user's dialing information, roll off the production line the back broadband router at computer can be according to the dialing again automatically of these information, with the computer access network.The user of this access way to adopting the DHCP mode to surf the Net, need not that broadband router is done any setting can surf the Net; To the PPP dial user, only need on original computer, successfully to dial and once can finish the setting of user name, password and relevant dialing information the router dialing.Thereby make the user need not that broadband router is done any operation and terminal can be inserted Internet, improved the intelligent degree of broadband router, convenient for users.
Embodiment
Usually, the default setting of broadband router is surfed the Net for the DHCP mode, when the user adopts the DHCP mode to surf the Net, after the networking, only need the IP address configuration of computer is become and the same network segment of broadband router LAN port address, a plurality of users just can share the same WAN mouth IP address visit Internet of broadband router.
But because family and medium-sized and small enterprises generally adopt PPP (point-to-point protocol) dial mode, this dial mode need be carried out the authentication of account number and password to the user.Current operator adopts PAP (password authentication protocol) authentication mode usually.PAP is the agreement that a kind of clear-text way is transmitted in Internet, can catch the message of PAP agreement by message analysis in network, thereby can know the account number and the password of subscriber dialing.According to this principle, the present invention utilizes dialup client program when dialing the user, makes the broadband router that links to each other with user computer obtain user's dialing information, when computer powers on once more, broadband router is according to the dialing again automatically of these information, with the computer access network.
When using broadband router, if the user surfs the Net by telephone wire, then the WAN mouth of router and the LAN mouth of Modem (modulator-demodulator) are linked to each other, the computer network interface card is connected any one LAN mouth of router; If by the netting twine online, then netting twine is directly connected to the WAN mouth of router.
In order to make those skilled in the art person understand the present invention program better, the present invention is described in further detail below in conjunction with drawings and embodiments.
With reference to Fig. 2, Fig. 2 shows the realization flow of the inventive method, may further comprise the steps:
Step 201: set up PPP dialup client program on computers.
Adopt the dialup client program of ppp protocol that PPPoE, PPTP and L2TP etc. are arranged usually, mainly use PPPoE dialup client program to carry out dial-up access at home.
PPP dialup client program is concrete, and to set up process same as the prior art, can create under PC operating system, also the dialer software that can use ISP (service provider) such as telecommunications, Netcom to provide is directly moved installation procedure, after finishing, dispose its account and password and get final product.
Step 202: when starting PPP dialup client program, the broadband router that links to each other with computer is caught user's dialing information.
Usually, the default setting of broadband router is surfed the Net for the DHCP mode, when the user adopts the DHCP mode to surf the Net, after the networking, only need make the IP address and the same network segment of broadband router LAN port address of user's PC, the user just can be by the WAN mouth IP address visit Internet of this broadband router.
But the front is mentioned, and generally adopts the PPP dialing for family and some SME users in last network process.Therefore, in the present invention, when the broadband router dial mode is a default DHCP mode and when not disposing wide area network WAN port address, its local area network (LAN) LAN mouth is changeed the message that the WAN mouth goes out monitor.
If broadband router has listened to the ppp protocol message, what show then that the user adopts is the online of PPP dial mode, this moment broadband router automatically its dial mode be set to the PPP dial mode.
When the broadband router dial mode is a PPP mode and when not disposing dial-up account name and password, its LAN mouth is changeed the message that the WAN mouth goes out monitor, obtain user's dialing information.These dialing informations comprise: user the surf the Net account name and the password of usefulness if adopt PPTP agreement or L2TP agreement, also comprise the information such as IP address of initial ip address and Server.
Equally, if the broadband router dial mode is the PPP mode, but when having obtained dial-up account name and password information such as (such as passing through manual configuration), then the LAN mouth being changeed the message that the WAN mouth goes out does not need to monitor again.
Step 203: after computer rolled off the production line, broadband router dialled automatically according to the user's who catches dialing information, set up being connected of this computer and network.
In order to understand the monitoring testing process of broadband router better, respectively Ether frame form and ppp protocol frame format are described below message.
The Ether frame form is as shown in table 1 below:
Table 1:
DA |
SA |
Type |
Data |
48bits |
48bits |
16bits |
46-1500bytes |
Wherein, DA represents destination address; SA is a source address;
Type represents the protocol type of Ethernet bearing:
Such as, 0x0800 represents the IP protocol data;
0x0806 represents ARP (address resolution protocol) agreement;
0x8863 is the PPPoE Discovery code in (discovery) stage;
0x8864 is the code in PPPoE Session (session) stage etc.;
Data represents data carried by data.
The ppp protocol frame format is as shown in table 2 below:
Table 2:
Flag |
Address |
Control |
Protocol |
Information |
FCS |
Flag |
01111110 |
11111111 |
00000011 |
8/16bits |
|
16bits |
01111110 |
Wherein, Flag represents the initial of frame or finishes, is made of binary sequence 01111110;
Address comprises binary sequence 11111111, the standard broadcasting address, and PPP does not distribute individual station address;
Control is a binary sequence 00000011, requires user data transmission to adopt unordered frame;
Protocol is used to discern the agreement of the Information field encapsulation of frame:
0xc023 represents the code of PAP agreement; 0xc223 represents the code of CHAP agreement;
Information is 0 or multibyte more, comprises the protocol datagram of appointment in the protocol field;
FCS is Frame Check Sequence (FCS) field, is generally 16, and the execution of PPP can improve the error detection occurs effect by 32 FCS of agreement employing in advance.
PAP is a kind of LCP that ppp protocol is concentrated, and provides the straightforward procedure of a kind of foundation of peer node authentication by using secondary to shake hands, and is to be based upon on the definite basis of initial link circuit.After finishing link establishment phase, peer node continues to repeat to send user name, password to the verifier, meets with a response or connection termination until authentication.PAP is not a kind of strong effectively authentication method, and its password sends on link with text formatting, for eavesdropping, playback or repeated attempt and wrong the attack without any protection.
The PAP protocol frame format is as shown in table 3 below:
Table 3:
Wherein, Code is used to discern the PAP type of data packet.PAP Code field distribution is as follows:
0x01-Authenticate Request (authentication request);
0x02-Authenticate ACK (authenticate-acknowledge);
0x03-Authenticate NAK (authenticating non-affirmation);
Identifier is used to mate Request and ACK;
Length is used to represent the length of PAP packet, comprises Code, Identifier, Length and Data field;
Data is 0 or multibyte more.The Data field format depends on the Code field.
The protocol stack form of PPPoE, PPTP, L2TP as shown in Figure 3.
Fig. 4 shows broadband router changes the realization flow that message that the WAN mouth goes out is monitored to the LAN mouth:
Step 401: broadband router obtains the LAN mouth changes the message that the WAN mouth is gone out.
Step 402: whether the protocol fields of analyzing in this message is PPP session stage message.If then enter step 403; Otherwise, enter step 404.
According to the Ether frame form in the above-mentioned table 1 as can be known, when Type was 0x8863, expression was the PPPoEDiscovery code in (discovery) stage; When Type was 0x8864, expression was the PPPoE Session code in (session) stage.
Therefore, protocol field value is 0x8864 in the Ether frame in case broadband router detects, and then message is carried out the PPPoE protocal analysis.
Step 403: carry out the ppp protocol handling process, obtain the account name and the encrypted message of user's online.Specifically how obtaining these information according to the ppp protocol handling process will be described in detail later.
Step 404: judge further whether this message is the IP message.According to the Ether frame form in the above-mentioned table 1 as can be known, when Type was 0x0800, expression was the IP protocol data.If then enter step 405; Otherwise, enter step 411.
Step 405: judge further whether this message is the UDP message.If then enter step 406; Otherwise, enter step 408.
With reference to an IP shown in Figure 5 form, wherein, protocol fields has been represented the protocol type that the IP packet adopts.Can judge the protocol type of IP packet according to the value of this field.If be 0x2f, then be expressed as GRE (generic route encapsulation) message, if be 0x11, then be expressed as UDP (User Datagram Protocol) message.
Step 406: further judge whether message into L2TP (Layer 2 Tunneling Protocol).If then enter step 407; Otherwise, enter step 411.
Step 407: carry out the L2TP handling process, obtain user's internet information.Specifically how obtaining these information according to the L2TP handling process will be described in detail later.
Step 408: judge further whether this message is the GRE message.If then enter step 409; Otherwise, enter step 411.
Step 409: further judge whether message into PPP.If then enter step 410; Otherwise, enter step 411.
Step 410: carry out the PPTP handling process, obtain user's internet information.
Step 411: abandon this message.
This shows, broadband router is monitored by the message that LAN mouth commentaries on classics WAN mouth is gone out, protocol fields in this message of bed-by-bed analysis, can know the protocol type of this message, if PPP session stage message or L2TP protocol massages or PPTP message, then can obtain user's internet information by the message content in the corresponding protocol processing flow process.
Describe PPPoE, L2TP, PPTP message analysis handling process below respectively in detail.
The detailed process of PPPoE dialing is (pap authentication mode, IPCP (IP control protocol) negotiations process is different because of IP, the DNS contents such as (name servers) of device request) as shown in Figure 6:
The dialing of PPPoE is divided into two stage: Discovery (discovery) stages and Session (session) stage.Look on the bright side of things the beginning during pppoe session when a main frame, and it must at first carry out the ethernet mac address of discovery stage with the identification opposite end, and sets up a PPPoE Session_ID.In the discovery stage, based on network topology, main frame can be found a plurality of PPPoE servers.The discovery stage allows main frame to find all PPPoE servers, selects one of them then.After completing successfully, just enters the negotiation phase of PPP in the discovery stage, be the Session stage, this stage main frame and selecteed PPPoE server carry out the ECHO wireline inspection after LCP (LCP) negotiation, Authentication (authentication) authentication, authentication, ipcp negotiation and the successful connection.
Protocol fields is during for 0xc023 (PAP agreement code) in detecting the PPP message, then message is further analyzed, simultaneously the source MAC of recorded message, the Session ID of this PPPoE dialing and the Identifier (sign) of PPP; Otherwise abandon analysis to this message.
Then, detect the code field in the PAP message, following several situation arranged:
(1) code:0x01, this message are the pap authentication request message, then need write down peer-ID (account number) and Password (password); Write down source MAC (medium access control), the SessionID of corresponding PPPoE and the Identifier of PPP simultaneously;
(2) code:0x02, this message is the pap authentication confirmation message, whether the source MAC, the Session ID that mate purpose MAC, the Session ID of this message and authentication request packet be consistent with Identifier; As unanimity, then dispose the broadband router username and password; If any one inconsistent, then continue to wait for authentication response message; As receive and PPP LCP Termination Request (stop request) or PADT (PPPoE activates and the finds end of packet) message of same Session ID then discharge resource, wait for dialing again;
(3) code:0x03, this message are pap authentication failure message and purpose MAC, Session ID and Identifier coupling, discharge resource, wait for dialing again; If any one inconsistent, then continue to wait for authentication response message; As receive and PPP LCP Termination Request or the PADT message of same Session ID then discharge resource, wait for dialing again.
L2TP is used for integrating the multi-protocols dial-up service to existing ISP's point.Provide passage (Tunnel) transmission of ppp link layer data bag has been supported, allowed two layers of link end points and PPP session point to reside on the distinct device, and adopt the packet network technology to carry out information interaction, thereby expanded the PPP model.PPP has defined an encapsulation mechanism of multi-protocols leap second layer point-to-point link.Especially, the user is connected to network access server (NAS) by using one of numerous technology (as: dialing POTS (plain old telephone service), ISDN (integrated services digital network), ADSL (asymmetric digital subscriber line) etc.) to obtain the second layer, moves PPP then on this connects.
The call setup flow process of L2TP Tunnel is as shown in Figure 7:
1. the client foundation that makes a call;
2. the client and server end carries out PPP LCP (ppp link control protocol) negotiation;
3. user end to server is initiated pap authentication;
4. authentication is passed through, and server sends authentication to client and passes through message;
5. the client and server end carries out PPP NCP (PPP Network Control Protocol) negotiation;
6. consult to pass through, the tunnel is set up.
By this flow process as seen, broadband router can detect by the message that following process is gone out to its LAN mouth commentaries on classics WAN mouth:
In detecting IP bag carrying be udp protocol the time, whether what then further analyze carrying in the UDP bag is the L2TP protocol package; If whether what then further analyze carrying in the L2TP bag is the ppp protocol bag; If whether what then further analyze carrying in the PPP bag is the PAP protocol package.When the message (0xc023) that detects to the PPP session stage, then further analyze code field in the PAP message:
(1) code:0x01, this message are the pap authentication request message, then need write down peer-ID (account number) and Password (password); Write down source IP, the purpose IP of corresponding L2TP and the Identifier of PPP simultaneously;
(2) code:0x02, this message is the pap authentication confirmation message, whether the purpose Identifier that mates this message is consistent; As unanimity, then dispose broadband router user name, password, initial IP and Server IP; If any one inconsistent, then continue to wait for authentication response message; As receive PPP LCP Termination Request (the stopping request) message that same L2TP Server sends, and then discharge resource, wait for dialing again;
(3) code:0x03, this message are pap authentication failure message and purpose IP and Identifier coupling, discharge resource, wait for dialing again; If any one inconsistent, then continue to wait for authentication response message; As receive PPP LCP Termination Request message, and then discharge resource, wait for dialing again.
PPTP (PPTP) agreement is a kind of agreement of supporting the multi-protocols VPN (virtual private network), by this agreement, the long-distance user can cross over PC operating system and the common network of other point-to-point activation system secure access, and by the common network on dialing they Internet of secure link of local ISP.PPTP supports the tunnel encapsulation of ppp protocol on IP network, and PPTP calls out control and management agreement as one, uses GRE (generic route encapsulation) technology that strengthens that the packing service of Flow Control and congested control is provided for the PPP message of transmission.
When protocol fields is 0xc023 (PAP agreement code) in detecting the PPP message, then message is further analyzed, simultaneously the Identifier (sign) of the source IP address of recorded message, purpose IP address, PPP; Otherwise abandon analysis to this message.
Then, detect the code field in the PAP message, following several situation arranged:
(1) code:0x01, this message are the pap authentication request message, then need write down peer-ID (account number) and Password (password); Write down source IP, the purpose IP of corresponding PPTP and the Identifier of PPP simultaneously;
(2) code:0x02, this message is the pap authentication confirmation message, whether the purpose Identifier that mates this message is consistent; As unanimity, then dispose broadband router user name, password, initial IP and Server IP; If any one inconsistent, then continue to wait for authentication response message; As receive PPP LCP Termination Request (stopping request) or the STOP-Control-Connetion-Request message that same PPTP Server sends, and then discharge resource, wait for dialing again;
(3) code:0x03, this message are pap authentication failure message and purpose IP and Identifier coupling, discharge resource, wait for dialing again; If any one inconsistent, then continue to wait for authentication response message; As receive PPP LCPTermination Request or STOP-Control-Connetion-Request message, and then discharge resource, wait for dialing again.
As seen, the present invention is by PPP (PPPoE, PPTP, the L2TP etc.) dialing of PC in the local area network (LAN), in broadband router to the analysis of association message, make broadband router that account number, password and the relevant dialing information of dialing are set automatically, thereby make the user can realize that broadband router is not had the just addressable Internet of operation, demonstrated fully intellectuality, convenient for users to use.
Though described the present invention by embodiment, those of ordinary skills know, the present invention has many distortion and variation and do not break away from spirit of the present invention, wish that appended claim comprises these distortion and variation and do not break away from spirit of the present invention.