CN108667672A - A kind of automatic adaptation method and router of LAN interface and wan interface - Google Patents

A kind of automatic adaptation method and router of LAN interface and wan interface Download PDF

Info

Publication number
CN108667672A
CN108667672A CN201810606986.5A CN201810606986A CN108667672A CN 108667672 A CN108667672 A CN 108667672A CN 201810606986 A CN201810606986 A CN 201810606986A CN 108667672 A CN108667672 A CN 108667672A
Authority
CN
China
Prior art keywords
interface
physical network
network interface
pppoe
router
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810606986.5A
Other languages
Chinese (zh)
Inventor
谢奕勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Feixun Information Technology Co Ltd
Original Assignee
Sichuan Feixun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Feixun Information Technology Co Ltd filed Critical Sichuan Feixun Information Technology Co Ltd
Priority to CN201810606986.5A priority Critical patent/CN108667672A/en
Publication of CN108667672A publication Critical patent/CN108667672A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • H04L41/0816Configuration setting characterised by the conditions triggering a change of settings the condition being an adaptation, e.g. in response to network events

Abstract

The present invention provides the automatic adaptation method and router of a kind of LAN interface and wan interface, method includes:Whether the connection status for monitoring the physical network interface of router changes;If the connection status of the physical network interface changes, according to the IP configuration modes of wan interface and the connection client information of the physical network interface, the LAN interface and wan interface of the router are identified;It is that the LAN interface and the wan interface are configured to call configurator.The present invention can be wan interface or LAN interface with what is connected on automatic identification physical network interface, by configuring accordingly, it is ensured that user can normally surf the Internet.

Description

