Embodiment
In order to make purpose of the present invention, technical scheme and advantage clearer, below in conjunction with the accompanying drawing embodiment that develops simultaneously, the present invention is described in detail.
Referring to Fig. 1, Fig. 1 is the method flow diagram that the embodiment of the invention is revised the Ethernet switch configuration, may further comprise the steps:
Step 101, set in advance the configuration modification condition, the corresponding relation of the port PHY state that described configuration modification condition is Ethernet switch, configuration feature item, config option.
Port PHY state described here refers to all of the port combinations of states in the Ethernet switch.In Ethernet, according to the transmission medium difference, ethernet port comprises RJ45, BNC, three kinds of network ports of AUI.According to the difference of port, each port status is to be determined by one or more combinations of its duplex state, operating rate and enabled state.RJ45 port with gigabit Ethernet is example, and each RJ45 port has three kinds of operating rate: 10M, 100M, 1000M; Two kinds of duplex states: half-duplex and full duplex; Two kinds of enabled state: enable (UP) state and do not enable (DOWN); When the enabled state of this RJ45 port when not enabling, has only a kind of DOWN state, and in the enabled state of this RJ45 port when enabling, 10M/ half-duplex (Half), 10M/ full duplex (Full), 100M/Half, 100M/Full, 1000M/Half, 1000M/Full totally 6 kinds of states are then arranged, so the RJ45 port of each gigabit Ethernet has 7 kinds of port statuss.Supposing has 24 RJ45 ports in the Ethernet switch, then this Ethernet switch has 7 24 power kind port statuss combination.Need to prove that port involved in the present invention is not limited to the RJ45 port.
Described configuration feature item also is configurable functionality item, for example a flow control function of Ethernet switch; For any one configuration feature item, all need to have the concrete config option corresponding to this configuration feature item, for example, to the config option of flow control can be: enable flow control, or forbid flow control.
The concrete implication of the corresponding relation of the port PHY state of described Ethernet switch, configuration feature item, config option is: when the port PHY of Ethernet switch state is identical with port PHY state in this corresponding relation, be config option in this corresponding relation with the configuration modification of configuration feature item in this corresponding relation.
Step 102, when needs are revised the configuration of Ethernet switch, according to the port physical layer PHY state of default configuration modification condition setting Ethernet switch.
In this step, after being provided with the port PHY state of Ethernet switch, the staff need wait for that Preset Time at least just allows to change the port PHY state of Ethernet switch, otherwise, may cause revising the configuration failure of Ethernet switch.Here, described Preset Time is the time interval of Ethernet detection self port PHY state.
Step 103, Ethernet switch detect once self port PHY state every Preset Time, and judge whether detected port PHY state satisfies the configuration modification condition, if then revise the config option in the described configuration modification condition of being configured to of configuration feature item in the described configuration modification condition.
In this step, Ethernet switch can periodically detect the port PHY state of self, and when its port PHY state satisfies default configuration modification condition, revises the configuration of Ethernet switch.Here, the described method of judging whether detected port PHY state satisfies the configuration modification condition is: search described default configuration modification condition according to described port PHY port status, if the port PHY state that finds in one of them configuration modification condition is identical with detected port PHY state, then detected port PHY state satisfies the configuration modification condition.
In addition, in revising described configuration modification condition before the configuration of configuration feature item, whether the current configuration that can also judge earlier configuration feature item in the described configuration modification condition is identical with config option in the described configuration modification condition, if it is identical, then do not need to revise the configuration of configuration feature item in the described configuration modification condition, still keep its current configuration constant, if inequality, then revise the config option in the described configuration modification condition of being configured to of configuration feature item in the described configuration modification condition.
Among Fig. 1, Ethernet switch is that the port PHY state to self detects every the set time, and determines to be configured modification in detection, triggers configuration modification.In fact, also can adopt the mode that Ethernet switch is configured modification that triggers at once, for example, set in advance triggering signal, and after being provided with port PHY state this triggering signal of manual triggers, after Ethernet switch receives this triggering signal, detect the port PHY state of self immediately, and carry out corresponding configuration modification according to testing result.But, because the setting of triggering signal also needs extra software and hardware support, therefore, mainly scheme shown in Figure 1 is further specified among the present invention.
In technical scheme of the present invention shown in Figure 1, deploy switch can also be set further.Before the configuration of revising Ethernet switch, further comprise: the open configuration switch allows to revise the configuration of Ethernet switch; In the described configuration modification condition of described modification the configuration feature item be configured to need also further to judge whether deploy switch is opened before the configuration in the described configuration modification condition, if open, then revise the config option in the configuration modification condition of being configured to of configuration feature item in the described configuration modification condition, otherwise, still keep the current configuration of the configuration feature item in the described configuration modification condition constant; After finishing the configuration modification of Ethernet switch, further comprise: close deploy switch, forbid revising the configuration of Ethernet switch.Deploy switch is set avoids the operation of the non-initiative of user to cause switch configuration by abnormal change, can also reduce the erasable number of times of non-the being forced to property of memory.
The condition of enabling of deploy switch can be that the port negotiation with Ethernet switch is the PHY state of appointment, also namely sets in advance deploy switch and opens with corresponding relation, the deploy switch of the port PHY state of Ethernet switch and close corresponding relation with the port PHY state of Ethernet switch.
The method of described open configuration switch is: the port PHY state of Ethernet switch is set to deploy switch and opens corresponding port PHY state, and waits for Preset Time at least; It is deploy switch when opening corresponding port PHY state that Ethernet switch detects port PHY state, and deploy switch is set to opening.
Described method of closing deploy switch is: the port PHY state of Ethernet switch is set to deploy switch and closes corresponding port PHY state, and waits for Preset Time at least; It is deploy switch when closing corresponding port PHY state that Ethernet switch detects port PHY state, and deploy switch is set to closed condition.
The present invention can also set in advance the configuration take-effective mode.The configuration take-effective mode comprise come into force and restart after come into force two kinds.The mode that comes into force simple and fast is applicable to the configuration of no webmaster type switch, in said method, and the mode of the configuration take-effective mode that comes into force exactly.The mode that comes into force after restarting can be avoided the network hit that causes behind the configuration modification and the problem of network topology concussion, is applicable to the configuration of webmaster type switch.
The present invention has also set in advance the deploy switch corresponding parameters.
Under the mode of coming into force, the method that deploy switch is set to opening is: the deploy switch corresponding parameters is set to deploy switch and opens corresponding value, and for example the corresponding value of deploy switch unlatching is 1; The method that deploy switch is set to closed condition is: the deploy switch corresponding parameters is set to deploy switch and closes corresponding value, and for example to close corresponding value be 0 to deploy switch.
Generally, for no webmaster type switch, generally can directly revise the value of the MAC register of each configuration feature item correspondence.Therefore, under the mode of coming into force, for no webmaster type switch, the method that is configured to the config option in the described configuration modification condition of configuration feature item is in the described configuration modification condition of the described modification of step 102: the value that the value of the MAC register of configuration feature item correspondence in the described configuration modification condition is revised as config option correspondence in the described configuration modification condition, the value of correspondence is 1 when for example being configured to enable, and being configured to not enable corresponding value is 0; And for webmaster type switch, then generally do not allow directly to revise the MAC register value of each configuration feature item correspondence.Yet, because the configuration parameter corresponding to each configuration feature item is arranged in the network management system of moving in the webmaster type switch, therefore, can reach the purpose of the configuration of revising this configuration feature item by this configuration feature item corresponding parameters in the modification network management system indirectly.Therefore, under the mode of coming into force, for webmaster type switch, the method that is configured to the config option in the described configuration modification condition of configuration feature item is in the described configuration modification condition of the described modification of step 102: the value that the configuration parameter in the network management system of configuration feature item correspondence in the described configuration modification condition is revised as config option correspondence in the described configuration modification condition.Revise the parameter in the network management system, for example, technical scheme of the present invention is realized in network management system, support directly to revise parameters in the network management system, the problem that this belongs to specific implementation repeats no more.
If the configuration take-effective mode is set to come into force for after restarting, the port physical layer PHY state of the default configuration modification condition setting Ethernet switch of the described basis of step 102 then, and wait for that at least further comprise: following electricity is restarted Ethernet switch after the Preset Time; The method of the config option that is configured to described configuration modification condition of the configuration feature item of the described configuration modification condition of the described modification of step 103 is: the value of MAC register is revised as the value of config option correspondence in the described configuration modification condition in the configuration file of preserving in the storage space with the Ethernet switch of the configuration feature item correspondence of described configuration modification condition.
Under the mode that comes into force after restarting, in the process of open configuration switch, the port PHY state of described Ethernet switch is set to deploy switch and opens corresponding port PHY state, and waits for that at least further comprise: following electricity is restarted Ethernet switch after the Preset Time; The method that deploy switch is set to opening is: the value of deploy switch correspondence is revised as the value that deploy switch is opened correspondence in the configuration file of preserving in the storage space with Ethernet switch; In closing the process of deploy switch, the port PHY state of described Ethernet switch is set to deploy switch and closes corresponding port PHY state, and waits for that at least further comprise: following electricity is restarted Ethernet switch after the Preset Time; The method that the Ethernet switch deploy switch is set to closed condition is: the value of deploy switch correspondence is revised as the value that deploy switch is closed correspondence in the configuration file of preserving in the storage space with Ethernet switch.
Under the mode that comes into force after restarting, Ethernet switch by reading the configuration file that upgrades in the memory, can be realized the open and close of deploy switch, the purposes such as modification of configuration in the process that electricity is restarted down.
The configuration take-effective mode can be preestablished by the production firm of Ethernet switch, also can be selected by the user.When selecting the configuration take-effective mode voluntarily by the user, the present invention has also set in advance configuration take-effective mode corresponding parameters, also preestablish the corresponding relation of configuration take-effective mode and port PHY state in addition, also be the port PHY state of the port PHY state of Ethernet switch and the come into force corresponding relation of mode and Ethernet switch and restart after the come into force corresponding relation of mode; Before the open configuration switch, the configuration take-effective mode can also further be set, concrete method to set up is: ethernet switch port PHY state is set to the configuration take-effective mode corresponding port PHY state of needs, and wait for Preset Time at least, when Ethernet switch detects port PHY state and comes into force mode corresponding to the mode of coming into force or after restarting, configuration take-effective mode corresponding parameters be set to the mode of coming into force or restart after the come into force value of mode correspondence.Here, the configuration take-effective mode being set only need arrange once and get final product.
Need to prove, in the method for above-mentioned modification Ethernet switch configuration, wait for Preset Time at least be because: the time interval of detecting the port PHY state of Ethernet switch is described Preset Time, if the stand-by period is less than Preset Time, then might before changing this port PHY state, also not detect preceding this port PHY state of change.For example, after port PHY state arranged deploy switch and open, before Ethernet switch detects this port PHY state, just port PHY state is configured such that the corresponding state of energy flow control, then in fact still not unlatching this moment of deploy switch.
So that to revise the modal flow control function that the no webmaster type Ethernet switch of 24 RJ45 ports arranged be example the method for above-mentioned modification Ethernet switch configuration is described below.Suppose Ethernet switch dispatch from the factory be set in advance as follows:
1, the default traffic of switch control function is closed condition, also i.e. enabled state not; Deploy switch is closed condition; The configuration take-effective mode of switch is the mode of coming into force;
2, the P1-P21 port is the Down state, and when the P22-P24 port was the 10M/Half state, the concrete configuration of the flow control function of modification switch was for enabling flow control;
3, the P1-P8 port is the 10M/half state, and when other port was the Down state, the deploy switch of revising switch was opening, allowed to revise the configuration of switch;
4, the P9-P16 port is the 10M/Half state, and when other port was the Down state, revising the switch configuration switch was closed condition, forbids revising the configuration of switch;
5, the P17-P24 port is 10M/Half, and when other port was the Down state, the configuration take-effective mode of revising switch came into force for after restarting.
If the user wishes that the configuration take-effective mode with switch is revised as and comes into force after restarting, with the configuration modification of the flow control function of switch for enabling flow control, the cycle of supposing Ethernet switch detection port PHY state is 5 seconds, and then concrete configuration step is as follows:
A, the P17-P24 port of switch is connected the hub with 8 ports (HUB) that operating rate is 10M with general twisted-pair power cable, other port does not connect netting twine, after connection is finished, wait at least 5 seconds, the configuration take-effective mode of switch comes into force after being revised as and restarting; In the time of waiting for, Ethernet switch can detect port PHY state, and according to port PHY state, the configuration take-effective mode is revised as comes into force after restarting.
B, the P1-P8 port of switch is connected the hub with 8 ports (HUB) that operating rate is 10M with general twisted-pair power cable, other port does not connect netting twine, connect finish after, wait at least 5 seconds, electricity under the switch is restarted.In the time of waiting for, Ethernet switch can detect port PHY state, and according to port PHY state, the value of the deploy switch correspondence in the configuration file of preserving in the memory space with Ethernet switch is revised as the value of open configuration switch correspondence, and comes into force after switch is restarted.So far, the deploy switch of switch is opened, and allows to revise the configuration of switch;
C, the P22-P24 port of switch is connected the hub with 8 ports (HUB) that operating rate is 10M with general twisted-pair power cable, other port does not connect netting twine, connect finish after, wait at least 5 seconds, electricity under the switch is restarted.In the time of waiting for, Ethernet switch can detect port PHY state, and according to port PHY state, the value of the flow control function correspondence in the configuration file of preserving in the memory space with Ethernet switch is revised as the value that enables the flow control correspondence, and comes into force after switch is restarted.So far, the flow control function of switch is opened, and also namely enables;
D, the P9-P16 port of switch is connected the hub with 8 ports (HUB) that operating rate is 10M with general twisted-pair power cable, other port does not connect netting twine, connect finish after, wait at least 5 seconds, electricity under the switch is restarted.In the time of waiting for, Ethernet switch can detect port PHY state, and according to port PHY state, the value of the deploy switch correspondence in the configuration file of preserving in the memory space with Ethernet switch is revised as the value of closing the deploy switch correspondence, and comes into force after switch is restarted.So far, the deploy switch of switch is closed, and forbids revising the configuration of switch.
By above-mentioned A, B, C, four steps of D, the user can realize revising the too configuration of the flow control function of network switch not by computer.Because the gigabit ethernet switch with 24 RJ45 ports has 7 24 power kind port statuss combination, therefore, the basic function that satisfies switch is fully set, uses such as default setting are dispatched from the factory in recovery, and, under the abundant situation of port, to the function of some more complicated, for example division of Virtual Local Area Network etc. also is can be by the different incompatible realizations of port PHY state group in theory.
The present invention also provides a kind of Ethernet switch, and this Ethernet switch support need just can not revised the configuration of this Ethernet switch by computer.
Referring to Fig. 2, Fig. 2 is the structural representation of embodiment of the invention Ethernet switch.This Ethernet switch comprises: dispensing unit 210, detecting unit 220; Wherein,
Dispensing unit 210 is used for setting in advance configuration modification condition, the corresponding relation of the port PHY state that described configuration modification condition is Ethernet switch, configuration feature item, config option;
Detecting unit 220, port PHY state for detection of Ethernet switch, and judge whether detected port PHY state satisfies the configuration modification condition that dispensing unit 210 sets in advance, if then revise the config option in the described configuration modification condition of being configured to of configuration feature item in the described configuration modification condition.
Described detecting unit 220 comprises: detection sub-unit 221, judging unit 222, performance element 223;
Described detection sub-unit 221 is used for every detecting once self port PHY state, and notifies judging unit 222 with testing result;
Described judging unit 222, be used for judging whether detection sub-unit 221 detected port PHY states satisfy the configuration modification condition that dispensing unit 210 sets in advance, if then notify performance element 223 to revise the configuration of the configuration feature item in the described configuration modification condition;
Described performance element 223 after being used for receiving the notice of judging unit 222, is config option in the described configuration modification condition with the configuration modification of configuration feature item in the described configuration modification condition.
Described judging unit 222 is judged when whether detection sub-unit 221 detected port PHY states satisfy the configuration modification condition that dispensing unit 210 sets in advance, be used for: search described default configuration modification condition according to detected port PHY state, if it is identical with detected port PHY state to find one of them configuration modification condition corresponding port PHY state, then detected port PHY state satisfies the configuration modification condition.
Described judging unit 222 notice performance elements 223 are revised before the configuration of the configuration feature item in the described configuration modification condition, be further used for: whether the current configuration of configuration feature item of judging described configuration modification condition is identical with config option in the described configuration modification condition, if then do not notify performance element 223.
Described dispensing unit 210 is also pre-configured deploy switch, deploy switch opened with corresponding relation, the deploy switch of port PHY state and closed corresponding relation with port PHY state;
Described judging unit 222, be further used for judging whether detection sub-unit 221 detected port PHY states are opened with deploy switch or deploy switch to close corresponding port PHY state identical, if identical with deploy switch unlatching corresponding port PHY state, then notify performance element 223 open configuration switches; If to close corresponding port PHY state identical with deploy switch, then notify performance element 223 to close deploy switch;
Described performance element 223, when being further used for receiving the notice of open configuration switch of judging unit 222, deploy switch is set to opening, receive judging unit 222 close the notice of deploy switch the time, deploy switch is set to closed condition.
The configuration that described judging unit 222 notice performance elements 223 are revised the configuration feature item in the described configuration modification condition is further used for before: judge whether deploy switch is opened, if not, then do not notify performance element 223.
Described dispensing unit 210 has also set in advance the configuration take-effective mode, and mode comes into force after described configuration take-effective mode comprises the mode of coming into force and restarts; The corresponding relation of the port PHY state that sets in advance Ethernet switch and the mode that comes into force, the port PHY state of Ethernet switch and restart after the come into force corresponding relation of mode;
Described judging unit 222, be further used for judging that the detection sub-unit 221 detected port PHY states mode corresponding port PHY state that whether comes into force with the mode of coming into force or after restarting is identical, if mode corresponding port PHY state is identical with coming into force, then notifies performance element 223 that the configuration take-effective mode is revised as and come into force; If with restart after the mode corresponding port PHY state that comes into force identical, come into force after then notifying performance element 223 configuration take-effective modes to be set to restart;
Described performance element 223, be used for receiving judging unit 222 the configuration take-effective mode is revised as the notice of the mode of coming into force after, the configuration take-effective mode is revised as coming into force; After receiving the notice of the mode that comes into force after judging unit 222 the configuration take-effective mode is revised as restarted, the configuration take-effective mode is revised as down electricity restarts aftereffect.
Described dispensing unit 210 sets in advance the configuration take-effective mode for coming into force;
When described performance element 223 deploy switchs are set to opening, be used for: described deploy switch corresponding parameters value is set to deploy switch and opens corresponding value;
When described performance element 223 deploy switchs are set to closed condition, be used for: described deploy switch corresponding parameters value is set to deploy switch and closes corresponding value.
Described Ethernet switch is no webmaster type switch;
When described performance element 223 was config option in the described configuration modification condition with the configuration modification of configuration feature item in the described configuration modification condition, be used for: the value of revising the MAC register of described configuration modification condition configuration feature item correspondence was the value of config option correspondence in the described configuration modification condition;
Perhaps,
Described Ethernet switch is webmaster type switch;
When described performance element 223 is config option in the described configuration modification condition with the configuration modification of configuration feature item in the described configuration modification condition of described modification, be used for: the value of revising configuration parameter in the network management system of described configuration modification condition configuration feature item correspondence is the value of config option correspondence in the described configuration modification condition.
Described dispensing unit 210 also sets in advance the configuration take-effective mode and comes into force for after restarting;
When described performance element 223 is config option in the described configuration modification condition with the configuration modification of configuration feature item in the described configuration modification condition, be used for: the value of the configuration file MAC register of preserving in the storage space with the Ethernet switch of the configuration feature item correspondence of described configuration modification condition is revised as the value of config option correspondence in the described configuration modification condition;
When described performance element 223 deploy switchs are set to opening, be used for: the value of deploy switch correspondence described in the configuration file of preserving in the storage space with Ethernet switch is revised as described deploy switch opens corresponding value;
When described performance element 223 deploy switchs are set to closed condition, be used for: the value of deploy switch correspondence described in the configuration file of preserving in the storage space with Ethernet switch is revised as described deploy switch closes corresponding value.
By top technical scheme as can be known, the method of this modification Ethernet switch configuration of the present invention, the corresponding relation of the port PHY state by setting in advance Ethernet switch, configuration feature item, config option, when needs are revised the configuration of certain configuration feature item of switch, the port of switch is set to corresponding port PHY state, when switch detects this port PHY state, revise the configuration of this corresponding configuration function items, thereby realize just can not revising by computer the purpose of the configuration of Ethernet switch; In addition, the present invention has also set in advance deploy switch, when needs are revised the configuration of Ethernet switch, the open configuration switch, after configuration modification is finished, close deploy switch, thereby can avoid the configuration of the Ethernet switch that the operation of the non-initiative of user causes to be revised unusually, can also reduce the erasable number of times of non-the being forced to property of memory space; In addition, the present invention can also support the user to select the mode of configuration take-effective.
The above only is preferred embodiment of the present invention, and is in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of making, is equal to replacement, improvement etc., all should be included within the scope of protection of the invention.