A kind of automatic adaptation method and router of LAN interface and wan interface
Technical field
The present invention relates to router field, the automatic adaptation method and router of espespecially a kind of LAN interface and wan interface.
Background technology
With the arrival of the Internet of things era, network has become the essential part of people's life, is using network When, people often use router.Router can provide multiple network interfaces, and can provide wireless network, very Ground is convenient.
Router interface wiring currently on the market is divided into Wan interfaces and Lan interfaces.Wan interface must connect WAN dialing nets Line, LAN interface must connect using equipment.Before using router, need correctly to connect wan interface and LAN interface, wrong is then It can lead to not normally surf the Internet.And for many ordinary users, their concepts completely without LAN interface and wan interface, even During connecing cable, it is more likely that cause to perplex to user, influence the normal use of router.
To solve the above-mentioned problems, the present invention provides the automatic adaptation methods and routing of a kind of LAN interface and wan interface Device.
Invention content
The object of the present invention is to provide the automatic adaptation methods and router of a kind of LAN interface and wan interface, can be automatic What is connected on identification physical network interface is wan interface or LAN interface, by being configured accordingly, it is ensured that user can Normal online.
Technical solution provided by the invention is as follows:
The present invention provides the automatic adaptation methods of a kind of LAN interface and wan interface, including step:Monitor router Whether the connection status of physical network interface changes;If the connection status of the physical network interface changes, root According to the IP configuration modes of wan interface and the connection client information of the physical network interface, the LAN of the router is identified Interface and wan interface;It is that the LAN interface and the wan interface are configured to call configurator.
Preferably, according to the IP configuration modes of wan interface and the connection client information of the physical network interface, identification Go out the LAN interface and wan interface of the router, this step specifically includes:If the IP configuration modes of wan interface are matched for static IP Mode is set, then whether detects the connecting pin of the physical network interface of the router with the presence of gateway;If the physical network connects The connecting pin of mouth is with the presence of gateway, then using the physical network interface as wan interface, otherwise, by the physical network interface As LAN interface.
Preferably, according to the IP configuration modes of wan interface and the connection client information of the physical network interface, identification Go out the LAN interface and wan interface of the router, this step further includes specifically:If the IP configuration modes of wan interface are dynamic IP Configuration mode, then according to PPPOE agreements, the connecting pin for detecting the physical network interface of the router takes with the presence or absence of PPPOE It is engaged in device, and whether the physical network interface with PPPOE servers establishes PPPOE sessions;If the physical network of the router There are PPPOE servers for the connecting pin of interface, and the physical network interface establishes PPPOE sessions with PPPOE servers, then will The physical network interface is as wan interface, otherwise, using the physical network interface as LAN interface;
And/or;
If the IP configuration modes of the wan interface selected are dynamic IP configuration mode, according to DHCP protocol, the road is detected By device physical network interface connecting pin whether there is Dynamic Host Configuration Protocol server, and the physical network interface whether with DHCP service Device establishes DHCP sessions;If the connecting pin of the physical network interface of the router is there are Dynamic Host Configuration Protocol server, and the Physical Network Network interface establishes DHCP sessions with Dynamic Host Configuration Protocol server, then using the physical network interface as wan interface, otherwise, by the object Network interface is managed as LAN interface.
Preferably, according to PPPOE agreements, the connecting pin for detecting the physical network interface of the router whether there is PPPOE servers, and whether the physical network interface with PPPOE servers establishes PPPOE sessions, this step specifically includes: According to PPPOE agreements, PPPOE servers are broadcasted to connecting pin by the physical network interface of the router and inquire data packet; If there are service available at least one PPPOE servers for the connecting pin, replied according at least one PPPOE servers PPPOE server response data packets, select one of PPPOE servers as target PPPOE servers, to the target PPPOE servers send PPPOE session request data packets;If the target PPPOE servers, which reply PPPOE sessions, confirms data Packet then confirms that data packet establishes PPPOE sessions with PPPOE servers according to the PPPOE sessions.
Preferably, according to DHCP protocol, the connecting pin for detecting the physical network interface of the router whether there is DHCP Server, and whether the physical network interface with Dynamic Host Configuration Protocol server establishes DHCP sessions, this step specifically includes:According to DHCP Agreement broadcasts Dynamic Host Configuration Protocol server to connecting pin by the physical network interface of the router and inquires data packet;If the connection There are service available at least one Dynamic Host Configuration Protocol server at end, then the Dynamic Host Configuration Protocol server replied according at least one Dynamic Host Configuration Protocol server Response data packet selects one of Dynamic Host Configuration Protocol server as target Dynamic Host Configuration Protocol server, is sent to the target Dynamic Host Configuration Protocol server DHCP session request data packets;If the target PPPOE servers, which reply DHCP sessions, confirms data packet, according to the DHCP Session confirms that data packet establishes DHCP sessions with Dynamic Host Configuration Protocol server.
The present invention also provides a kind of router of achievable LAN interface and wan interface automatic adaptation, it is equipped in router Multiple physical network interfaces, router include:Module is monitored, the connection status of the physical network interface for monitoring router is It is no to change;Identification module is electrically connected with the detection module, if the connection status for the physical network interface occurs Change, then according to the IP configuration modes of the wan interface of selection and the connection client information of the physical network interface, identify The LAN interface and wan interface of the router;Configuration module is electrically connected with the identification module, for calling configurator to be The LAN interface and the wan interface are configured.
Preferably, the identification module includes:Detection unit, if the IP configuration modes for wan interface are matched for static IP Mode is set, then whether detects the connecting pin of the physical network interface of the router with the presence of gateway;Processing unit, with the inspection Unit electrical connection is surveyed, if the physical network interface is made with the presence of gateway in the connecting pin for the physical network interface For wan interface, otherwise, using the physical network interface as LAN interface.
Preferably, the identification module includes:Detection unit, if the IP configuration modes for wan interface are matched for dynamic IP Mode is set, then according to PPPOE agreements, the connecting pin for detecting the physical network interface of the router is serviced with the presence or absence of PPPOE Device, and whether the physical network interface with PPPOE servers establishes PPPOE sessions;Processing unit, with detection unit electricity Connection, if the connecting pin of the physical network interface for the router there are PPPOE servers, and the physical network interface PPPOE sessions are established with PPPOE servers, then using the physical network interface as wan interface, otherwise, by the Physical Network Network interface is as LAN interface;
And/or;
The detection unit is assisted if the IP configuration modes for being additionally operable to wan interface are dynamic IP configuration mode according to DHCP View, the connecting pin for detecting the physical network interface of the router whether there is Dynamic Host Configuration Protocol server, and the physical network interface Whether with Dynamic Host Configuration Protocol server DHCP sessions are established;The processing unit, if be additionally operable to the physical network interface of the router There are Dynamic Host Configuration Protocol server for connecting pin, and the physical network interface establishes DHCP sessions with Dynamic Host Configuration Protocol server, then by the physics Network interface is as wan interface, otherwise, using the physical network interface as LAN interface.
Preferably, the identification module further includes specifically:Radio unit, for according to PPPOE agreements, passing through the routing The physical network interface of device inquires data packet to connecting pin broadcast PPPOE servers;Selecting unit, if being deposited for the connecting pin In service available at least one PPPOE servers, then according to the PPPOE servers of at least one PPPOE servers reply Response data packet selects one of PPPOE servers as target PPPOE servers;Transmission unit, with the selecting module Electrical connection, for sending PPPOE session request data packets to the target PPPOE servers;Session establishment unit, if being used for institute It states target PPPOE servers and replys PPPOE sessions confirmation data packet, then data packet and PPPOE are confirmed according to the PPPOE sessions Server establishes PPPOE sessions.
Preferably, the identification module further includes specifically:Radio unit is used for according to DHCP protocol, the router Physical network interface inquires data packet to connecting pin broadcast Dynamic Host Configuration Protocol server;Selecting unit, can if existing for the connecting pin At least one Dynamic Host Configuration Protocol server of service is provided, then the dhcp server response data replied according at least one Dynamic Host Configuration Protocol server Packet, selects one of Dynamic Host Configuration Protocol server as target Dynamic Host Configuration Protocol server, and transmission unit is electrically connected with the selecting module, uses In to the target Dynamic Host Configuration Protocol server send DHCP session request data packets;Session establishment unit, if being used for the target PPPOE Server replys DHCP sessions and confirms data packet, then confirms that data packet establishes DHCP with Dynamic Host Configuration Protocol server according to the DHCP sessions Session.
The automatic adaptation method and router of a kind of LAN interface and wan interface that provide through the invention, can bring with Lower at least one advantageous effect:
1, in the present invention, cable can be connected to any physical network interface on router by user, and router can root According to the IP configuration modes of wan interface, detect which physical network interface is wan interface with different detection methods, which object It is LAN mouthfuls to manage network interface, then configurator is called to carry out corresponding network configuration, avoids user and accidentally accesses cable LAN mouthfuls of the case where causing user that can not surf the Internet.
2, when the IP configuration modes of wan interface are static IP configuration mode, each physical network interface is detected by arp Connecting pin can judge whether this physical network interface is wan interface with the presence or absence of gateway, accuracy is very high.
3, when the IP configuration modes of wan interface are dynamic IP configuration mode, due to wan interface and Dynamic Host Configuration Protocol server or PPPOE servers establish session and could normally surf the Internet, therefore the connecting pin by detecting each physical network interface whether there is PPPOE servers or Dynamic Host Configuration Protocol server can be accurately judged to the wan interface in physical network interface and LAN interface.
Description of the drawings
Below by a manner of clearly understandable, preferred embodiment is described with reference to the drawings, a kind of LAN interface is connect with WAN The automatic adaptation method of mouth and above-mentioned characteristic, technical characteristic, advantage and its realization method of router are further described.
Fig. 1 is the flow chart of one embodiment of the automatic adaptation method of a kind of LAN interface of the present invention and wan interface;
Fig. 2 is the flow chart of another embodiment of the automatic adaptation method of a kind of LAN interface of the present invention and wan interface;
Fig. 3 is a kind of knot of the present invention achievable LAN interface and one embodiment of the router of wan interface automatic adaptation Structure schematic diagram.
Fig. 4 is a kind of another embodiment of the present invention achievable LAN interface and the router of wan interface automatic adaptation Structural schematic diagram.
Drawing reference numeral explanation:
1- monitors module, 2- identification modules, 21- detection units, 22- processing units, 23- radio units, 24- selection lists Member, 25- transmission units, 26- session establishments unit, 3- configuration modules.
Specific implementation mode
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, control is illustrated below The specific implementation mode of the present invention.It should be evident that drawings in the following description are only some embodiments of the invention, for For those of ordinary skill in the art, without creative efforts, other are can also be obtained according to these attached drawings Attached drawing, and obtain other embodiments.
To make simplified form, part related to the present invention is only schematically shown in each figure, they are not represented Its practical structures as product.In addition, so that simplified form is easy to understand, there is identical structure or function in some figures Component only symbolically depicts one of those, or has only marked one of those.Herein, "one" is not only indicated " only this ", can also indicate the situation of " more than one ".
The present invention provides one embodiment of a kind of LAN interface and the automatic adaptation method of wan interface, as shown in Figure 1, Including:
Whether the connection status of the physical network interface of S1 monitoring routers changes;
If the connection status of the S2 physical network interfaces changes, according to the IP configuration modes of wan interface, and The connection client information of the physical network interface identifies the LAN interface and wan interface of the router;
It is that the LAN interface and the wan interface are configured that S3, which calls configurator,.
Specifically, user is when using router, it is necessary first to subscriber line are connected to wan interface, equipment end is connected Wiring is connected to LAN interface, and carries out corresponding wan interface, LAN interface with postponing and could use.But for many users For, they are not aware that is wan interface, what is LAN interface, and not only need connected with network cable on router, also have Several piece-root graftings often will appear the case where false wiring causes user that can not surf the Internet to the connecting line of equipment end.
In the present embodiment, whether the connection status that router can monitor physical network interface in real time changes, general next It says, in use, if user will not plug cable again, the connection status of the physical network interface of router is or not router It will appear change;But when plug connects router cable again during First Contact Connections router or use, then or When person user restarts router, the connection status of the physical network interface of router will change, at this point, router The connecting pin of physical network interface can be identified by different methods according to the IP configuration modes of pre-set wan interface Whether there is network data transmission, identifies which physical network interface is wan interface with this, which physical network interface is LAN interface.Since general home router is 2 LAN interface of 1 wan interface, 4 LAN interface or 1 wan interface, because This, identifies 1 wan interface, remaining physical network interface is it may determine that be LAN interface.
After identifying wan interface and LAN interface, it is only necessary to pass through the configuration file in openwrt
/ etc/config/network, you can set physical network interface to wan interface and LAN interface.
If the connection status of the physical network interface of router does not change, illustrate that each physical network of router connects The network connection that mouth is connect does not change, and need not reconfigure new wan interface and LAN interface, directly continue to use and go through The wan interface and LAN interface of history.
As shown in Fig. 2, the present invention also provides an implementations of a kind of LAN interface and the automatic adaptation method of wan interface Example, including:
Whether the connection status of the physical network interface of S1 monitoring routers changes;
If the IP configuration modes of S21 wan interfaces are static IP configuration mode, the physical network for detecting the router connects Whether the connecting pin of mouth is with the presence of gateway;
If the connecting pin of the S22 physical network interfaces connects the physical network interface as WAN with the presence of gateway Mouthful, otherwise, using the physical network interface as LAN interface;
If the IP configuration modes of S231 wan interfaces are dynamic IP configuration mode detects the road according to PPPOE agreements PPPOE servers whether there is by the connecting pin of the physical network interface of device, and whether the physical network interface takes with PPPOE Business device establishes PPPOE sessions;
The connecting pin of the physical network interface of the detection router in step S231 whether there is PPPOE servers, And the method that the physical network interface establishes PPPOE sessions with PPPOE servers specifically includes:According to PPPOE agreements, pass through The physical network interface of the router inquires data packet to connecting pin broadcast PPPOE servers;It can if the connecting pin exists At least one PPPOE servers of service are provided, then are responded according to the PPPOE servers that at least one PPPOE servers are replied Data packet selects one of PPPOE servers as target PPPOE servers, is sent to the target PPPOE servers PPPOE session request data packets;If the target PPPOE servers, which reply PPPOE sessions, confirms data packet, according to PPPOE sessions confirm that data packet establishes PPPOE sessions with PPPOE servers.
If the connecting pin of the physical network interface of the S241 routers is there are PPPOE servers, and the physical network Whether interface with PPPOE servers establishes PPPOE sessions, then using the physical network interface as wan interface, otherwise, by institute Physical network interface is stated as LAN interface;
And/or;
If the IP configuration modes for the wan interface that S232 is selected are dynamic IP configuration mode, according to DHCP protocol, institute is detected State the physical network interface of router connecting pin whether there is Dynamic Host Configuration Protocol server, and the physical network interface whether with DHCP Server establishes DHCP sessions;
According to DHCP protocol in step S232, the connecting pin for detecting the physical network interface of the router whether there is Dynamic Host Configuration Protocol server, and whether the method for establishing DHCP sessions with Dynamic Host Configuration Protocol server specifically includes the physical network interface:According to DHCP protocol broadcasts Dynamic Host Configuration Protocol server to connecting pin by the physical network interface of the router and inquires data packet;If described There are service available at least one Dynamic Host Configuration Protocol server for connecting pin, then are taken according to the DHCP that at least one Dynamic Host Configuration Protocol server is replied Business device response data packet, selects one of Dynamic Host Configuration Protocol server as target Dynamic Host Configuration Protocol server, to the target Dynamic Host Configuration Protocol server Send DHCP session request data packets;If the target PPPOE servers, which reply DHCP sessions, confirms data packet, according to DHCP sessions confirm that data packet establishes DHCP sessions with Dynamic Host Configuration Protocol server.
If there are Dynamic Host Configuration Protocol server for the connecting pin of the physical network interface of the S242 routers, and the physical network connects Mouth establishes DHCP sessions with Dynamic Host Configuration Protocol server, then using the physical network interface as wan interface, otherwise, by the Physical Network Network interface is as LAN interface.
It is that the LAN interface and the wan interface are configured that S3, which calls configurator,.
Specifically, router is on startup, the connection status of the physical network interface of router can become from not-connected status It is connected status or user when plugging cable again, the connection status of physical network interface can also change.Routing Device can mark off the Port interfaces of corresponding number according to the number of physical network interface.The ports processes of router can be with road Started by the startup of device, if before router startup, cable is already inserted into router, since the down/up events of Ethernet exist Ports application processes have been sent from before starting, and ports application processes can not receive down/up events, need port process masters It is dynamic to remove detecting wan interface and LAN interface.
If the IP configuration modes of the wan interface of router are static IP configuration mode, router can be detected by arp orders The connecting pin for being connected to physical network interface whether there is gateway;If with the presence of gateway, illustrate what this connecting pin should connect Wan interface, router can be using the physical network interfaces that this connecting pin is connected to as wan interface, remaining physical network interface As LAN interface.
If the IP configuration modes of the wan interface of router are dynamic IP configuration mode, and are router meeting when dialling up on the telephone By the port interface process distributed for each physical network interface, according to PPPOE (Point to PointProtocol Over Ethernet, the point-to-point protocol based on Ethernet) agreement, in a broadcast manner to the connecting pin of physical network interface Broadcast PPPOE servers inquiry data packet, i.e. PADI (Active Discovery Initiation) data packet, PADI numbers According to the service for including client request.If what interface end connect is the ends PC, there is no the responses of PPPOE servers, if connecing Mouthful end is connected to cable, then may have multiple PPPOE servers, these PPPOE servers receive PADI data packets it Afterwards, if corresponding service can be provided, PPPOE server response data packets, i.e. PADO (Active Discovery can be replied Offer) data packet.
Since PADI data packets are that router is sent in the form of broadcasting, router may receive more than one A PADO data packets, it will examine all PADO data packets received and according to server name therein or the service provided It selects a PPPOE server as target PPPOE servers, and PPPOE sessions is sent to the target PPPOE servers chosen Request data package, i.e. PADR (PPPoE Active Discovery Request) data packet, PADR data packets include client Requested service.After target PPPOE server interfaces to PADR data packets, corresponding PPPOE sessions can be replied and confirm data Packet, i.e. PADS (Active Discovery Session-confirmation) data packet, router is then according to PADS data packets PPPOE sessions are established with target PPPOE servers.
Entire Active Discover processes are completed at this time, and physical network interface enters STATE_SESSION states, then Illustrating the physical network interface, there are PPPOE servers, then by the physical network interface as Wan interfaces, and by remaining object Network interface is managed as LAN interface.Otherwise, then using the physical network interface as LAN interface, continue to judge next physical network Whether interface is wan interface.
If the IP configuration modes of the wan interface of router be dynamic IP configuration mode, and for automatic IP address allocation when, road It can be by the port interface process distributed for each physical network interface, according to DHCP (Dynamic Host by device ConfigurationProtocol, dynamic host configuration protocol) agreement, in a broadcast manner to the connection of physical network interface End broadcast Dynamic Host Configuration Protocol server inquires data packet, i.e. DHCP discover data packets, and DHCP service is found to find information with this Device.
Receiving the Dynamic Host Configuration Protocol server of Dynamic Host Configuration Protocol server inquiry data packet (DHCP discover) in a network can all make Response, it selects one from still unappropriated IP address and distributes to router, and an IP for including distribution is sent to router The dhcp server response data packet (DHCP offer) of address and other settings.
After router receives the information of dhcp server response data packet offer, one of Dynamic Host Configuration Protocol server is selected As target Dynamic Host Configuration Protocol server, then DHCP session request data packets are sent to target Dynamic Host Configuration Protocol server in a broadcast manner (DHCP request), DHCP session request data packets include the interior of the selected Dynamic Host Configuration Protocol server IP address requesting of router Hold.
After Dynamic Host Configuration Protocol server receives the DHCP session request data packets of router reply, one will be sent to router The DHCP sessions of a IP address provided comprising it and other settings confirm data packet, and router is told it can be used to provide IP address.Then, for router just by its ICP/IP protocol and network card binding, router establishes DHCP with target Dynamic Host Configuration Protocol server Session.
If entire DHCP Discover processes are completed, the connecting pin of the physical network interface of the router exists Dynamic Host Configuration Protocol server, and the physical network interface establishes DHCP sessions with Dynamic Host Configuration Protocol server, then makees the physical network interface For wan interface, otherwise, using the physical network interface as LAN interface.
The present invention provides one embodiment of a kind of achievable LAN interface and the router of wan interface automatic adaptation, such as Shown in Fig. 3, including:
Module 1 is monitored, for monitoring whether the connection status of physical network interface of router changes;
Identification module 2 is electrically connected with the detection module, if the connection status for the physical network interface becomes More, then institute is identified according to the IP configuration modes of the wan interface of selection and the connection client information of the physical network interface State the LAN interface and wan interface of router;
Configuration module 3 is electrically connected with the identification module 2, is the LAN interface and described for calling configurator Wan interface is configured.
Specifically, user is when using router, it is necessary first to subscriber line are connected to wan interface, equipment end is connected Wiring is connected to LAN interface, and carries out corresponding wan interface, LAN interface with postponing and could use.But for many users For, they are not aware that is wan interface, what is LAN interface, and not only need connected with network cable on router, also have Several piece-root graftings often will appear the case where false wiring causes user that can not surf the Internet to the connecting line of equipment end.
In the present embodiment, whether the connection status that the monitoring module 1 of router can monitor physical network interface in real time occurs Change, in general, router in use, if user will not plug cable, the physical network interface of router again Connection status be not in change;But plug connects router again during First Contact Connections router or use When cable, then user restart router when, the connection status of the physical network interface of router will change, At this point, the identification module 2 in router can be known according to the IP configuration modes of pre-set wan interface by different methods Whether the connecting pin for not going out physical network interface has network data transmission, identifies which physical network interface is WAN with this Interface, which physical network interface are LAN interface.Since general home router is 1 wan interface, 4 LAN interface or 1 Therefore 2 LAN interface of a wan interface identify 1 wan interface, remaining physical network interface for LAN it may determine that connect Mouthful.
After identifying wan interface and LAN interface, configuration module 3 only need by the configuration file in openwrt/ Etc/config/network, you can set physical network interface to wan interface and LAN interface.
As shown in figure 4, the present invention also provides the routers of a kind of achievable LAN interface and wan interface automatic adaptation One embodiment, multiple physical network interfaces are equipped in router, and the router includes:
Module 1 is monitored, for monitoring whether the connection status of physical network interface of router changes;
Identification module 2 is electrically connected with the detection module, if the connection status for the physical network interface becomes More, then institute is identified according to the IP configuration modes of the wan interface of selection and the connection client information of the physical network interface State the LAN interface and wan interface of router;
Radio unit 23, for according to PPPOE agreements, being broadcasted to connecting pin by the physical network interface of the router PPPOE servers inquire data packet;
Selecting unit 24, if there are service available at least one PPPOE servers, bases for the connecting pin The PPPOE server response data packets that at least one PPPOE servers are replied, select one of PPPOE servers as mesh Mark PPPOE servers;
Transmission unit 25 is electrically connected with the selecting module, for sending PPPOE meetings to the target PPPOE servers Talk about request data package;
Session establishment unit 26, if replying PPPOE sessions for the target PPPOE servers confirms data packet, root Confirm that data packet establishes PPPOE sessions with PPPOE servers according to the PPPOE sessions.
Detection unit 21 detects the router if the IP configuration modes for wan interface are static IP configuration mode Physical network interface connecting pin whether with the presence of gateway;
Processing unit 22 is electrically connected with the detection unit 21, if there is net in the connecting pin for the physical network interface It closes and exists, then using the physical network interface as wan interface, otherwise, using the physical network interface as LAN interface.
And/or;
Radio unit 23, for broadcasting DHCP to connecting pin according to the physical network interface of DHCP protocol, the router Server inquires data packet;
Selecting unit 24, if there are service available at least one Dynamic Host Configuration Protocol server, bases for the connecting pin The dhcp server response data packet that at least one Dynamic Host Configuration Protocol server is replied, selects one of Dynamic Host Configuration Protocol server as target Dynamic Host Configuration Protocol server,
Transmission unit 25 is electrically connected with the selecting module, for sending DHCP sessions to the target Dynamic Host Configuration Protocol server Request data package;
Session establishment unit 26, if replying DHCP sessions for the target PPPOE servers confirms data packet, basis The DHCP sessions confirm that data packet establishes DHCP sessions with Dynamic Host Configuration Protocol server.
The detection unit 21, if the IP configuration modes for being additionally operable to wan interface are dynamic IP configuration mode, according to DHCP Agreement, the connecting pin for detecting the physical network interface of the router whether there is Dynamic Host Configuration Protocol server, and the physical network connects Mouthful whether with Dynamic Host Configuration Protocol server establish DHCP sessions;
The processing unit 22, if being additionally operable to the connecting pin of the physical network interface of the router, there are DHCP services Device, and the physical network interface establishes DHCP sessions with Dynamic Host Configuration Protocol server, then connects the physical network interface as WAN Mouthful, otherwise, using the physical network interface as LAN interface.
Specifically, router is on startup, the connection status of the physical network interface of router can become from not-connected status For connected status, router can mark off the Port interfaces of corresponding number according to the number of physical network interface.Router Ports processes can start with the startup of router, if before router startup, cable is already inserted into router, due to ether The down/up events of net have been sent from before the startup of ports application processes, and ports application processes can not receive down/up things Part needs port processes actively to remove detecting wan interface and LAN interface.
If the IP configuration modes of the wan interface of router are static IP configuration mode, router can be detected by arp orders The connecting pin for being connected to physical network interface whether there is gateway;If with the presence of gateway, illustrate what this connecting pin should connect Wan interface, router can be using the physical network interfaces that this connecting pin is connected to as wan interface, remaining physical network interface As LAN interface.
If the IP configuration modes of the wan interface of router are dynamic IP configuration mode, and are router meeting when dialling up on the telephone By the port interface process distributed for each physical network interface, according to PPPOE (Point to Point Protocol Over Ethernet, the point-to-point protocol based on Ethernet) agreement, radio unit 23 can be to the connecting pin of physical network interface Broadcast PPPOE servers inquiry data packet, i.e. PADI (Active Discovery Initiation) data packet, PADI numbers According to the service for including client request.If what if interface end connect is the ends PC, there is no the corresponding of PPPOE servers, If interface end is connected to cable, there may be multiple PPPOE servers, these PPPOE servers receive PADI data After packet, if corresponding service can be provided, PPPOE server response data packets, i.e. PADO (Active can be replied Discovery Offer) data packet.
Since PADI data packets are that router is sent in the form of broadcasting, router may receive more than one A PADO data packets, selecting unit 24 will examine all PADO data packets received and according to server name therein or carried The service of confession selects a PPPoE server as target PPPOE servers, and by transmission unit 25 to the target chosen PPPOE servers send PPPOE session request data packets, i.e. PADR (PPPoEActive Discovery Request) data Packet, PADR data packets include the requested service of client.After target PPPOE server interfaces to PADR data packets, it can reply Corresponding PADS (Active Discovery Session-confirmation) data packet, the reply in router are established single Member 26 then establishes PPPOE sessions according to PADS data packets and target PPPOE servers.Entire Active Discover mistakes at this time Journey is completed, and physical network interface enters STATE_SESSION states, then illustrates the physical network interface there are PPPOE servers, Then by the physical network interface as Wan interfaces, and using remaining physical network interface as LAN interface.Otherwise, then by the object Network interface is managed as LAN interface, continues to judge whether next physical network interface is wan interface.
If the IP configuration modes of the wan interface of router be dynamic IP configuration mode, and for automatic IP address allocation when, road It can be by the port interface process distributed for each physical network interface, according to DHCP (Dynamic Host by device ConfigurationProtocol, dynamic host configuration protocol) agreement, by radio unit 23 in a broadcast manner to physics The connecting pin broadcast Dynamic Host Configuration Protocol server of network interface inquires data packet, i.e. DHCP discover data packets, and information is found with this To find Dynamic Host Configuration Protocol server.
Receiving the Dynamic Host Configuration Protocol server of Dynamic Host Configuration Protocol server inquiry data packet (DHCP discover) in a network can all make Response, it selects one from still unappropriated IP address and distributes to router, and an IP for including distribution is sent to router The dhcp server response data packet (DHCP offer) of address and other settings.
After router receives the information of dhcp server response data packet offer, wherein by the selection of selecting unit 24 Then one Dynamic Host Configuration Protocol server sends DHCP sessions by transmission unit as target Dynamic Host Configuration Protocol server to target Dynamic Host Configuration Protocol server Request data package (DHCP request), DHCP session request data packets include that the selected Dynamic Host Configuration Protocol server of router asks IP The content of address.
After Dynamic Host Configuration Protocol server receives the DHCP session request data packets of router reply, one will be sent to router The DHCP sessions of a IP address provided comprising it and other settings confirm data packet, tell dhcp client that can use it The IP address of offer.Then, router passes through session establishment unit 26 and target just by its ICP/IP protocol and network card binding Dynamic Host Configuration Protocol server establishes DHCP sessions.
If entire DHCP Discover processes are completed, the connecting pin of the physical network interface of the router exists Dynamic Host Configuration Protocol server, and the physical network interface establishes DHCP sessions with Dynamic Host Configuration Protocol server, then makees the physical network interface For wan interface, otherwise, using the physical network interface as LAN interface.
It should be noted that above-described embodiment can be freely combined as needed.The above is only the preferred of the present invention Embodiment, it is noted that for those skilled in the art, in the premise for not departing from the principle of the invention Under, several improvements and modifications can also be made, these improvements and modifications also should be regarded as protection scope of the present invention.

Claims (10)

1. the automatic adaptation method of a kind of LAN interface and wan interface, multiple physical network interfaces, feature are equipped in router It is, including step:
Whether the connection status for monitoring the physical network interface of router changes;
If the connection status of the physical network interface changes, according to the IP configuration modes of wan interface and the object The connection client information for managing network interface, identifies the LAN interface and wan interface of the router;
It is that the LAN interface and the wan interface are configured to call configurator.
2. the automatic adaptation method of a kind of LAN interface and wan interface according to claim 1, which is characterized in that according to The IP configuration modes of wan interface and the connection client information of the physical network interface, identify that the LAN of the router connects Mouth and wan interface, this step specifically include:
If the IP configuration modes of wan interface are static IP configuration mode, the company of the physical network interface of the router is detected End is connect whether with the presence of gateway;
If the connecting pin of the physical network interface is with the presence of gateway, no using the physical network interface as wan interface Then, using the physical network interface as LAN interface.
3. the automatic adaptation method of a kind of LAN interface and wan interface according to claim 1, which is characterized in that according to The IP configuration modes of wan interface and the connection client information of the physical network interface, identify that the LAN of the router connects Mouth and wan interface, this step further include specifically:
If the IP configuration modes of wan interface are dynamic IP configuration mode detects the object of the router according to PPPOE agreements The connecting pin for managing network interface whether there is PPPOE servers, and whether the physical network interface is established with PPPOE servers PPPOE sessions;
If the connecting pin of the physical network interface of the router there are PPPOE servers, and the physical network interface with PPPOE servers establish PPPOE sessions, then using the physical network interface as wan interface, otherwise, by the physical network Interface is as LAN interface;
And/or;
If the IP configuration modes of the wan interface selected are dynamic IP configuration mode, according to DHCP protocol, the router is detected The connecting pin of physical network interface whether there is Dynamic Host Configuration Protocol server, and whether the physical network interface is built with Dynamic Host Configuration Protocol server Vertical DHCP sessions;
If the connecting pin of the physical network interface of the router is there are Dynamic Host Configuration Protocol server, and the physical network interface and DHCP Server establishes DHCP sessions, then using the physical network interface as wan interface, otherwise, the physical network interface is made For LAN interface.
4. the automatic adaptation method of a kind of LAN interface and wan interface according to claim 3, which is characterized in that according to PPPOE agreements, the connecting pin for detecting the physical network interface of the router whether there is PPPOE servers, and the physics Whether network interface with PPPOE servers establishes PPPOE sessions, this step specifically includes:
According to PPPOE agreements, PPPOE servers are broadcasted to connecting pin by the physical network interface of the router and inquire data Packet;
If there are service available at least one PPPOE servers for the connecting pin, according at least one PPPOE servers The PPPOE server response data packets of reply select one of PPPOE servers as target PPPOE servers, to described Target PPPOE servers send PPPOE session request data packets;
If the target PPPOE servers, which reply PPPOE sessions, confirms data packet, data are confirmed according to the PPPOE sessions Packet establishes PPPOE sessions with PPPOE servers.
5. the automatic adaptation method of a kind of LAN interface and wan interface according to claim 3, which is characterized in that according to DHCP protocol, the connecting pin for detecting the physical network interface of the router whether there is Dynamic Host Configuration Protocol server, and the Physical Network Whether network interface with Dynamic Host Configuration Protocol server establishes DHCP sessions, this step specifically includes:
According to DHCP protocol, Dynamic Host Configuration Protocol server is broadcasted to connecting pin by the physical network interface of the router and inquires data Packet;
If there are service available at least one Dynamic Host Configuration Protocol server for the connecting pin, returned according at least one Dynamic Host Configuration Protocol server Multiple dhcp server response data packet selects one of Dynamic Host Configuration Protocol server as target Dynamic Host Configuration Protocol server, to the target Dynamic Host Configuration Protocol server sends DHCP session request data packets;
If the target PPPOE servers, which reply DHCP sessions, confirms data packet, data packet is confirmed according to the DHCP sessions DHCP sessions are established with Dynamic Host Configuration Protocol server.
6. a kind of router of achievable LAN interface and wan interface automatic adaptation, connect equipped with multiple physical networks in router Mouthful, which is characterized in that router includes:
Module is monitored, for monitoring whether the connection status of physical network interface of router changes;
Identification module is electrically connected with the detection module, if the connection status for the physical network interface changes, According to the IP configuration modes of the wan interface of selection and the connection client information of the physical network interface, the routing is identified The LAN interface and wan interface of device;
Configuration module is electrically connected with the identification module, is the LAN interface and the wan interface for calling configurator It is configured.
7. the router of a kind of achievable LAN interface and wan interface automatic adaptation according to claim 6, feature exist In the identification module includes:
Detection unit detects the physics of the router if the IP configuration modes for wan interface are static IP configuration mode Whether the connecting pin of network interface is with the presence of gateway;
Processing unit is electrically connected with the detection unit, if the connecting pin for the physical network interface with the presence of gateway, Using the physical network interface as wan interface, otherwise, using the physical network interface as LAN interface.
8. the router of a kind of achievable LAN interface and wan interface automatic adaptation according to claim 6, feature exist In the identification module includes:
Detection unit, according to PPPOE agreements, detects institute if the IP configuration modes for wan interface are dynamic IP configuration mode State the physical network interface of router connecting pin whether there is PPPOE servers, and the physical network interface whether with PPPOE servers establish PPPOE sessions;
Processing unit is electrically connected with the detection unit, if the connecting pin of the physical network interface for the router exists PPPOE servers, and the physical network interface establishes PPPOE sessions with PPPOE servers, then by the physical network interface As wan interface, otherwise, using the physical network interface as LAN interface;
And/or;
The detection unit, if the IP configuration modes for being additionally operable to wan interface are dynamic IP configuration mode, according to DHCP protocol, Detect the physical network interface of the router connecting pin whether there is Dynamic Host Configuration Protocol server, and the physical network interface whether DHCP sessions are established with Dynamic Host Configuration Protocol server;
The processing unit, if the connecting pin of the physical network interface of the router is additionally operable to there are Dynamic Host Configuration Protocol server, and institute It states physical network interface and establishes DHCP sessions with Dynamic Host Configuration Protocol server, then using the physical network interface as wan interface, otherwise, Using the physical network interface as LAN interface.
9. the router of a kind of achievable LAN interface and wan interface automatic adaptation according to claim 8, feature exist In the identification module further includes specifically:
Radio unit, for according to PPPOE agreements, PPPOE to be broadcasted to connecting pin by the physical network interface of the router Server inquires data packet;
Selecting unit, if there are service available at least one PPPOE servers for the connecting pin, according at least one The PPPOE server response data packets that a PPPOE servers are replied, select one of PPPOE servers as target PPPOE Server;
Transmission unit is electrically connected with the selecting module, for sending PPPOE session requests to the target PPPOE servers Data packet;
Session establishment unit, if replying PPPOE sessions for the target PPPOE servers confirms data packet, according to PPPOE sessions confirm that data packet establishes PPPOE sessions with PPPOE servers.
10. the router of a kind of achievable LAN interface and wan interface automatic adaptation according to claim 8, feature exist In the identification module further includes specifically:
Radio unit, for broadcasting Dynamic Host Configuration Protocol server to connecting pin according to the physical network interface of DHCP protocol, the router Inquire data packet;
Selecting unit, if there are service available at least one Dynamic Host Configuration Protocol server for the connecting pin, according at least one The dhcp server response data packet that a Dynamic Host Configuration Protocol server is replied, selects one of Dynamic Host Configuration Protocol server as target DHCP service Device,
Transmission unit is electrically connected with the selecting module, for sending DHCP session request numbers to the target Dynamic Host Configuration Protocol server According to packet;
Session establishment unit, if replying DHCP sessions for the target PPPOE servers confirms data packet, according to DHCP sessions confirm that data packet establishes DHCP sessions with Dynamic Host Configuration Protocol server.
CN201810606986.5A 2018-06-13 2018-06-13 A kind of automatic adaptation method and router of LAN interface and wan interface Pending CN108667672A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810606986.5A CN108667672A (en) 2018-06-13 2018-06-13 A kind of automatic adaptation method and router of LAN interface and wan interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810606986.5A CN108667672A (en) 2018-06-13 2018-06-13 A kind of automatic adaptation method and router of LAN interface and wan interface

Publications (1)

Publication Number Publication Date
CN108667672A true CN108667672A (en) 2018-10-16

Family

ID=63775659

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810606986.5A Pending CN108667672A (en) 2018-06-13 2018-06-13 A kind of automatic adaptation method and router of LAN interface and wan interface

Country Status (1)

Country Link
CN (1) CN108667672A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109358611A (en) * 2018-12-28 2019-02-19 深圳市元征科技股份有限公司 A kind of vehicle diagnostics software pre-setting method, vehicle diagnosing system and relevant device
CN111211944A (en) * 2020-01-07 2020-05-29 深圳市吉祥腾达科技有限公司 Router-WAN multi-dialing stability test system and test method
CN111404779A (en) * 2020-03-12 2020-07-10 深圳市吉祥腾达科技有限公司 Method, device and system for testing role switching of router nodes
CN112688823A (en) * 2021-03-17 2021-04-20 深圳市乙辰科技股份有限公司 Blind-plugging network port binding adaptation method and device based on multiple network ports of wireless network equipment
CN112740762A (en) * 2018-11-01 2021-04-30 深圳市欢太科技有限公司 Wireless fidelity Wi-Fi access method and device, electronic equipment and storage medium
CN114244704A (en) * 2021-12-31 2022-03-25 四川天邑康和通信股份有限公司 Router LANWAN self-adaptation method and system
CN114640582A (en) * 2022-02-23 2022-06-17 深圳市九洲电器有限公司 Intelligent network connection method, system, device and storage medium
CN115348163A (en) * 2021-04-27 2022-11-15 青岛海信宽带多媒体技术有限公司 Router and WAN port self-adaptive configuration method

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1509032A (en) * 2002-12-16 2004-06-30 Detection for dynamic wide-area network port
CN101502049A (en) * 2006-08-23 2009-08-05 汤姆森许可贸易公司 Method and device for identifying and selecting an interface to access a network
CN103812711A (en) * 2012-11-05 2014-05-21 深圳市共进电子股份有限公司 Router reception, transmission, receiving-sending message grabbing package method, and router
CN105592371A (en) * 2014-10-20 2016-05-18 中兴通讯股份有限公司 Method, device and system for automatically classifying services in GPON (Gigabit Passive Optical Network) system
CN106341246A (en) * 2015-07-07 2017-01-18 西安中兴新软件有限责任公司 Method and device for automatically recognizing LAN (Local Area Network) port and WAN (Wide Area Network) port
US20170063906A1 (en) * 2015-08-31 2017-03-02 Splunk Inc. Complex event processing of computer network data
CN106488571A (en) * 2015-08-28 2017-03-08 国基电子(上海)有限公司 Channel selecting method and system
CN106713039A (en) * 2016-12-27 2017-05-24 普联技术有限公司 Method and device for identifying Ethernet ports and router

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1509032A (en) * 2002-12-16 2004-06-30 Detection for dynamic wide-area network port
CN101502049A (en) * 2006-08-23 2009-08-05 汤姆森许可贸易公司 Method and device for identifying and selecting an interface to access a network
CN103812711A (en) * 2012-11-05 2014-05-21 深圳市共进电子股份有限公司 Router reception, transmission, receiving-sending message grabbing package method, and router
CN105592371A (en) * 2014-10-20 2016-05-18 中兴通讯股份有限公司 Method, device and system for automatically classifying services in GPON (Gigabit Passive Optical Network) system
CN106341246A (en) * 2015-07-07 2017-01-18 西安中兴新软件有限责任公司 Method and device for automatically recognizing LAN (Local Area Network) port and WAN (Wide Area Network) port
CN106488571A (en) * 2015-08-28 2017-03-08 国基电子(上海)有限公司 Channel selecting method and system
US20170063906A1 (en) * 2015-08-31 2017-03-02 Splunk Inc. Complex event processing of computer network data
CN106713039A (en) * 2016-12-27 2017-05-24 普联技术有限公司 Method and device for identifying Ethernet ports and router

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112740762A (en) * 2018-11-01 2021-04-30 深圳市欢太科技有限公司 Wireless fidelity Wi-Fi access method and device, electronic equipment and storage medium
CN109358611A (en) * 2018-12-28 2019-02-19 深圳市元征科技股份有限公司 A kind of vehicle diagnostics software pre-setting method, vehicle diagnosing system and relevant device
CN111211944A (en) * 2020-01-07 2020-05-29 深圳市吉祥腾达科技有限公司 Router-WAN multi-dialing stability test system and test method
CN111404779A (en) * 2020-03-12 2020-07-10 深圳市吉祥腾达科技有限公司 Method, device and system for testing role switching of router nodes
CN112688823A (en) * 2021-03-17 2021-04-20 深圳市乙辰科技股份有限公司 Blind-plugging network port binding adaptation method and device based on multiple network ports of wireless network equipment
CN115348163A (en) * 2021-04-27 2022-11-15 青岛海信宽带多媒体技术有限公司 Router and WAN port self-adaptive configuration method
CN115348163B (en) * 2021-04-27 2023-12-01 青岛海信宽带多媒体技术有限公司 Router and WAN port self-adaptive configuration method
CN114244704A (en) * 2021-12-31 2022-03-25 四川天邑康和通信股份有限公司 Router LANWAN self-adaptation method and system
CN114640582A (en) * 2022-02-23 2022-06-17 深圳市九洲电器有限公司 Intelligent network connection method, system, device and storage medium
CN114640582B (en) * 2022-02-23 2023-10-31 深圳市九洲电器有限公司 Intelligent network connection method, system, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN108667672A (en) A kind of automatic adaptation method and router of LAN interface and wan interface
US8125915B2 (en) Remote management of a bridge device
US7342925B2 (en) Technique for automated MAC address cloning
US8787200B2 (en) Device, system, and method for automatically configuring application terminals in home network
CN101056310B (en) Communication equipment
JP4081472B2 (en) Cluster management method and apparatus for network device
EP3264731B1 (en) Method, relay agent, and system for acquiring internet protocol address in network
EP2154821A1 (en) Method and apparatus for sending and receiving multicast packets
US20100121946A1 (en) Method and device for identifying and selecting an interface to access a network
US20100106791A1 (en) PROCESSING METHOD AND DEVICE FOR QinQ TERMINATION CONFIGURATION
US9113031B2 (en) Call control for conferencing calls
CN1980175A (en) Router and communication system
CN106059832A (en) Method and system for automatically judging Internet-surfing way of WAN (Wide Area Network) port
CN101146047A (en) A method, system and gateway for controlling quantity of network access terminal under routing mode
JP2006222929A (en) Network system
US8804569B2 (en) Management session initiation with a customer premises device
CN104106254A (en) Methods and systems for enabling NAT traversal
US20140244726A1 (en) Assignment of Point-to-Point Over Ethernet (PPPoE) Session IDs
CN101335652A (en) Status detection method, apparatus and system of dynamic host configuring protocol
WO2006119690A1 (en) A method and system for cpecf (customer premises equipment configuration function) obtaining the terminal equipment information and configuring the terminal equipment
CN107645556B (en) It is a kind of to realize that SDN turns the isolated broadband access of control and keepalive method and device
CN112073244A (en) TR069 protocol-based message processing method and system
CN107659436A (en) A kind of method and device for preventing service disconnection
CN103856571B (en) A kind of adaptive networking connection method and system
CN103873335B (en) Dialing method of terminal equipment, and access equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20181016

WD01 Invention patent application deemed withdrawn after publication